# ex: set ts=2 et tw=78: +---------------------------------------------------------------------------+ | Lessons on Software Design and Implementation | | I've Learned the Hard Way | +---------------------------------------------------------------------------+ First off, better references than mine: * Planning * Speed vs. Size For a specialized application, that is, an application that will be run on dedicated hardware, do *NOT* worry about temporarily "saving memory" by realloc()ing data structures. Why not? * There should already be enough space If the platform is required to run your app, it should be configured with enough memory, storage, etc. That platform should not have any non-necessary software installed. It should be able to run your software, and that's it. * Simplicity * Keep it simple Anyone can write a program that works and that is almost impossible for other people to understand. It takes a skilled programmer to produce code that is defect-free and straight-forward. Because all serious programming languages are Turing-complete, there are an infinite number of programs that, given the same input, produce the same output as your program. * Everything else equal, fewer lines of code is better Given 2 functions that are well-written, clear and produce exactly the same output, I would select the shorter one over the longer one. Why? * Time * Programmer's time vs. Machine's time * Optimization * * Everything In Its Place * Variable/Field value should represent a single piece of information I once worked on an application that stored its data in a database. The keys were varchars in the format: prefix - name - suffix - optional suffix The application's queries and code had large, complicated logic for filtering and parsing out the various sub-fields and generally making sense of it. Why? This data could very simply fit in 4 separate database fields or an array/structure. *