Write Software not Novel

Posted in :

Reading Time: 2 minutes

When I was taking my first C++ class at graduate school, the professor has a favorite word “you guys should write a program that works, because if it does not work, you are writing a novel not a program”. Although I did wrote “novels” in one of his program assignments, I remembered his words since then, certainly this include my professional life. Writing software that works is not easy, but it’s a goal every developer should strive for.

Assume we are just writing a very simple C++ program (remember the “hello world”), bacially there are two kinds of obstacles or errors we will face. The first is the compile error. Today I fought all day for this kind of error. Most of times compile errors are easy to solve, because the compiler will give you some hints: such as forgetting the semicolumn; variable name does not match (typos); other simple things etc. But sometimes things can get really tricky. I remember one day my coworker came over for help. I went to his cube and we tried to figure out why things do not compile. I looked at the error message from compiler, which is pretty much useless.  So we had to guess and tried different approaches without success. About one hour later, I suddenly found out there is an extra “^H” at the beginning of a header file. Binggo. That solved the problem.

This afternoon I had similar problem, I had to compile some code written by my coworker, which has not been compiled before. This is kind of thing we programmers don’t like to do: deal with other people’s devil. I was puzzled by the compile error for about 3 hours: it was  complaining the std::vector not defined properly. Finally I found out my coworker put some header file inside the class (and another namespace), which is a bit unusal and it caused the conflict of vector. I will talk about the other type of error later on. Hint: compile error is relatively straightforward compared to the other error 🙁

%d bloggers like this: