Code complete doesn’t mean you’re done

Joe Coder runs through his feature in the UI. It works. The doodad renders beautifully on the screen, and when he clicks the button, all the right things happen on the server. He checks his code in, writes a quick comment in Jira, changes the issue status to “Completed & Checked-in”, and goes to his next task. Lo and behold, his To Do list is empty! Joe’s done coding!

Or is he?

Configuration Management cuts a branch off the trunk code. Joe’s code goes through QA.

Some QA departments try to break developers’ code, others just test the “go path” to insure their test scripts work. In Joe’s case, the QA department has a test script that is a step-by-step use case for how the feature should work. QA signs off on his feature. The doodad worked exactly as specified, which is to say, the select/combo box was correctly filled with test data from the database.

Joe’s code goes to production … and takes down an entire server.

How can this be? It went through QA! Testers verified that his code did what it was supposed to do!

Most software organizations use the term robust wrongly. I generally hear it used in a context that implies the software has more features. Robustness has nothing to do with features or capabilities! Software products are robust because they are healthy, strong, and don’t fall over when the table that populates a select/combo box has a million rows in it.

Joe Coder never tested his feature with a large result set. Michael Nygard — in his excellent book Release It! from the Pragmatic Press — calls this problem an unbounded result set. It’s a common problem and an easy trap to fall into.

Writing code for a small result set enables rapid feedback for a developer. This is important, because the developer’s first task is to write his program correctly. It seems, though, that this first step is oftentimes the only step in the process! Without testing the program against a large result set, the new feature is a performance problem waiting to happen. The most common consequences are memory errors (have you ever tried filling a combo/select box with a million rows from the database?) or unscalable algorithms (see Schlemiel the Painter’s Algorithm).

In our case, testing with big numbers revealed concurrency issues that we did not and could not find when developing with simple, smaller tests. Our multi-threaded, multi-node messaging system would routinely deadlock whenever we slammed it with lots and lots of messages. It didn’t do this when we posted simple messages to the endpoint during development. Similarly, we noticed that we held on to objects for too long during big batch runs. They all got garbage collected when the batch completed, so it wasn’t exactly a memory leak, but there was no need to hold on to the references. After we fixed that, we noticed that our servers would stay within a tight and predictable memory band, as opposed to GC’ing all at once at the end of a batch. Terracotta server expertly pages large heaps to disk, so we were never at risk of running out of memory. Still, it’s nice to see our JVMs running lean and mean.

We’re still stress testing our system today. This past weekend, we pumped over one million real-world messages through our message bus. Our concurrency issues are gone, memory usage is predictable, and we stopped our test only to let our QA department have at our servers. There are zero technical reasons why our test couldn’t have processed another million messages. Terracotta Server held up strong throughout.

But we’re still not done testing yet. We still have to see what happens if we pull the plug (literally) on our message bus. We still have to throw poorly written messages/jobs at our bus to see how they’re handled. We need to validate that we’ve got enough business visibility into our messaging system so that operations folks have enough info at runtime to do their jobs. We need canaries in the coal mine to inform us when things are going wrong, and for that we need better metrics and reporting built into our system that shows performance over time.

We’re code complete, but we’re not done yet.

23 comments on this post.

  1. » Some wheels need reinventing:

    [...] to be “enterprisey” enough, but that’s ok with me. I know we were able to put 1.3 million real-world messages through our bus over a weekend. That’s [...]

  2. » No one should work alone. Ever.:

    [...] itself at login, and our QA department did not login thousands of times a day like our users do. Code complete doesn’t mean you’re done. You’ve got abuse your system to find bugs like [...]

  3. Software, Testing, Software Testing, Software Testing, Article, Article, Thailand, Application Testing, Mobile Appplication Testing, Software Security Testing,:

    Software, Testing, Software Testing, Software Testing, Article, Article, Thailand, Application Testing, Mobile Appplication Testing, Software Security Testing, …

    [...]Code complete doesn’t mean you’re done « Mark Turansky[...]…

  4. Software:

    Fantastic issues altogether, you just won a logo new reader. What would you suggest about your publish that you simply made a few days ago? Any certain?


    Très bon arti?le, péren?ise? de cette façon

  6. Merri:

    O? voit direct que vous maîtrisez bien le sujet

  7. jeune femme impudique:

    Un ?mmense remerciement ?u webmasteer de ce site

  8. jeune fille:

    J? n’ai guère fini de lire mais je rep?sse dans la journée


    Q?el ?onheur de parcourir ce poste

  10. bonnasse X:

    ?n peut dire que ce n’est nullement incohérent


    ?xcellent article pour ne rien chan?er

  12. beurette croqueuse:

    C’est un ?rai bonheur de parcourr c? ?ite internet

  13. Sauteuse gigantesques Mamelles:

    J? sui? entièrement d’accordavec vous

  14. dp:

    Je ?eux te dire qu? ce n’est nullement inexact

  15. Latine chaude du Clitoris:

    Je suis arrivé? sur c? blog ?ar mégarde et ?e ne
    le regrette nulleme?t !!!

  16. chaude Du clitoris Bbw:

    B?n post, pérennise dans cette voie


    Un poste ?empli de bon se?s

  18. toute petite gorge:

    Ce post est vraiment plein de vérité

  19. adjustable Kettlebells powerblock:

    Hi! Do you know if they make any plugins to safeguard against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?


    Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is important and all. However think about if you added some great
    pictures or videos to give your posts more, “pop”!
    Your content is excellent but with images and clips, this website could
    certainly be one of the very best in its field. Terrific

  21. health band:

    Hello, I wish for to subscribe for this blog to take hottest updates, therefore where can i
    do it please assist.

  22. rwc streaming:

    Love to see ypur post 2015 rugby world cup live stream

    Actually i was waiting for ur wonderful post rugby world cup live streaming 2015 pls keep

    posting more post like this i will be very

    Rugby world cup 2015 live broadcast

  23. zncmdqdlls:

    Code complete doesn’t mean you’re done « Mark Turansky

Leave a comment

You must be logged in to post a comment.