Unit test checkboxesIn my third of three related postings on some core programming principles, I’ll be talking about unit testing.  In the first part, we discussed code reuse, and in the second, I went over version control.

Unit testing is a methodology by which you run tests on individual bits of your programming code.  I have to admit that this is the topic of the three with which I am the least familiar.  The concept of “testing” in my past jobs has largely been comprised of this:

  • Write your program
  • Test it out as thoroughly as you can when done
  • Turn it over to a user for them to test thoroughly.

This is actually a very broad generalization, and I would, in fact, test out bits of code that I wrote as I wrote them, making sure that functions returned the desired results before I was anywhere near to having a final product.  While this is a step in the right direction towards unit testing, it is no means formal unit testing. (more…)

Tagged with:
 

Version ControlIn my last posting, I talked about the benefits of code reuse and how any good programmer should swear by that coding principle.  Today, I move on to another key programming methodology, that of version control.

Version control (revision control, source control, or any of a number of other similar names) is a method for archiving and documenting changes to programming code, web pages, XML files, and, frankly, any other type of file of which you might want to store multiple versions in one centralized location.  A benefit of this is that multiple programmers can work on the same code base without interfering with each other, and that you can easily track or back out changes to a file and go back to an earlier version, should a new change cause problems. (more…)

Tagged with:
 

A matter of principles

zeroes and onesIn the more than a decade that I’ve been programming, I’ve found that there are three programming principles that I really wish were included in the computer science program that I enrolled in during the late 1990s:

  • Code reuse (the DRY principle)
  • Implementing version control
  • Unit testing your code

There’s really no excuse for these topics not being covered, but it perhaps reflects upon how the academic world differs from the professional business world.  Academia considers you successful if you’ve studied all sorts of general aspects of computer science, while success in the business world requires following general coding principles, and not necessarily a grasping a thorough understanding of say, machine code or Artificial Intelligence (of course, my argument falls apart if you are designing computer processors, robotics, or video games!).

Covering all three topics in one article would be a bit much, so I’m going to split this up over the course of a few days. (more…)

Tagged with: