The Conifer Systems Blog

The Voodoo Magic School of Software Engineering

14 comments

Computers are deterministic.

Well, OK, not always. A single-threaded, sequential program that doesn’t interface with the outside world is deterministic, but once user input, hardware devices, and networking get involved, these create asynchronous events that can be nondeterministic in character. The same is true if two programs, each independently deterministic, write to the same files in the file system at the same time. Preemptive multithreading adds more nondeterminism, and computers with multiple CPU cores add still more.

At the same time, we have also built a whole family of software abstractions that take these initially nondeterministic constructs and push them back into the realm of determinism. Yes, user input is asynchronous, but if the window system puts it in a queue instead of giving us a callback, and we only have a single thread pulling messages out of that queue, we’re back to deterministic behavior. The arrival of network packets is nondetermistic, but if we use blocking TCP sockets, the operating system takes care of most of the dirty work for us and all we have to do is send and receive bytes. A 3D graphics processor works in parallel with the CPU, but when you call glReadPixels, the OpenGL driver first waits for the previous rendering to finish so it doesn’t give you random incompletely rendered garbage.

Multithreading remains a hard case, but you aren’t forced to use it, and with careful use of mutexes, semaphores, etc., multithreaded programs can be perfectly deterministic.  We can also hope that future programming environments will be able to automatically extract more parallelism from our software, so that we won’t have to write multithreaded code to get speedups on multi-core CPUs.

Even if your program has nondeterministic behavior, though, one simple fact remains: everything that happens on a computer happens for a reason.  There is a logical explanation for why it happened.  (That explanation may be “hardware failure” or “cosmic ray”, but these are rare, and even so, they are still explanations.)  It may be hard to determine that reason, but with enough digging, it is usually possible.

So, it may be tempting to take a sledgehammer to your computer when it misbehaves, but when we have our “professional software engineer” hats on, we ought to be able to do better.

Let’s take GNU make as an example.  If you’re read our whitepaper, or even if you’re just an occasional user of GNU make, you probably know that occasionally a build fails “for some weird inexplicable reason.”  You type “make”, and instead of a correct binary popping out, you get a strange error message.  Or, worse, it looks like it succeeded, but you get a binary that doesn’t run.  So you type “make clean” and “make”, and then hope it will work this next time around.

So say that second try fails… what now?  Well, you can send an email to other people and see if they’re hitting the same problem.  You can look at the status of your automated build system and see whether it’s hitting the same failure.  But suppose the problem really does seem to be unique to your computer.  It’s possible your source control tree might be corrupted in some strange way.  (This has happened to me a good number of times.)  You might type “p4 sync -f”, but even that only fixes files that exist in the depot — it doesn’t delete files that exist but shouldn’t.  So maybe you “rm -rf” your entire tree and get a brand new one from scratch.  Perhaps that will fix it!  If it doesn’t, well, then you’re really in trouble…

At this point it’s tempting to throw up your hands in despair and admit defeat.  But if we really want to keep going… well, does it happen if I do the build on another computer?  I could reinstall my OS — maybe that will fix it?

This is, in a nutshell, what I call the “voodoo magic school of software engineering.”  We run into a problem — a build fails.  Rather than understanding the problem, determining its root cause, and addressing the root cause so it won’t happen again, we flail about, trying random stuff in the hope that something will magically fix it.  When we get to the point of “let’s reinstall the OS — maybe that will help!”, we might as well just be sticking pins in a voodoo doll.

We may well “fix” the problem this way, but we won’t ever determine the root cause.  If we don’t determine the root cause, how can we know that the problem won’t happen again to someone else or even to ourselves?  How do we know that our “fix” really fixed the problem and didn’t just paper it over, ready to reemerge at any moment?

We don’t need to track down the root cause of everything that goes wrong on a computer.  When I load some random web page and it comes up garbled, I usually just hit “refresh” and often it magically works on the second try.  Or, sometimes I come back to the site later and hope that the site owner has fixed their bug.  Either way, I don’t waste time trying to figure it out or even report the problem, unless the web site is really important to me.

That’s fine and well when we are talking about someone else’s web page.  Someone else’s web page — someone else’s problem.  But when we’re talking about our own software, our own web page, our own build flow — anything that affects our day-to-day workflow, or anything that we ship to customers and must take responsibility for — we owe it to ourselves as professional software engineers to drill down into problems and address their root causes so they don’t happen again.

