Feed on
Posts
Comments

As a follow-up to the Mac Developer Roundtable Episode 007, Colin Wheeler explains on Cocoa Samurai how he uses F-Script:

I'm a huge fan of creating experimental projects and playing around with API's and that's one reason I'm a fan of F-Script because then I don't have 30 small projects cluttering up my desktop or a temp directory and so now I do much less tiny projects in Xcode and use F-Script to see how the API's work.
You can start F-Script up in a console and create an app from scratch or just create temp objects and see how they work and play around with Cocoa in a way that's not possible in Xcode without creating loads of small projects.
You can download F-Script from http://www.fscript.org though if you are on Leopard you will need to download and install a special version of FScript Anywhere from http://osiris.laya.com/blog/?p=24

You can learn more on this in "Exploring Cocoa with F-Script", an article that shows the graphical F-Script object browser and some other cool exploration tools in action.

The Webcast of my Microsoft Techdays 2008 session, "An Introduction to LINQ", is available (in french):

Part 1
Part 2
Part 3

On the same site you will find the Webcasts for over 300 sessions (in french) of the Microsoft Techdays 2008, including sessions on Visual Studio 2008, C# 3.0, Silverlight, SQL Server 2008, F# and more…

Become an Xcoder is a free little eBook we wrote to help beginners with no or little programming experience to start their journey into the world of Mac OS X development with Objective-C and Cocoa. (See Learn Cocoa for a recent discussion on this topic).

I’m glad to announce that the book has been updated for Leopard and Xcode 3, thanks to the work of Alex Clarke (one of the original authors and our publisher at CocoaLab).

You can download the PDF of this new edition:



You can also access translations (not updated for Leopard yet) and a very nice HTML version of the book here at CocoaLab. For exploring more advanced Cocoa topics, Alex has created LabNotes, where you can find learning material, including hands-on exercises, on topics such as Cocoa bindings, MVC, accessors, etc.

So far the book has been quite successful, with nearly 100,000 downloads (which give me an opportunity to shamelessly brag about!). Interestingly, the number of downloads has increased in recent weeks. We have gone from an average of 400 downloads/week in January to 1000 in February to 2700 this month. I would not be surprised for this to be representative of a growing interest in Cocoa, amplified by the recent iPhone SDK announcement. I wonder if other Cocoa related web sites or publishers are seeing the same trend…
Anyway, enjoy Become an Xcoder, Leopard Edition!

Briksoftware has released Drop Inspector, a development utility that embeds an F-Script environment. Drop Inspector’s job is to let you inspect the contents of the pasteboard, including drag and drop data.

On Mac OS X, the pasteboard is a subsystem that allows sharing data between components or applications:

You typically use pasteboards in copy and paste operations, although pasteboards also provide the basis of system services. NSPasteboard objects transfer data to and from the pasteboard server. The server is shared by all running applications. It contains data that the user has cut or copied, as well as other data that one application wants to transfer to another. [...]

Data can be placed in the pasteboard server in more than one representation. For example, an image might be provided both in Tag Image File Format (TIFF) and as encapsulated PostScript code (EPS). Multiple representations give pasting applications the option of choosing which data type to use. In general, an application taking data from the pasteboard should choose the richest representation it can handle?rich text over plain ASCII, for example. An application putting data in the pasteboard should promise to supply it in as many data types as possible, so that as many different applications as possible can use it. [...]

The pasteboard owner declares the data types it can write. Pasteboard data generally refer to an object instance whether a string, an arbitrarily complex object graph such as a dictionary of arrays, an instance of NSData, or an object wrapper for an arbitrary block of data. You can name your own pasteboard types for special-purpose data types.

Drop Inspector provides access to pasteboards contents from an hexadecimal-view and the embedded F-Script environment. You get the full power of F-Script for inspecting and manipulating objects graphically. Nice!

The video of Tim Burks C4 talk has just been released.


Tim talks about Objective-C, Ruby/Objective-C bridges (including one he created), and his new baby, the Nu language. Nu is a dynamic language based on the Objective-C run-time, with a strong flavor of Lisp and Ruby.

Catch the other C4[1] videos here.

Here is a little list of things that, in my experience, contribute to make Objective-C a powerful and fun programming language.

Classes are objects

