Wednesday, January 3, 2018

Qualities of Good Code

1. Maintainable
2. Readable
3. Easily Understandable
4. Reusable
5. Easy to change if Requirement changes
6. Modular
7. Take care of ility concern.


Quality of Good class


1. Comments :  should be used to clairyfy 'why' instead of what.
2. Method should be short.
3. If else should be method wise like IsGreater()
4. Short parameter list :  Don't pass everything that a method need pass enough so that a method can get everything it need.
5. A class  should be small. A class that is trying to do too much can be identified by looking at how many instances variable it has. If class has too many variables duplicate code can not be avoided.
6. Type embedded in name Scheduled.Add(course) is preferred instead Scheduled.AddCource(course);
7. Take the best name change it later if required.
8. Dead Code : A variable, method, fragment, class is called dead if it not used anywhere except test cases.
9. Speculative Generality : Don't over generalized your code in an attempt to predict future need.

No comments:

Followers

Link