101 Days of Code

Inspired by the "101 Days of" threads on RPG.net and the desire for broader experience with programming languages I am going to exclusively use a language unfamiliar to me for 101 days and record the results here.

Friday, June 23, 2006

101 Days of C/C++ -- Day 3

Time flies when you are pulling your hair out by the roots.

I spent the day (yesterday at this point) porting some of my old projects over. Most of that time was spent reorganizing everything in an attempt to find the perfect structure. There isn't one from what I have found. Not even implicitly. Every programmer (and book for that matter) seems to have their own way of organizing things. Add macros (or templates for that matter) into the mix and it is like every programmer is using his own personalized little langage that only superficially bears a resemblance to it's siblings.

A pile of dirt is certainly an extremely flexible medium for building a house. A pile of bricks as very nearly as flexible. And the brick pile is easier to work with.

If there is anyone reading this, add a comment pointing me towards some resource that may show a good, general, consistent method of structuring and organizing my code.

On another note, I again realized that OOP purity makes my skin crawl. I won't give the actual example to protect the guilty but it was very similar to this:

integer.new(a);
integer.new(b);
a.equals(b.multiply(3).add(5))

instead of a = b * 3 + 5.

This trivial example doesn't quite capture the flavor of the offending code. In defense of C this just goes to show the power and flexibility of the language. The author of the above should probably have been writing in Java (or had learned to code by doing so).

I think it's time for a nap now though. All-nighters are probably not the best idea when learning.