Original URL: http://www.theregister.co.uk/2009/07/03/lamson/
Lamson - email app coding without the palm sweat
Doing what Java never did
"Can you integrate this with my e-mail?" It's one of the more dreaded questions in software development. For any programmer who has been around the block a few times, it evokes a long repressed fear of Sendmail m4 macros or Outlook COM objects. When a non-technical managerial type asks this question in a group meeting, and your boss assures him that Internal System from Hell X can easily be integrated with the company's e-mail system, your palms sweat.
As a development platform, e-mail has gone neglected for decades. Its esoteric implementation details and specifications are regarded by many in the IT business as voodoo, best left to old-granddad programs like Sendmail or Postfix. Zed Shaw hopes to change that with his new project, Lamson. (The name Lamson is a throwback to the early 20th century pneumatic tubes used to shuttle messages between offices. It was originally called Son of Sam, but Zed's dog convinced him to change it).
Developers in the Ruby on Rails community will remember Zed as the author of the Mongrel server, which gained popularity for being the first Rails production server for grown-ups. Zed started the Lamson project after struggling to set up an e-mail list, which on its face seems like an easy task. However, old code that everyone is afraid to touch, such as e-mail list servers, has the tendency to make anything you want to do outside of the most basic example damn near impossible.
"After banging my head on something as simple as a single list for some friends I realized that this crap hadn't changed since I last used it 10+ years ago," he tells The Reg.
"I then got thinking about how it should work, and realized that doing an email application should be like every other modern application we build today. There should be a simple start for a developer, clear documentation, a framework, a modern language, well defined protocols, commented code, and you should be able to extend it without painful configuration. You know, a lot like Django, Rails, or Cocoa, .NET, or just about any other platform today."
With Lamson, writing an application that centers around e-mail becomes a painless exercise. Anyone familiar with modern web application development will understand the idioms: Lamson uses finite state machines to keep track of users' interactions with the application, templating to generate message text, and makes it easy to use what you know about Model-View-Controller development to write your e-mail app. All safely contained within the confines of Python, it protects you from having to rusty-hatchet your way through some ghastly XML configuration file for an enterprise messaging library whose name prominently contains the letter "J."
Indeed, the Java world has taken a stab at e-mail, but has failed miserably.
"They didn't provide a full stack or try to clean things up. They missed out on the idea of providing a modern server and a modern framework for using the server. I think that's probably just how Java guys did things back then," Zed explains.
Lamson actually tackles the problem of e-mail development being hard, instead of taking the pathological attitude of the Java community to leave everything as an exercise to the reader.
A good example is an e-mail list. A user subscribes by sending a message to email@example.com, expressing his interest in joining a list for men who prefer the comfort and style of ladies' underwear. The list server then sends back a confirmation message to which this gentleman must reply. After a successful reply, he is free to discuss silk vs. cotton with his brethren. This interaction can be modeled by a state transition diagram, which I'm sure you will remember from computer science class. A user transitions from START to PENDING to POSTING, depending on how he has interacted with the system. Lamson applications make heavy use of finite state machines and allow you to program them in a silky soft, Pythonic way.
Now, that's a clean example of the type of application Lamson encourages. The dirty example is spam, of course. Perhaps some of the greatest minds on e-mail specifications and programming have devoted their lives to selling penis pills, weight loss pills, and pyramid scams. It's possible that a framework like Lamson already exists in the discount Viagra underground, but is considered a competitive advantage, so it stays under wraps. Even so, Lamson will make it very easy for spammers to track their victims' interactions with the campaigns, but that may actually be a net positive for the internet.
As Zed explains, "I totally think Lamson will be used more for spam than for anything really useful. My hope with Lamson is that it acts like a modern sewage system for the internet. Everyone's gotta poop. You can't escape it, so why not try to do it in a clean fashion that improves the general health of everyone involved?
He adds: "With Lamson, you have a simple system for either blocking or sending spam, but more importantly for doing it in a modern high quality smart way. Rather than blasting out billions of junk ads nobody wants, I'm hoping that smart spammers will become "marketers" and start sending clean advertisement to people who might actually want it."
With easier stateful e-mail programming, it's possible that spammers will concentrate more on conversion rates than number of impressions. If that's possible, it may also be possible to convince them that you can get a cheap and quick buzz by inhaling the fumes released when you mix ammonia and bleach. Hey, a man can dream.
Either that or you can use it to integrate your company's helpdesk system with e-mail. Take your pick.
You can visit the Lamson Project home page here. ®