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.

Wednesday, June 21, 2006

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

I have reams and reams of source to pour through. There is just something I have always liked about reading source. Maybe it is the anticipation or the hope that something unique or exceptionally brilliant will show it's head so I may add that nugget to my tool kit. Perhaps just some sick part of me that likes to cringe over the nasty bits. Who knows.

I am slightly boggled by the default idea in C that a source file in my project should not necessarily be a part of my project. After all, I went through the trouble of writing the code and adding it to the project. Somehow I don't want the code to compile as part of the project -- even though the source file is a part of the project?

More later. Now is the time for coffee.

Servers

So, my brother's company is apparently upgrading their servers. He just came home with three rack mount servers! I guess I should find a project that will use this new resource.

I've just finished downloading every scrap of source that uses SDL with C/C++ so I can start poring through it. Glancing through some of it I'm amazed at how messy and ugly code in this language can be. It's really no wonder why all these new code maintenance philosophies have sprung up recently.

Tuesday, June 20, 2006

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

I spent today reading up on GUI frameworks. I can't find one that I like. Perhaps I'll have to build my own. I did find SDL though. Very nice indeed. Built all of the examples and read through it's docs to get a feel for it. I think I'll spend some time later tonight going through the user submitted source in the Download section to see if I like it as much as I think I will -- It has already shown itself to be friendlier than the WinAPI, GDI, OpenGL, and DirectX for software rendering.

Shame there doesn't seem to be a GUI framework that quite fits what I'm looking for. I am goind to check out both Zero Memory Widget and Claro Graphics though. I stumbled across them in my search for the perfect framework and liked the code samples they showed more than the other dozen or so frameworks I looked at.

Monday, June 19, 2006

Choices . . .

I've had VS6 sitting on my hard drive for years now (and even reinstalled it through a crash or two). Aside from using it to generate a bit of a creepy feeling now and then I've never really used it.

Ruby, on the other hand, I have absolutely no experience with at all. I would very much like to become fluent in it but it's just not the right tool for the jobs I do most often (real-time image processing and interpreted languages usually don't mix).

To choose masochism or not? I think I'll leave Ruby until I know a bit more about building compilers (or until there's a Ruby to native code compiler out there). C/C++ it is.

The last time I sat down to learn C was on my Dad's brand new IBM PC/XT. I'd spent the last year with my C64 learning BASIC. My Dad (an EE who does embedded systems stuff) loaned me his copy of K&R C which I read cover to cover twice before getting any keyboard time. I don't think I spent more than three weeks with C before going back to BASIC. I still think C is an ugly language - C++ templates just make it moreso. I recently heard someone say that C is a 'write-only' language. That quote pretty much sums up my feelings about it.

With that in mind, I'm either going to learn to love C or spend three very frustrated months . . .