Why we write code and don't just draw diagrams 22

Posted by Dean Wampler Thu, 06 Sep 2007 15:45:59 GMT

Advocates of graphical notations have long hoped we would reach the point were we only draw diagrams and don’t write textual code. There have even been a few visual programming environments that have come and gone over the years.

If a picture is worth a thousand words, then why hasn’t this happened?

What that phrase really means is that we get the “gist” or the “gestalt” of a situation when we look at a picture, but nothing expresses the intricate details like text, the 1000 words. Since computers are literal-minded and don’t “do gist”, they require those details spelled out explicitly.

Well, couldn’t we still do that with a sufficiently expressive graphical notation? Certainly, but then we run into the pragmatic issue that typing textual details will always be faster than drawing them.

I came to this realization a few years ago when I worked for a Well Known Company developing UML-based tools for Java developers. The tool’s UI could have been more efficient, but there was no way to beat the speed of typing text.

It’s also true that some languages are rather verbose. This is one of the ways in which Domain-Specific Languages (DSL’s) are going to be increasingly important. A well-designed DSL will let you express those high-level concepts succinctly.

I’m not claiming that there is no place for graphical representations. UML is great for those quick design sessions, when you’re strategizing at a high level. Also, the easiest way to find component dependency cycles is to see them graphically.

I’m also not discounting those scenarios where a diagram-driven approach actually works. I’ve heard of some success developing control systems that are predominantly well-defined, complex state machines.

Still, for the general case, code written in succinct languages with well-designed API’s and DSL’s will trump a diagram-driven approach.

Trackbacks

Use the following link to trackback from your own site:
http://blog.objectmentor.com/articles/trackback/8804

Comments

