Saturday, June 28, 2008

Subjective-C

Reading through primers for Objective-C, I'm struck by the use of new names for existing concepts. For example:
A protocol declares methods that can be implemented by any class. Protocols are not classes themselves. They simply define an interface that other objects are responsible for implementing. When you implement the methods of a protocol in one of your classes, your class is said to
conform to that protocol.
Interesting, so a protocol is just an interface that other objects implement. In other parts of the world, we call such an interface an interface.
A class in Objective-C can declare two types of methods: instance methods and class methods. An instance method is a method whose execution is scoped to a particular instance of the class. In other words, before you call an instance method, you must first create an instance of the class. Class methods, by comparison, do not require you to create an instance, but more on that later.
So instead of declaring methods static, we now have somewhat less expressive notations of "-" for instance methods and "+" for class methods. Class methods are different than static methods, Apple tells me, but why do we have to resort to "+"?
When you want to call a method, you do so by "messaging” the corresponding object. The message in this case is the method signature, along with the parameter information the method needs. All messages you send to an object are dispatched dynamically, thus facilitating the polymorphism behavior of Objective-C classes. In other words, if a subclass defines a method with the same signature as one of its parent classes, the subclass receives the message first and can opt to forward the message (or not) to its parent.
So the "message" you send (with quotes) is equivalent to calling a method (without quotes). Also, what part of polymorphic inheritance isn't already part of other OOPLs, like Java?

Final gripe that may just be a n00b question: If the "messaging" syntax is represented by [object :parameter], how do you do method chaining?
[[[object method1:parameter1] method2:parameter2] method3:parameter3]?
That looks ugly.

Still wondering why we need another language to program on a different platform but maybe I'll change my mind once I delve deeper. For now, Apple seems to be continuing to do its thang of making a big deal out of existing concepts. XCode does "Data Tips". Great. What other decent IDE doesn't?

Wednesday, June 18, 2008

Sado-MAso

So earlier today somebody made a reference to a post on this blog and it was terrifying. I got over it with some meds I got from that happy Asian dude down at the corner of Main and Abel. Anyway, since I risk boring all of three of you with this stuff, I figure it's just your bad luck that you're reading this post.

I'm once again a total pansy as far as running is concerned since I haven't run for about 3 years now. I've been bed ridden with a debilitating illness and my muscles have atrophied to the point of needing crazy people from Zion to stick needles in me while Laurence Fishburne gets all philosophical on mine ass. But progress is being made, even if in the passive voice! Last week I did a "run" of 3 miles at 10:00/mile and I felt like an asthmatic smoker with one lung and half a leg. This Sunday I managed 5 miles at 9:40 feeling like a normal person with normal lungs and completely average legs. Today I felt like King Kong on crack because I ran until my diaphragm wanted to punch my guts in. Awesome!

Mile 1: 3/4 - 2% - @10:00 | 1/4 - 6% - @11:30
Mile 2: 3/4 - 2% - @10:00 | 1/4 - 7% - @ 12:00
Mile 3: 1/4 - 0% - @10:00 | 1/4 - 1% - @ 10:00 | 1/4 - 2% - @10 | 1/4 - 8% - @12:30
Mile 4: 1/4 - 0% - @10:00 | 1/4 - 1% - @ 10:00 | 1/4 - 2% - @10 | 1/4 - 9% - @13:00
Mile 5: 0%, accelerated steadily from 10:00 down to 7:20.

So, not exactly an impressive workout but also pretty good given that I'm paralyzed from the waist down. At least I'm not some crazy ultra-marathon runner gunning for the Leadville.

Sunday, June 15, 2008

Per Se...

...is, among many things, a highly rated restaurant by Thomas Keller in New York.

It is also Latin for "of itself" or "by itself" or "with reference to itself".

There is no such thing as "per say", except as a homophonic yet mistaken spelling of "per se".