With so much historical momentum around complex, poorly-factored code, it can be difficult to know what simple code looks like.
It can help to see some examples outside of your normal experience, to get you thinking in new ways. With that in mind, I really enjoyed
this list:
- every JUnit test must run in under 1 second
- maximum of 1 if statement per class
- 0-2 fields per class
- 0-1 arguments per method
- 1-3 statements per method
- fewer than 6 imported classes per class
I'm not saying these should be hard rules, or even that they are ideals. Instead, try refactoring your code to fit within these constraints, and observe the result. Does anything useful appear? (Like a
Whole Value?)
No comments:
Post a Comment