Thoughts on software design philosophy
Published by Joe Lovick on April 20th, 2019
TDD design thoughts
Rules for a simple design...
- Runs all the tests
- Contains no duplication
- Expresses the intent of the programmer
- Minimizes the number of classes and methods
TDD rules in general...
- Write a test.
- Make it compile.
- Run it to see that it fails
- Make it run.
- Remove duplication.
Strategies I know for quickly getting to green:
- Fake It-Return a constant and gradually replace constants with variables until you have the real code.
- Use Obvious Implementation-Type in the real implementation
When I use TDD in practice, I commonly shift between these two modes of implementation.
Class Names
Classes and objects should have noun or noun phrase names like Customer, WikiPage,
Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name
of a class. A class name should not be a verb.
Method Names
Methods should have verb or verb phrase names like postPayment, deletePage, or save.