The Problem with Design and Implementation

Before I begin my analysis (read attack) on this attitude, let me first say that I am probably the last person that just starts hacking away at code. I really do believe in design and properly thinking about a problem first. So keep this in mind and for the rest of this article; understand that I am in no way advocating hacking as a legitimate way to write software. Let me also suggest that you read this article focusing on the mentality of the people in the business and how it works out in practice. Many of the terms I take issue with may seem reasonable from an abstract academic point of view, but this article in written from a practical perspective.

The Origin

I believe the origin of this attitude stems from older fields in engineering. The civil engineer designs a bridge and the construction workers build (implement) the bridge. The mechanical engineers design a car and the autoworkers assemble (implement) the car. So it was natural to try and overlay this well known idea onto the field of software. One designs software and then another implements. You can see the constant theme here. The implementers are thought to be like robots. All they need to do is follow the instructions in the design and you will end up with a good product.

The Philosophical Problem

The major problem with this is that ALL of software is design. 100% of software is design from the high level architect-like design to the low-level design of a for-loop. The implementers of software are not human! I knew you suspected as much given how odd many programmers are. No, the implementers of software are actually ‘perfect’ machines. They are the compilers (interpreters, preprocessors… are all included in the generic use of the this word). For almost all purposes, the compiler is perfect. I’ve yet to run into a situation where I’ve written code and the compiler has not followed my instructions and that is the reason something broke. It hasn’t happened yet.

It is rather strange actually. It is as if people do not recognize the very thing the computer brings to the table. It gets rid of human implementers. It makes them obsolete. Thus, it can do the same task perfectly over and over again without error. Software is like a civil engineer having an army of robots capable of reading his design and perfectly building the bridge every time. What an amazing world that would be. Every screw is tightened to the exact specification. Every weld done perfectly. Every piece of steel cut to the exact precision. That is what we have in the world of software. The perfection of implementation. Yet, we do not recognize this. Rather, we have decided we cannot live in a world without human implementers. So we erroneously transferred this concept over to the field of software and created the notion of implementation where none is needed.

What is Design?

Yes, all of software is design. There is no implementation. Pardon me as I stress this over and over. There is only high level and low level design. To mirror other fields of engineering: A civil engineer also has high level design, such as choosing the type and shape of bridge. A civil engineer also has lots of low level design, such as choosing the kind of screws, where they go, where to weld…

All parts of the design are essential and are 100% design. So it is in software. The high-level architecture (choosing components, designing interfaces…) are all essential. So is the low-level design of individual for loops, error checking… I dare suggest most of the problems I deal with on a day to day basis are in problems in the low-level. Low-level software should not be dismissed as dummy work. This is the guts of a program.

The Real World Problem

Every line of source code is design. Software is the equivalent of the blue prints to a bridge.
The only complete design is actual source code. Once you realize this, you will begin to understand why so many software projects go wrong. It is not enough to hand over a design document or specification to a code-monkey and expect everything to come out okay. The key issue here is to understand that no traditional design document or specification is complete. If it were complete, you would have been better off just writing the source code yourself.

After all, what is source code, but the specification of what the program should do? Most modern programming languages resemble English and written language enough that a well-written program reads as well as a specification. Modern programming languages are not cryptic or needlessly verbose like assembler. Programming languages have gotten so good and have gotten rid of so much of the fluff that they essentially have become a very good way to represent algorithms. As I look through my source code today, about the only fluff are the import or include statements at the top of the file. Well written libraries and proper design abstract the rest of the fluff.

Suppose I were to write a function that divides two numbers. I could either write a specification as follows:

Program Inputs: 32 bit signed integer A, 32 bit signed integer B<br />
Program Outputs: A/B as an integer ignoring any fractional component<br />
Error checking: If B is 0 then the program will throw an exception

That is what a properly written specification would be. I could of course have just written the source code myself as follows.

int DivideNumbers( int a, int b)
{
    if( 0 == b) throw new Exception ("Illegal divide by zero");
    return a/b;
}

Is the English specification any clearer than the actual code? I highly doubt it. You might as well just look at the source. Does the English specification provide anything of value that the source code does not? Combine this with the fact that if you need to make changes, you are relying on the specification and now you run the risk of having the specification be out of date with the source. Now imagine a program with thousands upon thousands of functions. Have you ever worked at a place where every function is defined in a specification to the detail above BEFORE any code is written? Of course not! Everyone recognizes the insanity that would be. It would be mindlessly repetitive to fully specify something in English and than translate that in source code.

