From the course: Effective Serialization with Python

Unlock the full course today

Join today to access over 23,000 courses taught by industry experts.

General serialization rules

General serialization rules

- [Instructor] No matter which serialization format you pick, there are some practices you should follow. The first thing you should do even before picking a format is design and document your data. You need to think about what are the objects being passed? What are their properties and what are the limitation on the data? Say you're passing a weather measurement. What are the fields? What is the units of the temperature? Et cetera, et cetera. Well designed data makes it easier to understand code and validate. Don't skip this step and make sure to review the design on every update. The second rule is that you should serialize only at the edges of your program. Say you get a timestamp as a string. You should convert it to a Python datetime object and work with this object internally. I've seen people pass around the timestamp string and deserialize it over and over again. When you Serialize at the Edges, you…

Contents