Each class is an instance of a meta-class automatically created and managed by the run-time. We can define class methods, pass classes as arguments, put them in collections and so on. To create an object, we just send a message to the class we want to instantiate. No need to reinvent a "factory" system. No need for a specific constructor mechanism at the language level. This helps keeping the language simple and powerful.
And, by the way, meta-classes are objects too!

Dynamic typing

As in Ruby, Python, Smalltalk, Groovy… Extremely useful because we don’t always know beforehand what our objects are going to be at run-time. Dynamic typing in Objective-C is simple to use. For example, this declares a variable that can hold a reference to an object:

id myObject;

Optional static typing

Still, Objective-C also has support for static typing. Best of both worlds.

This declares a variable that can hold a reference to an object of class (or subclass of) NSView:

NSView *myObject;

Categories

Categories let us define new methods and add them to classes for which we don’t have the source code (such as the standard Cocoa classes provided by Apple). This makes it easy to extend classes without resorting to subclassing. Extremely useful to adapt existing classes to the requirements of frameworks we want to use or create.

Message sending

We interact with objects by sending them messages. Often, the receiver of a message will have a method that directly matches the message (i.e. that has the same name, or, in Objective-C terms, the same selector). In this case the method will be invoked. But this is not the only possible outcome, as an object can choose to handle a message in other ways such as forwarding it to another object, broadcasting it to a number of objects, introspecting it and applying custom logic, etc.
Very powerful…

Expressive message syntax

Message patterns in Objective-C are like natural language sentences with holes in them (prefixed with colons). When we write code that sends a message to an object, we fill the holes with actual values, creating a meaningful sentence. This way of denoting messages comes from Smalltalk and makes the code very expressive.

Example, sending a message to an ordered collection, asking it to insert a given object at index 10:

[myCollection insert:myObject atIndex:10]

A message sending expressions can be read like a sentence where the receiver is the subject and the message is the rest of the sentence (for instance, an action that we would like the receiver to perform): "myCollection insert myObject at index 10".

Introspection

Introspecting objects is easy. For example, we can ask an object for its class like this:

[myObject class]

Determine if an object has a method "foo":

[myObject respondsToSelector:@selector(foo)]

Ask an object for the signature of its method "foo":

[myObject methodSignatureForSelector:@selector(foo)]

Ask a class whether it is a subclass of another class:

[class1 isSubclassOfClass:class2]

And so on…

Dynamic run-time

Objective-C has a dynamic run-time. It allows crafting messages at run-time, dynamically creating classes, dynamically adding methods to existing classes, changing method implementations and so on…

For a nice example of what can be achieved with Objective-C introspection and dynamism you can have a look at this article I wrote about the graphical object browser provided by F-Script.

Automatic garbage collection

The automatic garbage collector runs in its own thread, concurrently with the application code. It uses a generational model to improve its efficiency by targeting in priority memory zones that are more likely to be garbage. It works for objects and also for raw C memory blocks allocated with the NSAllocateCollactable() and similar functions. malloc() works as usual, providing control over memory not managed by the collector.

The garbage collector is an opt-in service: you can choose to not make use of it in your application and instead rely on a reference counting system. This system includes a rather ingenious delayed release mechanism that goes a long way to reduce the burden of manual reference counting.

Note that at the time of this writing, the automatic garbage collector is not available on the iPhone.

C inside

Objective-C is primarily an object-oriented extension to the C language and constitutes a superset of C. This means that the raw power of C is available, and that C libraries can be accessed directly (as you know, there is quite a number of them available out there!). Beside, this creates a symbiotic relationship between the language and the operating system, as Mac OS X, which is a UNIX system, is primarily written in C and, for the upper-level parts, in Objective-C.

C++ fluent

Not only is Objective-C a superset of C but it can also understand and call C++ code. Used in this configuration, the language is named Objective-C++ and allows mixing Objective-C and C++ code in the same code statements. It also allows directly using C++ libraries.

Simplicity

Objective-C’s Smalltalk-inspired object system is leaning toward simplicity. Many features that tend to render languages complex (templates, overloading, multiple inheritance, etc.) are simply absent from Objective-C, which offer simpler programming models taking advantage of its dynamic nature.

Access to Apple technologies

Each new version of Mac OS X, and now, of the iPhone OS, is full of interesting new technologies which are directly available from Objective-C to play with. This contributes significantly to make Objective-C fun to use.

Laurent Sansonetti, Apple's Ruby wizard, has released MacRuby, an Apple open source project which unifies Ruby and Cocoa (instead of just bridging them like RubyCocoa does).

