It has been a while since I have had the time to sit down and write something here so I figured now is as good a time as any. I actually have class in a bit, but I figured I would be able to get something down of mild interest before I leave.
As one of my final computer science classes before I graduate I am taking a class based largely in theory. Mainly we will be studying NP-Complete problems, but we will study some other topics as well, which I may blog about when the time arrives. Until a few days ago we did not actually have any homework assignments which involved programming 😦 .
The assignment we did get, though, was pretty interesting. The basic idea behind it is that you must take the string 123456789 and insert +’s, -‘s, or nothing in between digits. Also, for our class, you could also place a – or + sign in front as well (though the + doesn’t really do anything) . You must generate all possible combinations of this string and find the smallest possible positive integer that you can create in this way. This required us to implement an algorithm (which we learned in class) that can be used to generate all possible combinations of some arbitrary set (i.e. the power set). We were allowed to write this program in any language of our choosing. I joked around saying I would try and write it in MIPS assembly or LISP. I did seriously consider LISP, but I lacked the ambition to relearn it. In the end I decided to write this in C++.
My design of the problem wasn’t anything noteworthy, and that is not really the point of my writing this post. I simply really enjoyed writing C++ code again. It took me a little bit to get back in to the spirit of things, but once I remembered the little syntax quirks and general coding style I was loving every minute of it. This program did not take all that much time to program, nor was it particularly challenging. Perhaps I just have a sentimental feelings for C++ as it was always a language I had aspired to learn since I started programming in the 8th grade. I was extremely pleased that my college offered it as a course. Sadly, the intro level classes are now taught in Python, which I have mixed feelings about. I’m not sure if a language will come along that I will ever like more than C++, but who knows what is on the horizon.
C++ just seems to be the best combination of two worlds of programming that I enjoy. The low level access to memory, variables, other reasources of C, and with support for OO style programming. I know some would argue those should never be combined. For me I just like knowing that if I need to access the low level stuff it is readily available, and that I do not have to jump through hoops to use it. With an OO language I know that you are typically trying to write high level code, and I would say that is true for me most of the time. However, access to pointers can really come in handy in certain circumstances. Yes, I know there are workarounds for other languages, but it is convient to have them right at your finger tips.
Perhaps I am just holding on to my past, but I sure do enjoy coding in C++ 🙂 .