« I Am Happy | Main | Look At My Ugly Code »

July 30, 2009

Comments

I recently dug into the FCollada code to import some collada files into the engine i was testing. I was quite surprised by how nice it was. As you said in comparison to how much bad code i've seen. Given the lack of any agreement on a standard set of 3d classes in my experience. This might be a decent choice.
http://www.feelingsoftware.com/content/view/62/76

I can't think of any particular open source project that qualifies, but I can tell you criteria that are necessary (but not sufficient).

It needs to be well formatted, and consistently so, so that I can follow the program flow without having to read every symbol.

It needs to be commented correctly. By that, I mean header comments for each function that document the API, and any side effects, and basically no comments inside functions, that prevent you from being able to follow the program flow. If some piece of code is tricky enough that it needs commenting, there better be a pretty darn good reason to not just rewrite the code to be clearer. Also, comments should actually match the code.

Functions should be short enough that you're no more than a couple of page-ups to where any local variable it uses is declared.

Basically what I'm saying is that beautiful code is code that goes out of its way to facilitate me following it when I'm not familiar with the contents, either because I didn't write it, or because I wrote it so long ago I don't remember it.

I know it's not gamedev related, but the ASP.NET MVC source code can be seen online here:
http://aspnet.codeplex.com/SourceControl/BrowseLatest

for webdevs, it is beautiful code

This public domain indie game library called "Pixie": http://www.tophatarcade.com/dev/pixie/

I was pleased whenever I opened the source to look at anything. I don't agree with the code formatting, but the code itself is easy to read and understand - and more importantly - to extend.

I must admit I ussualy take advantage of open-source software without even checking the source files; but every now and then I have to check some files for errors (errors ussualy coming from my side) and honestly, I either feel like I'm coding something terribly wrong, either they're coding something terribly wrong. The sad part is that they ussualy don't, I am.

Still, I can remember a great open source project that made me think that's a beautifull code, and the best part is that it's a game.

I'm talking about "Hero of Allacrost". Not sure if I can add links here but you can Google it :) That's beautifull code really.

Chers!

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.