MacRuby is a version of Ruby that runs on top of Objective-C. More precisely, MacRuby is currently a port of the Ruby 1.9 implementation for the Objective-C runtime and garbage collector.

Laurent talks about the innards of MacRuby in this interview at InfoQ:

The Ruby object data structure had to be modified to conform to the Objective-C object data structure, so that a Ruby object can be casted at the C level as an Objective-C object. Then, the object allocator was modified to use the Objective-C one instead, which means that all objects (Ruby and Objective-C) are allocated from the same memory pool.

Finally, the traditional Ruby garbage collector was removed and instead we use the Objective-C garbage collector. This change wasn't very easy because the collector runs by default in generational mode, and expects you to appropriately set “write-barriers” every time you register an object in the object store, because it collects young generation of objects based on this information. [Read more here]

Learn Cocoa

I just stumbled upon Learning Cocoa, an interesting post at Engineering Hints that provides advices for beginners wanting to learn Cocoa. As a first step, the author suggests starting with our Become an Xcoder booklet:

The first stage is to go through an excellent short PDF manual called Become an Xcoder. This really does require no prior knowledge of C, C++ or any other language that most manuals assume the reader has. It gives the reader sufficient knowledge to understand what is happening in all the different sections of a project as well as working with basic classes such as arrays or strings.

The book is free and is published under a Creative Commons Attribution license. You can download it (PDF) or read it online and comment on it in a dedicated Wiki at CocoaLab.

The project was started by Bert Altenburg and inspired by his famous AppleScript for Absolute Starters guide. Alex Clarke, of CocoaLab, joined us to write the book and also took on the duty of editing it.

By the time you read this, the book should have reached its 80,000th download.
The original version is in english and, thanks to the work of Mazen ArRammal, Maria Shinoto, Nobuatsu Sekine and Shiva Huang, we now have translations in the following languages:

We haven’t updated it yet for Leopard’s Xcode 3, but most material is still relevant. March 2008 update: the book has been updated for Leopard and Xcode 3 (see this post).

In addition to the resources reviewed in the Engineering Hints post I’d like to point out that F-Script proves to be a useful tool for learning Cocoa, in conjunction with the Xcode toolset. F-Script provides an interactive environment where one can type snippets of Cocoa code, have them executed immediately, and visualize results. All without having to create a complete program and generating output. This interpreted environment also includes a set of tools allowing inspecting and manipulating live objects graphically. This lets you explore Cocoa and quickly experiment with APIs or algorithms you are working on.

This is also an efficient and fun way to learn programming. Rob Abernathy wrote about this way of using F-Script:

Since I’ve downloaded and installed F-Script, my 7 year old son has been working through the tutorials for F-Script. Has been having a great time with it and is learning a great deal. F-Script is a great tool for teaching programming.

Finally, Cocoa programmers of every age will have a lot of fun and learn a lot by browsing the wonderful Cocoa Literature List created by HyperJeff.

This is the entry point for a world of articles, tutorials and books about Cocoa technologies contributed by the developer community over the years. Hundreds and hundreds of them. Not only that, but it also comes with a great content search system. Check it out, it is full of gems!

Tomorrow, I'll be giving a talk at the Microsoft TechDays 2008 conference. This is the main developer-related Microsoft event here in France. There will be about 280 technical sessions and I’ve heard the organizers expect 15,000 attendees! The subject of my talk is LINQ, a set of new technologies added by Microsoft to languages such as C# and Visual Basic. LINQ aims at radically simplifying the way object-oriented languages deal with objects and other information models such as relational databases or XML infosets.

I've been hooked on LINQ since the beginning, when its ideas started to be experimented in the context of the Cω research project. My buddy Fabrice Marguerie, with whom I'll be giving the talk, describes LINQ in his new book, LINQ in Action:

LINQ stands for Language Integrated Query. In a nutshell, it makes query operations like SQL statements into first-class citizens in .NET languages like C# and VB. LINQ offers built-in support for querying in-memory object collections such as arrays or lists, XML, DataSets, and relational databases. But LINQ is extensible and can be used to query various data sources [...]

In addition to offering novel approaches to deal with data, LINQ represents a shift toward declarative and functional programming. When people ask me for reasons to learn LINQ, I tell them that they should learn it in order to be able to use it with XML, relational data, or in-memory collections, but above all to be able to start using declarative programming, deferred execution, and lambda expressions.

While LINQ and OOPAL (the array programming model adopted by F-Script) are based on very different principles, they share a common goal: providing a higher-level programming model that allows for more expressive and powerful language constructs. We can illustrate this with the following example, comparing some typical code in a classic object-oriented language (here, Java) with the code in C# with LINQ and F-Script with OOPAL.
In this example we deal with the object model of an airplane company:

Say we have a collection of flight objects named flights. Starting there, we want to get the names of the pilots in charge of a flight to Paris on a B747 airplane. And we want them sorted by salary in increasing order.

Java


TreeSet<Pilot> pilots = new TreeSet<Pilot>(new Comparator()
{
    public int compare(Object o1, Object o2)
    {
        if (((Pilot)o1).salary() < ((Pilot)o2).salary())
            return -1;
        else if (((Pilot)o1).salary() == ((Pilot)o2).salary())
            return 0;
        else
            return 1;
    }
});

for (flight : flights)
{
    if (flight.arrivalLocation().equals("PARIS") && flight.airplane().model.equals("B747"))
    {
        pilots.add(flight.pilot());
    }
}

ArrayList<String> result = new ArrayList<String>();

for (pilot : pilots)
{
    result.add(pilot.name());
}

C# (with LINQ)


var pilots = (from flight in flights
              where flight.arrivalLocation == "Paris" && flight.airplane.model == "B747"
              select flight.pilot).Distinct();

var result = from pilot in pilots
             orderby pilot.salary
             select pilot.name;

F-Script (with OOPAL)


pilots := (flights at:flights arrivalLocation = 'PARIS' & (flights airplane model = 'B747')) pilot distinct.

result := pilots name at:pilots salary sort.

The three programs manipulate plain old standard objects (respectively Java, .NET and Cocoa objects). However, the programming models on which they are based differ and, as you can see, the C# and F-Script versions are shorter and more expressive.

If you are around and want to know more about LINQ, you can come to my session!

F-Script can be used on its own or as a sub-language in Objective-C. This allows using F-Script’s object manipulation capacities (e.g., array programming) from Objective-C code without being forced to extend Objective-C itself.

The sub-language term refers to the situation where some code in a given language is embedded in the source code of another program written in another language. For example, Java programmers can use SQL as a sub-language via the JDBC API. A sub-language may be used by a host language without requiring that the host language be extended or modified: the sub-language is integrated using a simple library.

This requires a way of exchanging data between the Objective-C and F-Script, i.e., we must be able to exchange any type of object. Sharing objects between different languages is not a simple matter. There are basically two solutions:

  1. Providing a run-time that bridges the object models of the two languages
  2. Using the same object model in the two languages

F-Script adopts the second, straightforward, approach. This allows any object to be exchanged between the two languages with no limitations. Both F-Script and Objective-C can freely share and manipulate the objects, because they are native to both languages.

For example, suppose we have an array of NSWindow objects in our Objective-C program. We want to put in front of the screen the windows in this array that contain an edited document. Moreover, we want the windows to be “front-sorted” according to the alphabetical order of their titles. Finally, we want to know how many of such “edited” windows are present in our array. We decide to write that little algorithm in F-Script, given how easy this is, and to put it right inside our Objective-C source code.

In F-Script, the parametrized block for performing the specified task would be:

[ :w | w := w at:w isDocumentEdited. (w at:w title sort) reverse orderFront:nil; count]

This defines a block (aka closure or lambda) with a parameter named w that is used to pass the array of windows. The block uses the standard isDocumentEdited method provided by the AppKit to determine if a window is associated with an edited document. Such windows are selected, sorted and brought to front. Finally, their number is returned.

Using this code in Objective-C is easy. All we have to do is:

  1. Add FScript.framework to our project and add the following import directive in our Objective-C source file: #import <FScript/FScript.h>
  2. Put our F-Script code into an NSString
  3. Turn it into a block by sending the asBlock message to the string
  4. Execute this block in the same way we would have done in F-Script: by sending it a value:message, passing our array of windows as argument (in the Objective-C example below, we pass an array that contains all the windows of the application).

NSArray *windows = [[NSApplication sharedApplication] windows];

NSNumber *count = [[@"[ :w | w := w at:w isDocumentEdited. (w at:w title sort) reverse orderFront:nil; count]" asBlock] value:windows];

That’s all for today. Enjoy!

The Pragmatic Programmers have just published a Beta version of Bill Dudney’s forthcoming Core Animation book.

