William T Goodall's Weblog :
Updated: 26/8/06; 02:30:28.

 

Subscribe to "William T Goodall's Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Monday, June 12, 2006

Mate Master: Allan Odgaard. [TextMate]

Allan Odgaard has written a number of applications and utilities in his time as a programmer. He’s written demos for the C64 and calendar apps for the Amiga. He even wrote a nifty MP3 player called MusicMate. But that’s not the “mate” he’s best known for. Allan is the lead- and sole-developer of TextMate, a very highly rated text editor for OS X.

Motivation

TextMate has, over the past year, undergone an explosion not just in popularity, but also in stability and usability. This sort of critical-mass exponential growth is something we’re used to seeing from, say, open source software. And TextMate does make great use of OSS scripting languages like ruby, perl, and python. But the application itself is closed-source and Alan is its only developer. How has he managed to stay so productive over the past year?

“My productivity is proportional with my motivation,” Allan says, “so I do a few things to keep myself motivated.”

Motivation, for Allan, comes down to focus, diversity, and the ability to see the results of one’s labors quickly. “I work with only a subset of my to-do list, and release minor updates regularly, which helps make it feel less overwhelming, and gives a sense of accomplishment,” he says. “I also keep at least a few tasks open so that, if I feel I am getting nowhere with the current thing I am doing, I can just switch tasks.”

The same holds true for adding features to TextMate. “I find the angle which gives testable functionality as fast as possible,” says Allen. “Being able to play with the results of what I do is the best way to become motivated to further refine it.”

And that means TextMate isn’t always the first thing to see a given feature. “Sometimes, rather than add the functionality directly to TextMate, I write it in a sandbox,” Allen continues. “Then I need less code to get a result that I can play with.”

Development and the Unix Philosophy

The Unix Philosophy is often summed up with these three tenants given by Doug McIlroy:

  • Write programs that do one thing and do it well.
  • Write programs to work together.
  • Write programs to handle text streams, because that is a universal interface.

TextMate, with its close shell integration and extensive use of stdin and stdout, is said to have been designed with the Unix philosophy in mind. As Allan puts it, “instead of writing a command to solve the problem at hand, we find the underlying pattern, write a command to solve types of that problem, and then use it in a script.”

Has the somewhat unorthodox design decision of adopting the Unix philosophy for a GUI text editor on the Mac paid off when it comes to maintainability?

“Indeed,” says Allen. Implementing a feature in TextMate is as easy as scripting together a command. And TextMate ensures commands stay simple. “Part of the reason is that the decision about which command to execute and what it should work on is not put in the command itself, but is something TextMate resolves using a simple rule system. This keeps the complexity of each command down and allows them to be clueless about being called by TextMate or about potential conflicts with other commands.”

Certainly most programmers would love to have that kind of abstraction in their own applications. But how does Allan manage it?

“In TextMate,” he explains, “the language parser assigns a name to each semantic unit in the document, and the user can then restrain a command to a given context by entering the selector for that context — often just the name the language grammar assigns to that particular unit.”

This keeps the user in the driver’s seat and takes most of the context-related complexity out of the command. But TextMate doesn’t stop there. “In addition to expressing when a command should be ‘active’ we can also use this selector to limit the input given to the command,” Allan continues. “This means the actual command only needs to read from stdin, run a regular expression, and then write to stdout.”

The result is surprisingly CLI-like. To write a command that, for example, capitalizes the selected text in a TextMate document, I don’t have to worry about the selection, how the command was evoked, or even whether or not TextMate is running. For all intents and purposes, I could pipe cat to my command with the same results. Allan summarizes: “Commands need not be aware of each other or document context, which makes for a system that is easy to maintain and extend.”

The ease with which users (and Allan himself) can add features to TextMate accounts for the plethora of high quality “bundles” that extend the text editor with new formats and functions. But what about the continuing development of TextMate itself?

Here it can certainly be said that Allan eats his own dog food. He writes TextMate using TextMate (with the help of the ObjC bundle). “It definitely makes me write code faster,” he says, smiling. “And it allows me to do tasks from inside my editor which would otherwise require switching context or ‘manual’ work — so in that sense, I am far more productive, and it is making my work-experience very joyful!”

And does Allan think he’ll ever tire of the intensive development cycle he’s established with his text editor? “I can’t yet imagine running out of things I want to do with TextMate,” he says. “So in that sense, it will always be work-in-progress.”

