Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In an enterprise application, validation is critical. The purpose of validation is to verify that the data being processed fulfills all predefined business requirements as well as to ensure the data integrity and usefulness in other layers of the application.
In application development, data validation is always mentioned along with conversion and formatting. The reason is that most likely the format of the source of data is different from the format being used in the application server. For example, in a web application, a user enters information in the web browser frontend. When the user saves the data, the data is sent to the server (after the local validation has completed). On the server side, a data-binding process will be performed, in which the data from the HTTP request will be extracted, converted, and bound to the corresponding domain objects (for example, users enter contact information in an HTML form that will be bound to a Contact object in the server), based on the formatting rules defined for each attribute (for example, the date format pattern is yyyy-MM-dd). When the data binding is complete, the validation rules are applied to the domain object to check for any constraint violation. If everything runs fine, the data is persisted, and a success message is displayed to the user. Otherwise, validation error messages are populated and displayed to the user.