Channels ▼
RSS

.NET

Programming with Reason: 1


Abstraction, or "Just Wrap It!"

As a user or developer of network software, life is relatively simple today because operating systems and software libraries provide a nice facade to work with. Behind these facades may lie a level of complexity you're not ready or willing to deal with, but thanks to clever design you may never have to. This is called abstraction, where you gain the ability to treat an entire system of seething complexity as a simple box in a diagram, or entity in your mind. Not everyone has the ability to abstract to the level required to deal with such things. Just as the most famous artists have used it to amaze us with their work, the best computer scientists use it to solve complex problems with (sometimes only apparent) simplicity. This is what computer scientists often refer to as elegance.

Therefore, I propose that the transitive of my first rule of design is also true:

Eric's Second Rule: Elegance equals simplicity.

I once worked with a developer who used to talk about a fictional product he dreamed of creating called "Wrap App." This revolutionary tool would offer the ultimate in abstraction and wrap every possible problem in a veil of simplicity. With it, new applications could be created instantly with a click of a button. Awesome vision and goal! It's not the sort of cerebral challenge most developers crave; but from a business point of view it's the brass ring. But even I'll admit, this goal may involve too much simplicity to ever be a reality.

Turn it Inside-Out

Simple and elegant software design should go beyond just the code that makes the system work, it should extend to the user interface as well. This may be obvious for applications with a graphical interface, for which there are ample guidelines to good design, but it also applies to applications with more abstract interfaces: the tools and systems that we use to develop and deploy other software. For instance, why has FTP lasted so long in a world where constant software upgrades are a fact of life? Because it just works, out of the box. This is how all software should be. Don't make installation and configuration an afterthought.

This leads us to my next rule:

Eric's Third Rule: Turn your design inside out.

A good internal design should be turned inside out, and it's usage should be as elegant as it's inner workings. If it's pretty on the inside, it should at least be as pretty on outside. The inverse is true for those whose focus may be on the outside (i.e. graphic artists). If you're a UI designer and also a programmer, try not to sacrifice the elegance of your software's internal design for the sake of quickly iterating the UI. I've seen far too many prototypes (with hacked code never meant to survive) go on to become the actual product. Again, I speak from experience; this is another software crime I'm guilty of.

Conclusion

Although there are countless rules, guidelines, and methodologies to help achieve good software design, the best ones are those that lead to the greatest success. How you measure success may vary: high performance, stability, robustness, scalability, ease of code modification, and so on. But I've found that my three simple high-level rules for software design are always a good start:

  • Simplicity equals elegance: strive for the simplest solutions involving fewest "moving pieces".
  • Elegance equals simplicity: apply abstraction to simplify even the toughest of problems.
  • Turn your design inside-out: make your software simple and elegant to use as well.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video