Design principles

I have been reading Practical Data Structures in C++ now a days. There the author suggests the following design principles while writing a program:

  • Maintain the viewpoint of a practitioner: By this the author intends to say that first get the program working, by whatever inelegant means, then try to find more elegant ways of doing the same thing, provided it is warranted.
  • There is no such thing as a complex solution: Keep the design as simple as possible. The simple solution is separated from you not by distance, but by time.
  • Don’t overgeneralize: Over generalizing can lead to a lot of special cases and thus may incur a lot of overhead.
  • Follow the 80-20 rule: Spend most of your effort on that 20% of code.
  • Design first, then optimize: He means that do the optimization first at the design level and then at the implementation level.
  • Try to get the most leverage out of any overhead you introduce.
  • You shouldn’t have to pay for something that you are not going to use.

The last two principles need some thought.

Advertisements

One thought on “Design principles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s