Unit testing...*yawn*


It seems that too often I write code to get it to do what I want and then move on to the next bit of programming. This works great until it doesn't. So how do we take care of those times where it doesn't? We use unit testing. It is necessary tool and should be used by everyone, but it is time consuming and kind of boring.
If you haven't used unit testing before it is a series of tests you create to make your program fail. If you pass all these failing tests you don't win anything other than the joys of having to think of more ways to break your program and write even more tests. I feel that for every line of code you write, plan for about 3 million tests (this number is a dramatization). It might not really be that bad however it is tedious.
To alleviate some of this pain though there is a thing for us crazy C++ programmers called Cxxtest. It is a good way to actually test your C++ coding. You write you're testing in a header file using some basic calls such as TS_ASSERT, verifying things are doing what they are meant to do. You compile it and it does all the grunt work is done behind the scenes, it's a really nice implementation.
Unit testing might help as long as it's used properly. You do have to make sure to take small steps in writing your tests or you can miss an earlier problem. For example, during the development of getting a scanner program to work with a given parser, my partner and I kept running into a problem which introduced logic identifiers such as equal to and not equal to. After many aggravating hours of banging our heads on desks and daydreaming of going all Office Space on the system we discovered that it was actually a problem with variable names. We hadn't accounted for variable names with integers. So our test was failing because we had taken two steps in one test. It was a lesson well learned.
My problem actually was found using unit testing. Granted I wasn't looking for that problem with that specific test but it did get found. This experience alone helped me understand why testing is important and why it is also a pain.

Subversion - it 's ruthless and mean and I kind of like it!


I'm not really sure what I think of using source control as a tool for programming. Having worked a bit with source control software I've become undecided if I really like it or not. Source control is nice to actually have the ability to go back to an earlier version after you've managed to completely gum up the working version. It can also be a pain when two people are working on the same files and haven't committed their versions for a while. Perhaps it's just subversion that can cause headaches. I have not used any other source control software so I am unfamiliar with the workings of them and am really unable to draw a complete conclusion on all source control software.
One of my earliest experiences with subversion was when I had not properly submitted a lab assignment that was due. I thought I had turned it in, but turns out I hadn't. Having moved on to a later lab I somehow completely erased what I had done from the previous lab ensuring that I would have to redo that lab. It was some combination of subversion updates and reverts that had lost what I had done with no way to recover it (on a side note the second time I did the lab, it decided it didn't want to compile properly and I still managed to get a zero, go me).
I find that I'm not using subversion exactly how it should be used. Uploading to subversion should have some kind of non-broken source code committed although it seems my partner and I kind of use it in a way of "we'll get back to that" instead of actually just keeping a local copy and then committing it when it's not broken. This is probably going to lead to complications later in programming, especially if we keep adding more files. We might get to a point where we never know what files are working properly and which ones aren't.
I feel I am being a bit negative on subversion which I find odd because I actually do like using it. I think it will be a strong tool when I am fully comfortable with using it in which it was intended. I like that I can branch out into different directions when writing a program and then be able to go back to an earlier version if it turns out I'm some kind of idiot. I also like that I am able to keep a log of what I have done to the program step by step for each version. Granted comments in a program do that, but they don't provide a timeline like subversion does. Another good feature that I just haven't gotten familiar with yet is merging. It's nice to have multiple people work on different parts of the same files and be able to merge them together. The only thing I'm finding difficult is when we both happen to change the same lines and have conflicts but I think that is just something I have to do on a regular basis to just get comfortable with it.

I have never blogged before...

| No Comments

And so this is my first blog, ever. What does this mean, well blogging is one thing that I will be gaining experience from over the course of this semester. And hopefully a few other things as well, I have never worked with debuggers, which are definitely something I would like to learn. I could also use the practice to comment more. I'm pretty awful on commenting as much as I should.

There are things that I think I will do better in, I have taken a C++ course before at Northern Michigan University. Granted we're talking about 3 years ago, so I don't remember a whole lot, although I think it'll be enough to really help in 3081. At least enough to remember the basics of the language. I don't remember much on what we did, but I do remember somethings covered such as garbage collectors and of course, pointers.

Who could ever forget the pain of pointers. No really, I wish I could forget that pain of pointers, or perhaps just remember pointers. I may want to recant the idea that I know a bit about C++, remembering pointers made me think I don't know the language at all.

I think my learning in this class will be a lot more getting back into a programming mode. It's been at least a year and a half since I had done any real programming, And this semester is where I get back into it.

I am looking forward to a lot that's going to be thrown at me over the semester. Hopefully a lot of things that will stick with me once out of school and even if it doesn't, at least there will be some sense of accomplishment in programming yet again.

Recent Comments

  • rajav003: Maybe my unique approach to "pain" in software development will read more
  • bedea002: I think most of us are just anxious to get read more
  • lorxx033: Cxxtest does help make testing a little easier because unlike read more
  • ranki040: I agree that unit testing can be a tedious procedure, read more
  • barri084: My partner and I had a similar situation where we read more
  • ayal0034: I guess testing your code is like "Why should I read more
  • dowd0070: I agree that as glamorous and exciting being a programmer read more
  • mart2439: I agree with your opinion on testing. It is tedious, read more
  • torge135: In respect to your problem with the "we'll get back read more
  • mart2514: I agree that svn can be hard to use at read more

Find recent content on the main index or look in the archives to find all content.