Update on Categories

In my [recent post][oldpost] on Cocoa Style I did, among other things, say that it’s a great idea to put lots of stuff in categories. Now, Brent Simmons, author of [NetNewsWire][nnw] gives a different opinion on this in [three][ie1] [separate][ie2] [posts][ie3] on his blog (and no, he didn’t do that because of my article, thanks for asking). I thought this could be interesting for you as well. Mr Simmons has way more experience than I do, so I’d rather follow his advice than my hunches.

Which I actually did, I just went through a project and eliminated all categories that are used never (more of them than I’d have ever thought), only once or in very rare cases only twice. During that, all categories that were just there to enable the dot-syntax got thrown away. When seen in the light of day, the new syntax does not outweigh the lot of code that goes into them without any need. Next step will be putting everything in a single file, which I thought was a good idea, I just feared it might be considered bad style.

So what does this mean about my old ideas? Frankly, I don’t know. I still have to make up my mind, the code still does contain lots of categories that I think are useful. Obviously, this isn’t a good answer, but it’s the best you’ll get from here. The only truly useful thing is to gain experience yourself, or of course steal from people with experience.

Speaking of which: Lots of people (well, less than five, but that’s lots in my book) ask me what books to read, what tutorials to do. Look, it’s nice and fine to do that, but I think it’s not useful to first read all the books and tutorials, and start coding only afterwards. Find a cool problem and start working on that. Learn what you need as you go along. For me, reading texts is never as much fun as doing something myself, and stylistic rules don’t make sense until I’ve disobeyed them and got burned.

Absolutely unrelated: I’m planning on posting more about code I’ve actually written myself again. Specifically, if you’re interested in [Hubschrauber][heli] or [Snow][snow], you might like what’s in the pipeline.

Written on August 7th, 2008 at 07:33 pm

0 Comments

    New comments can no longer be posted because it got to annoying to fight all the spam.