When your build fails, it didn’t fail for an “inexplicable reason.”  Sometimes your tree really is corrupted and “rm -rf” is the correct answer, but even if so, how did your tree get corrupted in the first place?  For example, did some previous build step delete some files by accident?  Did some runaway script corrupt it?  Sometimes the root cause may just turn out to be user error, but even so, it’s helpful to understand our own mistakes so we don’t repeat them.

But more often, when these things happen, I find that there is a real problem to be fixed.  A common example is a makefile with incomplete dependencies.  If you’re missing a dependency, things may not be rebuilt correctly, and there’s no telling what might go wrong after that.  Tracking down the missing dependency isn’t a waste of time.  It’s an investment in the future.


Written by Matt

September 11th, 2008 at 2:14 pm

14 Responses to 'The Voodoo Magic School of Software Engineering'

Subscribe to comments with RSS or TrackBack to 'The Voodoo Magic School of Software Engineering'.

  1. […] Normally, when debugging, I would recommend starting from first principles and trying to understand the problem’s root cause before doing anything else.  Without a complete understanding of the bug, your chances of implementing a complete and correct fix are poor.  The last thing you want to do is apply a random fix that “seems to work” without understanding why it works; at that point, you’re a member of the Voodoo Magic School of Software Engineering. […]

  2. […] for the root cause of each problem and fix the root cause so the problem cannot happen again.  (I’ve written previously on this topic.)  One simple method Toyota adopted to identify root causes is called the “5 Whys.”  […]

  3. Hi, my name is Lena Lawrence!

    I`m an academic writer and I`m going to change your lifes on?e and for all
    Writing has been my passion for a long time and now I can`t imagine my life without it.
    Most of my poems were sold throughout Canada, USA, Old England and even Australia. Also I`m working with services that help people to save their nerves.
    People ask me “Hey, Lena Lawrence, I need your professional help” and I always accept the request, `cause I know, that only I can save their time!

    Academic Writer – Lena – Speech writing services can help in personal branding Company

    lenalawr

    2 Oct 19 at 7:24 am

  4. I’m an expert writer who loves to bring smiles to people’s face.

    Writing is what I do for a living and I am so passionate about this. I have worked with several associations whose mission is to help people solve writing problems.
    I love traveling and have visited several countries in the past few years.
    I’m happy to have written several books that have contributed positively to the lives of many. My books are available in several parts of the world. And I’m currently working with companies that help people save time. Being a part of this team has open more opportunities for me to excel as a writer. I have worked with different people and met many clients as a writer.
    I can handle any kind of writing and provide nothing but the best. People come to me all the time to ask if I can solve their assignment problems and I accept. I find pleasure in helping them to solve their problems as a professional.

    Professional Academic Writer – Joanna Bird – https://www.screenwritermag.com/ – Screenwritermag Corp

    joannab

    10 Oct 19 at 7:46 am

  5. Hello everyone, it’s Colleen here!
    I work as a professional an essay writer and have created this content with the intent of changing your life for the better. I started honing my writing abilities in high school. I learned that my fellow students needed writing help—and they were willing to pay for it. The money was enough to help pay my tuition for my remaining semesters of college.
    Ever since college, I have continued to work as an academic writer. I was hired by a writing service based in the United Kingdom. Since then, the research papers that I have written have been sold around Europe and the United States.
    In my line of work, I have become accustomed to hearing, “Colleen McMillan, can you help me meet my writing assignment deadline?” I know that I can provide this service.

    Professional Writer – Colleen McMillan – //sncollegevarkalaalumni.com/]Sncollegevarkalaalumni Team

    mcmillan

    10 Oct 19 at 8:43 am

  6. Hi Everybody
    Thanks for checking out my writing website . My name is Katrina.
    I have worked several years in this niche. My interest in writing started at a young age. I wrote short stories as a child and eventually went on to work with my school newspaper.
    This early tryst into news reporting eventually led me to academic writing. There is plenty of work for qualified writers. I specialize in essays, but have the skills to do all types of academic writing.
    Email me for more information about rates and a price quote. I’m looking forward to helping you.

    Academic Writer – Katrina Merrill – Soundgardenkinganimal Company

    katrinamer

    16 Oct 19 at 8:16 am

  7. Hi Everybody
    Thanks for checking out my about page. My name is Jillian Walter.
    I have worked since high school in this niche. My aptitude for writing started at a young age. I wrote short stories as a child and eventually went on to work with my school newspaper.
    This early tryst into news reporting eventually led me to academic writing. There is plenty of work for skilled writers. I specialize in dissertations , but have the skills to do all types of academic writing.
    Reach out for more information about rates and a price quote. I’m looking forward to helping you.

    Academic Writer – Jillian – //www.onlinegraphicartsschools.com/]OnlinegraphicartsschoolsCorps

    jillianwal

    22 Oct 19 at 8:11 am

  8. Thanks for stopping by my page! I’m Jana.
    Even though I jokingly credit my grandmother for my writing talent, I know that it is a ability I have fostered from childhood. Though my grandmother is a writer, I also started out young.
    I’ve always had a way with words, according to my favorite educator. I was always so excited in history when we had to do a research paper .
    Now, I help current students achieve the grades that have always come easily to me. It is my way of giving back to communities because I understand the obstacles they must overcome to graduate.

    Jana – Academic Writer – Csnbiologyclub Corps

    janawood

    30 Oct 19 at 5:36 am

  9. Hi and welcome to my blog . I’m Emmett.
    I have always dreamed of being a novelist but never dreamed I’d make a career of it. In college, though, I aided a fellow student who needed help. She could not stop telling me how well I had done. Word got around and someone asked me for writing help just a week later. This time they would compensate me for my work.
    During the summer, I started doing research paper writing for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing skills to students.

    Writing Specialist – Emmett Frame – //www.sodobusinessassociation.org/]SodobusinessassociationCorp

    emmet

    5 Nov 19 at 4:46 am

  10. Good day and welcome to my webpage. I’m Simona.
    I have always dreamed of being a book writer but never dreamed I’d make a career of it. In college, though, I assisted a fellow student who needed help. She could not stop complimenting me . Word got around and someone asked me for to help them just a week later. This time they would pay me for my work.
    During the summer, I started doing academic writing for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing services to students.

    Writing Specialist – Simona – Desalescollege Band

    simonaor

    8 Nov 19 at 4:49 am

  11. Hi Everybody
    Thanks for checking out my about page. My name is Gordon.
    I have worked since high school in this niche. My interest in writing started at a young age. I wrote poetry as a child and eventually went on to work with my school newspaper.
    This early tryst into news reporting eventually led me to academic writing. There is plenty of work for professional writers. I specialize in essays, but have the skills to do all types of academic writing.
    Email me for more information about rates and a price quote. I’m looking forward to helping you.

    Academic Writer – Gordon Parra – Lefestivalducourt Band

    gordonp

    13 Nov 19 at 12:58 pm

  12. Hi guys, I am Gordon a professional in report writing.

    I love solving people’s problems and make them happy. That is what I have been doing for many years now.
    I have been writing since I was 12 years old and never knew it would turn out to be a full-time career. I have also been able to manage several projects that involves writing. And I worked in three organizations as a volunteer to assist people.My passion has always been to help people succeed. And I go the extra mile to make that happen.
    I enjoy writing academic papers and have helped people from countries like USA.
    I work with a company whose mission is to provide quality writing and make people happy. In fact, many clients come to me for professional help on a daily basis because they know I always deliver. And I will continue to provide nothing but the best to build trust like I have been doing for the past few years.

    Expert writer – Gordon – Tukumusik Corp

    gordonp

    18 Nov 19 at 4:06 am

  13. Hello and welcome to my webpage. I’m Aisha.
    I have always dreamed of being a writer but never dreamed I’d make a career of it. In college, though, I helped a fellow student who needed help. She could not stop telling me how well I had done. Word got around and someone asked me for writing help just a week later. This time they would pay me for my work.
    During the summer, I started doing research papers for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing skills to students.

    Writing Specialist – Aisha Hussain – //www.webestools.com/profile-143905.html]BronwynLeigh Company

    aisha

    22 Nov 19 at 5:55 am

  14. Hi everyone , I’m Wilson.
    Welcome to my about page. I started writing in my early school years after a creative writing assignment for my English teacher. I did creative writing for several months before I thought about doing something else.
    I had always loved doing research papers because I’m passionate about learning. When you combine writing ability with a love of learning, academic writing only makes sense as a job.
    I’m passionate about assisting the students of the future in their school career. When they don’t have time for their paper , I am there to help.

    Wilson Wheeler – Academic Writing Help – //www.quibblo.com/user/BronwynL]BronwynLeigh Corps

    wilson

    25 Nov 19 at 3:19 am

Leave a Reply