October 2004
Intermediate to advanced
240 pages
6h 22m
English
Commit to abstractions, not to details: Use the most generic and abstract means to implement a piece of functionality.
When writing code, use the most abstract means available that get the job done. Think in terms of what operations put the least “capabilities strain” on the interfaces they operate on. This habit makes your code more generic, and therefore more reusable and more resilient to changes in its surroundings.
On the contrary, code that gratuitously commits to details is rigid and fragile:
• Use != instead of < to compare iterators: Using != is more general and so applies to a larger class of objects; using < asks for ordering, and only random-access iterators can ...
Read now
Unlock full access