appthem is based in SE Melbourne

Tel: 0425 703 597

Show in Google Maps


Single Responsibility Principle or SRP states that every class should have a single responsibility. There should never be more than one reason for a class to change.

Just because you can add everything you want into your class doesn’t mean that you should. Thinking in terms of responsibilities will help you design your application better. Ask yourself whether the logic you are introducing should live in this class or not. Using layers in your application helps a lot. Split big classes into smaller ones and avoid god classes. Last but not least, write straightforward comments. If you write comments using words and phrases such as "in this case", "but", "if", "except", "when", "or", then that's a sign that you are doing it wrong.