Saturday, October 22, 2011

pre progress report and more of the gap

I'm having a good time learning Objective-C so far. I had thought that it was some really crazy new way of thinking about classes and program organization and it would be hard to learn. It actually is a crazy new way of thinking about classes (in implementation, not general idea of OOP) and it's a stickler for organization but doesn't rigidly enforce it. Even a smallish Obj-C program can be a half-dozen files since every class needs a .h and .m file (not NEEDS, just prefers).

Over the past year I've read the occasional tutorial or sample code and left with my head swimming. The really goofy stuff I saw makes sense now, and the goofy stuff is actually pretty neat and makes for faster implementation.

The future post about my progress will go over what I've learned so far and my thoughts on the language in general.

There are lots of C related stuff I'm kicking myself over not getting around to doing, like the more advanced data structures. Cocoa/Foundation has its own easy to use versions of linked lists and dynamic arrays and whatnot (I'm sure C++ has this in the STL somewheres) but I'll feel bad about using them before I implement it myself at least once so that I really know what it's all about. Hashing, too. I want to learn about it since it comes up from time to time.

My mind has been on what I call "the gap" again. The first gap every new programmer crosses is the gap between variables and getting those variables presented to the user (typically via printf or equivalent). The second gap (for me) was going from console-land to a modern style GUI. It took me until I was 28 to get to that point! My third gap (perhaps third and fourth) are 2d and 3d graphics. I was reading something about Perlin noise and the code for generating that noise was written out and the author had some nice pretty pictures and I realized something - the code he had in his article was just the math to generate noise. There were no bits of code for turning those functions into images. How did he get from one to the other? So that's been on my mind and I'm worried there is some big obvious thing I'm missing or that I'm making it out to be more complicated than it really is. From what I could tell the functions for generating the noise accepted an x and y position and spit out a value between -1 and 1. Scanning through all the x and y positions in the image, getting back this number, and shading/coloring it appropriately is probably all that was going on.

Therefore I promise this: when I figure out how to do anything important I will always in full present the code used to generate the end result. The entire reason this journal exists is to present what I'm learning in a clear enough way such that the 15 year old me would have a much easier time learning about those concepts. I did a much better job of this when I was learning the basics of C (especially pointers) but I've slacked a bit.

No comments:

Post a Comment