No matter we are newbie, junior or even senior developers, we see the validation everywhere in source code. I used to not appreciate the validation. I found it slows me down from creating features quickly. Yes! quick development and ease maintenance are different. We can only choose one of them or trying to keep them balanced. It’s ok for quick development at the beginning of project. But when we get more users, the maintainability is crucial one. We need to move slowly. It’s like a big ship which gets hard to change the direction or even moving forward. But it’s stable in front of the big waves. We want to keep the current stable incomes, making our customers happy.
We develop validation in everywhere. The models and controllers are the most we can see. Views also validated by javascript. It’s essential for API. Let’s imagine that our system working with a third party. They don’t provide us the testing environment but only the production endpoints. We need to validate the parameters to make sure we are sending the correct one and it will be success. We test internally many times with this validation before running in production.
The idea is that we want to make sure our parameters are correct without saving or posting to production server. You might say we need to test first in our testing environment. Sure! but not enough. The validation will support the automation test, that would be great. We add the constraints to our data which is one more layer to defend.
When we do something at first time, we consider to make it easier and faster in the next times. That’s how we are moving forward.