If that’s starting to sound like a warning sign of creeping features and bloat, take heart. “At the same time I do value simplicity,” Allan ensures us. “Much of what I want is to make existing things simpler and at the same time more flexible. So I do not really fear ‘featuritis’. But I do see a challenge in avoiding it.”

Open Source Software

TextMate, through its integration with the command line shell — and from there every scripting language installed on the Mac — makes use of many OSS legends like bash, perl, and ruby. Does Allan feel he’s building TextMate on the shoulders of giants? “I wouldn’t say that TextMate is built on these things,” Allan muses. “But its extension mechanisms rely on them being there. So it would have been a different program without them.”

And these technologies have helped to spur TextMate’s popularity. “Some of the success of TextMate is definitely because it makes it possible for the user to write new functionality in a scripting language of the user’s own choosing,” Allan concedes. “So in that sense, the existence of these open source projects have contributed to its success.”

But despite its relationship to these projects, TextMate itself remains a closed source application. Why is that?

“The main factor was that I wanted to sell it as consumer software and earn enough to pay for its further development,” Allan explains. “With closed source I wouldn’t run the risk of someone forking the project and thereby making me lose potential income. So it was the safe route.”

And having one person in control of TextMate’s source is not without benefit to its users. “Without someone in control, the coherence of the project tends to fade,” says Allan. “And that would certainly degrade the overall quality.”

Independent Developers and the Mac

Allan is an independent developer — he writes, markets, and sells TextMate himself from his web page. This makes TextMate one in a long line of indie developer success stories on the Mac. Is there anything about the Macintosh platform that makes it particularly well suited to this type of distribution model?

“I think it is just easier to be noticed on the Mac,” says Allan. “Both because the platform is smaller and because Mac users generally show a bigger interest in their platform and those who develop software for it.”

So it’s circumstance only that has led to the Mac’s dominance of this field? Allan shrugs. “For all I know, there could be ten times as many successful independent Windows developers, and there probably are. The Mac platform does however have the advantage that a) users are not scared of paying a little more for quality, and b) there are less commercial players on the platform, so users have a stronger sense of loyalty toward those who do develop for the platform.”

When it comes to getting software into the hands of those users, many indie developers sign up with an online distributor like Kagi to help hawk their wares. Allan has, predictably, found a simpler approach. “Close to all sales are handled by PayPal,” he says.

But simplicity is not without its caveats. “The disadvantage with PayPal is mostly that their checkout page does not make it very clear that no sign-up is required,” warns Allan. “And, in some circles, their bad reputation makes some users reluctant to go through them.”

But for all of that, Allan still thinks PayPal an adequate solution. “I am generally happy with the service. So yes, I would recommend it to other independent developers.”

Of course, if you want your users to pony up the money for your application in the first place, you’re probably going to have to protect it with some sort of registration code. The effectiveness (or lack, thereof) of many such registration schemes when applied to Cocoa has been hotly debated in the Mac programming community. Is Allan worried?

In a word, no. “My only concern is fake serials,” he explains, “since if someone can generate a fake serial, black-listing would only be temporary as a new fake serial would just be generated. For this reason I went with a public/private key based system described here.”

The system Allan details is still vulnerable to binary cracks and leaked serial numbers, but this doesn’t bother him as much as the idea of a serial generator. “I don’t think there are many who voluntarily leak their serial numbers,” he says. “And I don’t care about cracks, because these are hard to obtain, and only work for a single version of the program.”

And what about InputManager hacks and other forms of injection? “Since Cocoa is a superset of C, one can just write the sensitive stuff as C functions, which is not a candidate for run-time patching,” counsels Allan. “Though I do not think that input manager code injection is a real threat, as there are only a few who can and will bother writing these, and no real distribution channels (unlike serial numbers.)”

Today, TextMate is a OS X-only feather in the Macintosh’s cap. But the requests for ports have been pouring in. Will Allan stay loyal to the Mac? It’s not hard to get him to talk about what first drew him to the platform. “A beautiful GUI and knowing that it was UNIX underneath,” he states, simply.

Does that mean TextMate is safe on the Mac? “It is impractical to create a port of TextMate because it relies on a lot of stuff not available on other platforms.” That sounds good! Though he adds with a grin and a wink, “So how strong my Mac loyalty is hasn’t been truly tested yet.”

Ever the pragmatist! The Mac community is lucky to have Allan — for as long as we can keep him.

By webmaster@oreillynet.com (Joshua Scott Emmons). [Mac DevCenter]
comment []4:57:08 PM    

© Copyright 2006 William T Goodall.



Click here to visit the Radio UserLand website.
 


June 2006
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
May   Jul