max·im [mak-sim] noun
- (now rare) A self-evident axiom or premise; a pithy expression of a general principle or rule.
- A precept; a succinct statement or observation of a rule of conduct or moral teaching.
These are my maxims when designing software.
DONE is better. A design can never be perfect; you’ll always think of a way to make it better. A design should be just good enough to ship, rather than delay the release by months to make everything perfect. Consistency can be sacrificed for simplicity temporarily; you can (and should) refactor later.
A related concept is YAGNI (You Aren’t Gonna Need It). You think you need to build a frobnicator at some point for the project? Don’t start working on it yet: There’s a good chance you won’t need it, or you find one that someone has already made. Don’t build the framework for the bug tracker for the project before creating something that can be shipped.
DRY (Don’t Repeat Yourself) in any level. Information should have only one source. Functionality and control structures should not be repeated. Create abstractions and use ideas from other programming paradigms. In the spirit of YAGNI apply the rule of three: don’t spend an enormous effort on refactoring repetition until you see it 3 times.
Conservation of complexity, or “no silver bullet”: You can move complexity around but you can never reduce it beyond the level inherent to the problem domain. Good design is about deciding how to break complexity into reasonable chunks and distributing it between components: You can make the processing module simpler by moving some logic to the I/O modules. You can make the code simpler by moving complexity to the type system. You can make the interface simpler by making the code more complex. You decide what’s better.
Think about usability. Even if you are creating a library that interfaces a banking application, far removed from the end user with a monitor and a keyboard, you have a a user: the person writing code that uses your library. Arrange the design so that it’s possible to create a reasonable user interface, whether it’s a GUI or an API.