Of course this even assumes it is reasonable to think a design can be perfected when written once. Indeed, software is an iterative process as is most designs. You design something, test it out, makes changes, rinse and repeat. Software makes this process amazingly simple given our debuggers which act is simulators. Certain fields in engineering have been done so much that standard designs make it seem as if they somehow possess more quality. We certainly aren’t building many new styles of bridges for example. Yet given any new problem, all fields in engineering face an iterative process filled with bugs. We’ve been doing civil engineering for centuries. Somehow things like the Big Dig in Boston still cause lots of problems.

82 Comments

  1. 2009-09-09 4:41 pm
    • 2009-09-09 5:09 pm
    • 2009-09-09 5:56 pm
  2. 2009-09-09 5:13 pm
    • 2009-09-09 10:55 pm
    • 2009-09-10 2:41 am
    • 2009-09-10 3:59 pm
  3. 2009-09-09 5:23 pm
  4. 2009-09-09 5:34 pm
    • 2009-09-11 12:05 am
  5. 2009-09-09 5:51 pm
    • 2009-09-09 5:56 pm
      • 2009-09-09 6:09 pm
      • 2009-09-09 8:10 pm
      • 2009-09-09 11:30 pm
    • 2009-09-09 6:04 pm
      • 2009-09-09 8:16 pm
    • 2009-09-09 6:06 pm
      • 2009-09-09 6:13 pm
        • 2009-09-09 6:16 pm
    • 2009-09-09 6:27 pm
  6. 2009-09-09 5:53 pm
  7. 2009-09-09 5:56 pm
  8. 2009-09-09 6:00 pm
    • 2009-09-09 6:24 pm
  9. 2009-09-09 6:00 pm
  10. 2009-09-09 6:04 pm
    • 2009-09-09 6:51 pm
      • 2009-09-09 9:47 pm
  11. 2009-09-09 7:23 pm
  12. 2009-09-09 7:33 pm
  13. 2009-09-09 7:36 pm
    • 2009-09-10 8:54 pm
  14. 2009-09-09 7:43 pm
    • 2009-09-09 8:15 pm
  15. 2009-09-09 7:57 pm
  16. 2009-09-09 8:07 pm
    • 2009-09-09 8:37 pm
    • 2009-09-10 12:28 am
    • 2009-09-10 2:59 am
  17. 2009-09-09 8:21 pm
  18. 2009-09-09 9:32 pm
  19. 2009-09-09 10:13 pm
    • 2009-09-10 1:04 am
  20. 2009-09-09 10:28 pm
  21. 2009-09-09 11:33 pm
  22. 2009-09-10 12:35 am
    • 2009-09-10 12:51 am
      • 2009-09-10 3:34 am
        • 2009-09-10 8:13 am
  23. 2009-09-10 12:43 am
    • 2009-09-10 12:37 pm
      • 2009-09-11 1:52 am
  24. 2009-09-10 12:51 am
    • 2009-09-10 2:55 am
    • 2009-09-10 3:17 am
      • 2009-09-10 7:33 pm
        • 2009-09-10 8:10 pm
  25. 2009-09-10 5:31 am
  26. 2009-09-10 8:32 am
    • 2009-09-10 4:02 pm
  27. 2009-09-10 9:48 pm
    • 2009-09-11 9:20 pm
      • 2009-09-12 11:01 am
        • 2009-09-12 3:26 pm
          • 2009-09-12 3:51 pm
          • 2009-09-12 8:03 pm
    • 2009-09-12 12:14 pm
      • 2009-09-12 12:51 pm
        • 2009-09-12 2:16 pm
          • 2009-09-12 3:40 pm
          • 2009-09-12 6:36 pm
          • 2009-09-12 9:45 pm
          • 2009-09-13 12:46 am
  28. 2009-09-12 11:00 am
    • 2009-09-12 11:28 am
      • 2009-09-12 8:26 pm
        • 2009-09-12 10:29 pm
          • 2009-09-13 1:12 am
          • 2009-09-13 7:37 pm
  29. 2009-09-14 3:31 pm