Mac OS X Leopard introduces a fantastic new technology that makes writing applications with animated and cinematic user interfaces much easier. We’ll explore this new technology by starting with the familiar concepts you already know from the pre-Leopard development kits.

Then we’ll see how they apply to the new frameworks and APIs. We’ll build on your existing knowledge of Cocoa and bring you efficiently up to speed on what Core Animation is all about.

With this book in hand, you can add Core Animation to your Cocoa applications, and make stunning user interfaces that your user’s will be showing off to their friends.

The Beta book program let us access the book as it is written and provides the option to also get the paper book when released (planned for july 2008). I’ve just brought the combo, and downloaded the PDF. It’s about 70 pages long for now, about a third of the planned 220 pages, and it looks like 70 pages of pleasure if, like me, you enjoy computer animations and the possibility of using them in your programs.

The author recount how, back in the NeXTStep days, he used to create files just so he could delete them and see the nice recycling animation in the dock. I vaguely remember doing the same… Now, could someone tell us if the black hole, which was the ancestor of the recycler, was also animated?

The videos of the latest C4 conference are starting to appear online.

C4, set up by Jonathan “Wolf” Rentzsch, is a conference for Mac developers that departs from the usual big, ultra-controled, corporate events. From what I’ve been told, this one definitely has the “indie” touch.

The first video is Indie Ethos.

Jonathan speaks about “an indie conference for indie developers” and explores aspects of the industrial dynamic currently at work in our field. It’s an interesting and very entertaining session.

From Charlie Calvert’s Community Blog:

The next version of Visual Studio will provide a common infrastructure that will enable all .NET languages, including C#, to optionally resolve names in a program at runtime instead of compile time.
[...] C# developers can currently use reflection to instantiate classes and call arbitrary methods that are not known at compile time. The dynamic extensions to the C# language will make it much easier to make such calls.

The C# team’s plans for the actual syntax are still evolving. For example, they are pondering over the introduction of a dynamic keyword to mark code blocks inside which this feature would be activated. So, for instance, we could have:


dynamic
{
    myObject.foo();
}

Where the foo() method would not have to be declared anywhere. The variable myObject could just be declared to be of type object, and this would compile.

In dynamic object-oriented languages such as Objective-C, Smalltalk or Ruby, this feature is the default and is a tremendous source of simplicity and power. If this can be grafted without too much problems or crippling (how is it going to interact with the existing rules such as overriding, how will it handle absent methods at run-time, etc.) this could be a giant leap forward for C#.

And then, I expect to see it discussed for inclusion in Java soon.

One of the oldest inter-application communication technologies in Mac OS X is provided by the Services menu. Actually, services have been there since the very first version of the OS, when it was still called NeXTStep:

The services facility allows an application to make use of the services of other applications without knowing in advance what those services might be.

For example, a text editing application lets the system know that it's willing to" provide plain ASCII text or rich text (RTF) on the pasteboard any time there is a selection. Any service-providing application is then able to receive that text and act upon it. A service-providing application could thus provide such services as grammar checking, encryption, reformatting, language translation, conversion to speech, or any number of useful functions. Service-providing applications can also place data back on the pasteboard to be received by the main application.

In this way, data can be seamlessly exchanged between applications, and any application can extend the functionality of many others.

Xendai Solutions has just released the latest version of Bellhop (v. 1.0.5), an application that makes it super easy to create and publish services using F-Script (as well as other languages including AppleScript, Perl, Python and Ruby). Bellhop can be used for free, and you are encouraged to make a donation if you like the product. The application comes with excellent documentation and is fun to use.

To experiment with it, I've created three services so far:

  • The first one is very simple and consists in capitalizing the selected text.
  • The second one is more useful: it creates a new task in iCal named after the selected text, using of the Calendar Store framework introduced by Apple in Leopard.
  • The third one is fun, and demonstrates that services are in no way limited to working with textual data: it takes a list of numbers, creates a nice looking chart using these numbers and returns the chart as an image in the original application.

The Capitalize Words Service

This service is used as a basic example in Bellhop's documentation. As usual, we have full access to Cocoa from F-Script. For this service, we make use of the capitalized method provided by NSString. Here is the code that we can enter in the Bellhop graphical editor:


" Sample F-Script service to capitalize all words in the currently
  selected text. This service might be labeled 'Capitalize Words'
  in the Services menu. "

