« November 2005 | Main | January 2006 »
December 20, 2005
Why does this make me laugh?
http://www.amazon.com/gp/product/076457874X is a book about WinFX Beta.
It's a book about a beta.
It has 4 authors.
It's just funny :D
Posted by Chris Forsythe at 01:36 AM | Comments (0)
Visual Studio is not Interface Builder
So I'm trying visual studio out, doing the c# thing, and the first thing I miss from Interface Builder on os x is the guides that get shown. They're the things that tell you that the item you are dragging on the pallette is this close to this one, and oh ya, this one too.
Visual studio has none of that, and it sucks.
Posted by Chris Forsythe at 01:17 AM | Comments (1)
December 17, 2005
Higher Order Messageing (HOM)
First, i would like to say hello to everyone. This is my first post here :)
So in the last few weeks i was working on my own HOM implementation (which I intend to use in ChatKit), and it evolves pretty well. It now has the following prefix messages for NSObject:
* -ifResponds which performs the argument message only if the receiver can respond to it (it's simply a cleaner if([receiver respondsToSelector:sel]) [receiver doSomething]).
* -async which detaches a new thread and performs the argument message in that thread.
* -do is probably one of the more useful higher order messages. It's much easier to explain with an example: [[myObjct addObject:[someArray each]].
* -mainPerformAndWait: & -mainPerform which performs the argument message in the main thread.
It also provides these prefix messages for NSArray:
* -select which sends the argument message to each of the receiver's objects and returns the one that returned YES. Example: myArray contains @"a", @"hello" and @"aaa". [[myArray select] hasPrefix:@"a"] will return an array containing @"a" and @"aaa".
* -reject does the same as -select but returns the objects which returned NO.
* -collect performs the argument message and returns an array containing the results.
* -each which is used together with -do (see above).
The obvious question that raises is why? Why did i spend all that time making my one framework, when there are already other free open source implementations available?
Well, there are 3 major reasons:
1) Simplicity of the code. Implementing Higher Order Messaging is not that easy as it might look. The best implementation in my opinion is in MPWFoundation by Marcel Weiher (this is also where HOM was born). I had 2 problems with it. The first is that the code is really lacking comments. It also compiles with a lot of warnings due to the fact that a lot of methods are not declared in headers but used in implementation files. The second problem is that MPWFoundation contains a lot of other really cool stuff which i didn't really need. My original idea was to tear the HOM implementation out of MPWFoundation, reorganize it and document it, but the level of complication of it made me to give up. Other implementations are more organized then MPWFoundation, but they have their own problems (see below).
2) Modularity of the code. The implementations of HOM which i saw, all did the same thing - implemented ALL the higher order messages inside one object. MPWFoundation did them using MPWEnumFilter and others did it inside the trampoline itself. In my opinion this is really bad and prevents others from adding their own prefix messages. In my implementation, the trampoline object passes an invocation to its target. Not more, not less. The implementation of the prefix message itself is done in the target of the trampoline (the target will usually be the receiver of the prefix message), and can be expanded as needed.
3) It was fun, interesting and challenging to write :)
It needs a bit more polishing, but after that I'm going to release it under BSD license.
Posted by Ofri Wolfus at 10:01 AM | Comments (1)
December 01, 2005
Interviewed
I was interviewed by Victor over at MacNN
Here is a link to that podcast.
Posted by Chris Forsythe at 10:07 PM | Comments (0)