choose descriptive and unambiguous names, no duplication. ▶ Class Names - Should have noun or noun phrase names like Transaction, Account, and TransactionParser. - Should not be a verb. ▶ Function Names. - Should have verb or verb phrase name like sendData() , deleteAccount()… - Accessors ,mutators ,and predicates should be named for their value and prefixed with get, set, and is according to the javabean standard.
Code. ▶ Don’t be redundant. ▶ Use as explanation of intent. ▶ Use as clarification of code. ▶ Use as warning of consequences. ▶ Do not Commented-Out Code. ▶ TODO comment for something you have not done yet.
Split big classes into smaller ones, and avoid God Classes.. What should be done ? Always think of the logic and the business rules which are only applicable for that class.
closed for modification. What should be done ? Write your codes in a way so that, if someone wants to add a new functionality to the class in future, he or she won’t have to touch your existing code.
type definitions.. What should be done ? If you have two classes, class A and class B, where B is a subclass of A, all the methods which are mentioned in class A should have implementation in class B.
methods it does not use. It means : We should split large and fat interfaces into several small and lighter one are based on specific intent. What should be done ? Segregate the interface for each class
Both should depend on abstractions. ▶ Abstractions should not depend upon details. Details should depend upon abstractions. What should be done ? We should not extend concrete classes, we should always depend on abstractions like abstract classes or interfaces.