runService := [ :aPasteboard | 

    "Read string from the pasteboard"
    pbString := Pasteboard readStringOfType:NSStringPboardType forPasteboard:aPasteboard.

    "Capitalize string properly"
    pbString := pbString capitalizedString.

    "Declare returned data type on pasteboard and write it back"
    Pasteboard declareTypes:{NSStringPboardType} forPasteboard:aPasteboard.
    Pasteboard writeString:pbString ofType:NSStringPboardType forPasteboard:aPasteboard.
]

The service configuration is also done using Bellhop:

Finally, the Bellhop document is saved in one of the directories that Bellhop scans automatically (e.g. the "Documents/Bellhop" subfolder in my home folder).

And, oh miracle, the Capitalize Words functionality is now available in other applications.

For example, I can select some text in an email message I’m editing, apply the service and have the selected text become capitalized.

But… My services menu is a mess!

By default, the services menu displays all the services available on your system, which often makes it much too crowded. This is where comes another nifty utility, Service Scrubber. This utility lets you fully customize the services menu. This is particularly useful for removing services that you never use (typically, a lot), or associating keyboard shortcuts to some services.

The New Task Service

This service uses the selected text to create a new task in iCal. To that end, it makes use of a new framework introduced in Leopard, the Calendar Store framework:

Calendar Store is a framework that allows Cocoa applications to access iCal data. You can fetch iCal records?such as calendars, events, and tasks?and receive notifications when these records change in iCal. You can also make some local changes to records and save them to the Calendar Store database.

The CalTask and CalCalendarStore classes we use for implementing the service are provided by the Calendar Store framework. They take care of communicating with the Calendar Store Server which manage the Calendar database:

Here is the F-Script code for our service:


runService := [ :aPasteboard | 

    "Read string from the pasteboard"
    pbString := Pasteboard readStringOfType:NSStringPboardType forPasteboard:aPasteboard.

    "Load the Calendar Store framework"
    (NSBundle bundleWithPath:'/System/Library/Frameworks/CalendarStore.framework') load.    

    "Create and configure the task"
    task := CalTask task.
    task setTitle:pbString.
    task setCalendar:(CalCalendarStore defaultCalendarStore calendars objectAtIndex:0).

    "Save the task in the calendar store"
    CalCalendarStore defaultCalendarStore saveTask:task error:nil.
]

The "New Task" service is now available in other applications. For example, I can select some text in Safari…

…and then activate the service. The selected text is immediately saved in the system-wide calendar database, and appears in the tasks panel of iCal:

Thanks to services, I shall not screw up my next telepathy session like last time.

The Line Chart Service

This service creates a chart from the selected list of numbers (the numbers must be separated by spaces). The chart is created using the Google Chart Web Service. You'll find more about using this Web service with F-Script in Google Chart API Fun with Cocoa and F-Script.


runService := [ :aPasteboard |  

    "Read string from the pasteboard"
    pbString := Pasteboard readStringOfType:NSStringPboardType forPasteboard:aPasteboard.

    "Parse the string to get the numbers"
    values := (pbString componentsSeparatedByString:' ') doubleValue.

    "Construct the call to the Google Chart Web service"
    max := values \ #max: .

    scaledValuesString := values * 100 / max componentsJoinedByString:','.

    chartString := 'http://chart.apis.google.com/chart?cht=lc&chs=250x150&chxt=y&chxr=0,0,' ++ max printString ++'&chd=t:' ++ scaledValuesString.

    escapedChartString := chartString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding.

    "Call Google Chart and create an NSImage with the result"
    image := NSImage alloc initWithContentsOfURL:(NSURL URLWithString:escapedChartString).

    "Declare returned data type on pasteboard and put the image in TIFF format"
    Pasteboard declareTypes:{NSTIFFPboardType} forPasteboard:aPasteboard.
    Pasteboard writeData:image TIFFRepresentation ofType:NSTIFFPboardType forPasteboard:aPasteboard.
]

Then, all we have to do is to tell Bellhop that the service accepts a string, returns a TIFF image and is active. We can now use the service in applications that supports such images. Here is an example with TextEdit (editing a document in RTFD format). Before using the service…

And after…

That's all for today. Enjoy!

The “great dynamic languages shootout” organized at OOP 2008 is over. The winner is Thorsten Seitz using Smalltalk and the Seaside Web application framework.

The second place goes to Mirko Stocker with JRuby and the third place to Robert Brandner with Lua.