0_Unsorted_
Convert switch statements into classes.Flexibility
Goals:
- Easy to change. When change is needed, it should be done in one place instead of multiple places.
- Easy to debug. Problems should be easy to find.
- Easy to read and understand.
Solution:
- Small functions. Split big functions into multiple small functions, split big process into small steps.
- Single responsibility. Every function should do only one task.
- Prefer composition over inheritance. Credits to this stackoverflow answer.
- Loose coupling of components.
- DRY ( do not repeat yourself). When value is used multiple times, it should be assigned to a variable.
Readability
Goals:
- to make the code understandable
Solution:
- Everything from the "Flexibility" section supra.
- Prefer meaningful variable names instead of comments.
No comments:
Post a Comment