Leave a response

  1. Avatar
    Arnon Rotem-Gal-Oz about 2 hours later:

    I think you are 100% correct. I wrote a post expressing similar ideas about a week ago

  2. Avatar
    Dean Wampler about 3 hours later:

    @Arnon, Thanks for the link to your post. Good examples there. I also thought that Neal’s talk on DSL’s was right on the money.

  3. Avatar
    www.EdmundKirwan.com about 19 hours later:

    Dammit!

    When I saw that title (especially by you, Dean; you’re usually no-nonsense objectivist), I was hoping for:

    i) An answer (I think your answer is, “Computers are literal-minded;” but computers aren’t literal-minded, they work on bits, and bits are as far removed from text as they are from diagrams (or as close; when you’re down to two digits, both can be considered text or diagrams (though very small diagrams))).

    ii) A fair comparison between text and diagrams.

    iii) A deep analysis of the differences between text and diagrams (along the lines of, “Text generally consists of a finite set of characters (and again, a character is a much a piece of text as it is a diagram) from a well-defined alphabet combined using the rules of a well-defined syntax …” and perhaps reaching, ”... But UML (for example) is a not a well-defined syntax because of (insert insightful wizzardry here) ...”

    iv) A historical perspective on the success of text and the failure of diagrams (it would have been lovely make some connection between the cost of early computing machines and input devices and thus a commercial imperative for text rather than diagrams; it would have been really, really lovely to highlight that man, as a species, developed diagrams long before text, to trace the historical rise of text to prominence and to illuminate the various contributing factors).

    v) A word on Xerox PARC (not only because everyone should reference Xerox PARC, but I seem to remember that one of the first Smalltalk applications was some sort of drawing programming language that allowed kids to write programs in pictures. Or maybe my memory’s misfiring and I’m completely wrong (though this doesn’t detract from the advice of always referencing Xerox PARC for something or other)).

    vi) (Stretching a bit here) A comparison of the parts of the brain dedicated to text and diagrams (ok, “Pictures”), a description of the relative powers of both parts, a declaration of a winner and a natural imperative towards either information-form.

    vii) (Oh!) A discussion on information entropy, a comparison of the entropies of text versus diagrams and a declaration of a theoretical imperative towards either information-form.

    viii) A discussion on the longevity of information itself outside a human context (why not?).

    ix) A solid conclusion.

    x) A wry introspection (a pithy introspection would also have sufficed).

    xi) A witty anecdote.

    Alas.

  4. Avatar
    Dean Wampler 1 day later:

    I was going to do that and more, but I hate to show off %^P

    Actually, this is a great list of the topics that need to be considered for an exhaustive analysis. I’m sure that others have tackled many of them. Each point would be interesting to study. Oh, for more free time! ;)

    I’d love to write the definitive analysis on the subject that analyzes all of them (and more), but I’m not the expert, so a lot of research would be required. In fact, I hope that people will continue working on this vision and maybe some day the tide will turn…

    So, I cut to the chase. My arguments were very pragmatic in nature. They reflect my own experience and my impression of the landscape today, as well.

    I’ll try to do better next time!! ;)

  5. Avatar
    www.ModernAnalyst.com 3 days later:

    Very interesting comment Edmund. While I really like your 11 outlined points (what you had hoped to see in the blog post) I think that you have created a better outline for a book of substantial size. Of course, we could always break each point out into a separate (and lenghtly) blog entry of its own.

    It would be great to start a conversation around many of the points you’ve mentioned.

  6. Avatar
    Drew Sudell 2 months later:

    We write code and don’t just draw diagrams for exactly the same reason that poets and novelists don’t just draw pictures. Simply, written language is one of the great human inventions. Writing is more exact, and often more expressive than pictures. The real question is why the computer industry continues to have so may “advocates of graphical notations” who feel that banging rocks / clicking mice on pictoglyphs / icons is somehow superior to that “old fashioned language thing.”

    While there are a lot of cases where I will use a diagram to convey an overall concept, I’ve yet to see anything that comes remotely close to what can be expressed in code.

  7. Avatar
    www.viprototype.com 2 months later:

    picture is not very suitable for the mental activity involved in daily development. But I think in some kind of development, it would be superb. For example, when we write automation test for a GUI, it is more natural to write test by marking on the GUI screen shot instead of writing redundant code about how the GUI will be driven.

  8. Avatar
    Rafael Chaves 8 months later:

    Dean, I have been working on an Eclipse-based tool for UML modeling based on a textual notation:

    http://abstratt.com/textuml/

    I would be more than happy to get your feedback on the approach/product.

    Please feel free to delete this post if you take it as blatant self-promotion.

    Cheers,

    Rafael

  9. Avatar
    Beats Headphones over 3 years later:

    bravo à vous deux !!! pas mal votre idéé de faire sponsorisé votre mariage !!jje vous souhaite tout le bonheur du monde !!! vous etiez magnifique !!! que de beaux souvenirs pour vous !!! soyez heureux bisous odile de marseille

  10. Avatar
    iPad to Mac over 3 years later:

    We write code because we need make progress. We code everyday.

  11. Avatar
    Criminal Records over 3 years later:

    A well-designed DSL will let you express those high-level concepts succinctly.

  12. Avatar
    ice cream machine supplier over 3 years later:

    Heibeisi is a professional manufacturer of high-quality ice cream machine supplier. Our company largely relies on space technology for production of ice cream machines. Products under customers’ different requirements will be developed, designed and manufactured.

  13. Avatar
    Pittsburgh events over 3 years later:

    bravo à vous deux !!! pas mal votre idéé de faire sponsorisé votre mariage !!jje vous souhaite tout le bonheur du monde !!! vous etiez magnifique !!! que de beaux souvenirs pour vous !!! soyez heureux bisous odile de marseille

  14. Avatar
    MAZAR over 4 years later:

    let’s not forget that the UML defines 13 diagram types and TextUML only addresses the class diagram (static structure). What about designing and/or documenting complex interactions with sequence diagrams? A control flow with activity diagrams? A state machine with a state machine diagram? A system architecture with a deployment diagram? While the static structure of a software system is relatively easy to grasp (anyway, the first thing I do when looking at new code is run Doxygen on it and look at the nice diagrams generated from the code) the dynamic aspects are deeply hidden in code and they can be very hard to discover. A current diagram with the right abstraction level can give you more insight than weeks of reading code. In addition, the static structure of the code is usually the “easy part”. The hard part are the dynamics and interactions. So – a bit evil minded – I could say that TextUML only addresses the parts of a software system that cause only a fraction of the overall effort of creating a complex software system.

  15. Avatar
    okey oyunu oyna over 4 years later:

    nice i can not say anything. Thanks

    internette görüntülü olarak okey oyunu oyna, gerçek kisilerle tanis, turnuva heyecanini yasa.

  16. Avatar
    Tiffany Sale over 4 years later:

    We’ve go through your own exceptional blog which posting on-line, have numerous good friends combined with me to examining your own article content. Whatever we are, as well as whatever we would like, the principle concept you’ve recently been displayed was satisfied by us. Thanks much for sharing so perfect point of view, and it create us get a feeling of relaxed and ease.

  17. Avatar
    gold tiffany bracelets on sale over 4 years later:

    gold tiffany bracelets on sale

  18. Avatar
    beats by dre store over 4 years later:

    Thanks much for sharing so perfect point of view, and it create us get a feeling of relaxed and ease.high quality headphones new design headphones

  19. Avatar
    beats by dre store over 4 years later:

    Thanks much for sharing so perfect point of view, and it create us get a feeling of relaxed and ease.high quality headphones new design headphones

  20. Avatar
    pandora necklaces silver over 4 years later:

    Whether pandora wholesale you have been unable to find a stylish and beautiful shape of the necklace? Then small series with a look at the beauty of these big fake collar necklace has a lovely pandora charm retro small lapel T units for two consecutive quarters as the most popular fashion point. This winter, a small lapel is not limited to fashion, it is more to necklaces pandora necklace discount Pandora Jewelry of the field, the most tide “false collar necklace this year, major fashion brand designers start of the article on the collar, 2011 Milan Fashion Week on, a dazzling white pointed collar Pandora Bracelets collective debut. Chanel’s little black dress with small round white mix is has become a classic, shot in the street this year is everywhere now This stock has fallen a false collar style accessories Pandora Earrings. than the fabric is too low silver pandora chains round neck, collar necklace of fake luxury metal may dazzling land and more. false collar means is a fabric made into a good texture a collar and this collar no pandora necklaces silver bracelets sleeves, no breast, no back, just only a collar, so call it false lead. the most beautiful moment of a woman’s life is put on the holy wedding, into the wedding hall, the love will be forever a Beads Pandora when worn on the finger.

  21. Avatar
    christian louboutin over 4 years later:

    The professional design make you foot more comfortable. Even more tantalizing,this pattern make your legs look as long as you can,it will make you looked more attractive.Moveover,it has reasonable price.If you are a popular woman,do not miss it.

    Technical details of Christian Louboutin Velours Scrunch Suede Boots Coffee:

    Color: Coffee
    Material: Suede
    4(100mm) heel
    Signature red sole x

    Fashion, delicate, luxurious Christian louboutins shoes on sale, one of its series is Christian Louboutin Tall Boots, is urbanism collocation. This Christian louboutins shoes design makes people new and refreshing. Red soles shoes is personality, your charm will be wonderful performance.

  22. Avatar
    beats by dr dre over 4 years later:

    A university studentbeats by dr dre caught by the enemy, the enemy tied him at the poles,just beats solo headphones purple and then asked him: say, where are you? You do not say it electrocuted! Scheap dr.dre beats studio headphones balck/yellowtudents back to the enemy a word, the result was electrocuted, he said: I am TVU.Hot sale beats by dr dre pro headphones

Comments