Skip to content

Programming under the Scientific Method?

October 10, 2008

Just as a good blog should be, here are some loose thoughts on programming that I’ve had lately.  I have spent some time thinking about my process for writing code.  In fact, I’ve been thinking about what I have been able to glean so far about the process that the mass of programmers in the world go through to write software.  The impression that I have is that writing software is not scientific enough.

The germ of this idea is that I’ve never felt that I could quantitatively prove that the way I write code actually produces a working, correct result.  This was before I really understood the idea of unit testing.  I started going to conferences and working on a Masters Degree in Computer Science and began to learn about the idea of unit testing.  Only at first, I thought that unit testing was the answer to qualitatively proving that my code was working and correct.  Unit testing certainly appears to be the answer because of its emphasis on incrementally proving that the code is correct as per the rigor of each test.  Yet, after about a year of actually working with unit testing I’m starting to question the true strength that unit testing provides.

There is no doubt that unit testing provides rigor around the software development process — theoretically.  At any software development conference there is no shortage of unit testing pundits who espouse the benefits of the practice and explain the process for incorporating testing into your development process.  And attending these conferences is largely a group of people whom have no doubt that unit testing is an honorable practice.  Practically though, the test is usually only as strong as the will of the programmer to write a good test.  The example being that I can write very poor unit tests for every unit either because I misunderstand the process or because I don’t care enough to write good tests.  Neither is helpful in providing evidence of working and correct code.  Further, even though the discipline of good unit testing can provide some proof that code is working and correct, there is almost no proof (I have only heard anectdotes) that starting the practice of unit testing actually changes the quality of software.

The failed panacea of unit testing for providing quantitative proof of working and correct code lead me to think about why it didn’t really solve the problem.  Eventually the Scientific Method came to mind.  When that happened I wondered why we don’t talk about the software development process in the context of such a solid framework?  The Scientific Method works for all other sciences, why shouldn’t it apply to Computer Science?

So, finally, here is the main thought in this post.  I believe that at least understanding the Scientific Method may improve the process of software development .  In this post I won’t explain the Scientific Method or talk about how it applies to software engineering in a practical sense, instead, I’ll only mention that thought and leave it for you to ponder.

I think that the reality is that writing working and correct software is a grand challenge and requires rigor if it’s ever to become a standard.  Great ideas such as unit testing (and its accompanying process Test Driven Development) undeniably add to the rigor or software development but fail to make a complete process for developing working and correct software.  I’m curious to know if thinking about software development in terms of the Scientific Method would help bridge the gap between writing code and unit testing to make a cohesive process that can be analyzed and proven quantitatively.

There are a lot of scattered thoughts here that are either leaving gaping holes or need expansive exploration to fully explain.  I understand that and I hope that myself or others can fill in those gaps.  I’m immensely interested in exploring this idea and discovering where it leads.

Advertisements

From → Uncategorized

One Comment
  1. peterwilliams97 permalink

    Of all the biases I picked up as a scientist, the one that has most helped me develop high quality software is the idea of continuously and vigorously trying to disprove the null hypothesis. For software development the null hypothesis is that your software works correctly. http://peterwilliams97.blogspot.com/2008/07/best-proof-of-anything.html has some eloquent quotes on this.

    Sometimes making software work correctly gets complicated. In those cases I also fall back on my scientific training. An example of this is http://peterwilliams97.blogspot.com/2008/10/test-automation-for-complex-systems.html

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: