Java Tips #01 — Handle validation in an elegant manner using chain of responsibility design pattern

Case study : User registration form validation

Basic classes to store user’s form and validation result

SignUpCommand class
ValidationResult class
ValidationStep class

Validation chaining example

SignUp validation service

Returning booleans / validation wrapper classes

Summary

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store