This chapter covers
- The importance of validating data at system boundaries
- Validating data using JSON schema language
- Integrating data validation into an existing code base
- Getting detailed information about data validation failures
At first sight, it may seem that embracing Data-Oriented programming means accessing data without validating it, and engaging in wishful thinking that data is always valid.
In fact, data validation is not only possible but recommended when we follow Data-Oriented principles. This chapter illustrates how to validate data when data is represented with generic data structures. This chapter focuses on data validation occurring at the boundaries of the system while in Part 3, we will deal with validating data as it flows through the system.
This chapter is a deep dive into the fourth principle of Data-Oriented Programming:
Note
Principle #4: Separate data schema and data representation.
Theo has rescheduled his meetings, still not sure if he’s made a big mistake giving DOP a second chance.
Warning
The reason why Theo rescheduled his meetings is explained in the opener for Part 2. Please take a moment to read the opener if you missed it.
JOE: What aspect of Object-Oriented programming do you think you will miss the most in your big project?
THEO: Data validation.
JOE: Can you elaborate a bit?