Monthly Archives: July 2007

OSCON 2007: Domain Specific Languages in Perl

As a programmer who spends most of his time writing code that helps other people to write code, I’m pretty interested in domain specific languages. In fact, I have a couple of modules we use at work that use them. That’s how I ended up in Domain Specific Languages in Perl, presented by Jesse Vincent of Best Practical.

Domain specific languages (DSLs) are languages designed for specific programming tasks. A couple of well-known examples of DSLs are SQL and regular expressions. However, today, Jesse is talking to us about “Englishy” DSLs, which he’s been very interested in lately. Additionally, these are DSLs that are internal to Perl. Instead of parsing a DSL and executing it, they are instead implemented by playing with Perl’s syntax and taking advantage of Perl’s parser (and having all of Perl’s features available in the DSL).

The two main goals when implementing a DSL in Perl are,

  1. Does it feel good?
  2. Can we actually do it?

The first big DSL is Jifty::DBI, an object-relational mapper for Jifty. For the folks at Best Practical, it was a fun learning process in tweaking Perl to look the way they wanted it to while still declaring the database schema in an intuitive, pretty way.

The Template::Declare module is flat-out awesome. I’ve seen it before, and I’ve never taken the time to play with it. How stupid have I been? Coding HTML templates in Perl is cool, and something I would happily do (I don’t really like writing HTML).

As if that weren’t enough, in comes Jifty::Dispatcher. Modelled after Mason’s (auto|d)handler files, it will manipulate web application requests and take care of dispatching processes. I really like the DSL used here. It’s very declarative, removing the infrastructure entirely, which is something I’m very interested in doing in my code right now. I must be getting old; I’m more interested in telling the computer what to do, rather than how to do it, these days.

Testing web sites is ugly, and it sucks. That’s what Test::WWW::Declare is for. It’s a beautiful module. Sessions, flows, declarative statements to define the web flow. So very awesome.

I can tell that the Best Practical folks have seen Damian Conway’s Sufficiently Advanced Technologies talk. The moral of that story is, write what you want to see, and only then figure out how to make it work in Perl.

I’m sold. As soon as I get home, I’m going to work on porting my start-up company’s web site with Jifty. Jifty is, well, absolutely nifty.

At the end, Jesse showed us his own domain specific language to define his slides. It’s awesome. I want it for my own talks.

OSCON 2007: People Hacks

One of the tracks at OSCON this year is people. Everyone thinks that Open Source is about programming, but it’s really about people. People who write Open Source.

Apparently, this the people track is very popular with everyone. This session, People Hacks, is standing room only. Unfortunately, Adam Keys’ slides weren’t able to display on the screen. I think his talk stood on its own. In fact, I wish more talks lacked slides. For most people, they’re a crutch.

People Hacks is about advocacy, moving minds, and organizing teams. It’s a fact of life that no man is an island. We have to work with people, and they won’t always be our friends. Sometimes we want to hit them. Sometimes we talk past them. But we do need to work with them. And we can’t always hit them.

Most of us program because we like logic. We like dealing with machines that are predictable and rational. But we have to deal with people. People who are not always predictable and not always rational.

“There is no man page for humans.”

Truer words were never spoken.

People who are in a good mood are easy to work with. People who are sad or in a down state are difficult to work with (think emo kids—the new blonde jokes!). Get someone to smile. Humor is infectuous. Once people are laughing along with you, they’re easy to bring over to your side. Conversely, negative feelings spread like wildfire. Avoid negativity.

“The ABBA Method.” ABBA is like negativity. A little goes a really long way. When down, go listen to ABBA. How… odd.

Everyone loves a critic (Fox News?), but no one really enjoys criticism. It never goes over well. People take it poorly, they go on the defensive. When people are criticized, they withdraw from the conversation, and no one can move forward. Throw a compliment in. “Kiss their ass before handing it to them.”

Open Source has a love/hate relationship with jerks. We don’t tolerate them at all when they troll forums. However, if they’re a strong personality on an Open Source project, we’ll put up with them. A lot.

Sometimes you’re the jerk. We can all be jerks at times. If you can’t avoid it, at least recognize it and apologize for it.

After a while, the talk turned into a list of patterns of behavior found in people with ways to disarm them. The slides would have helped here, as it’s getting a bit more difficult to follow along.

He highly recommends reading How to Win Friends and Influence People.

And now it’s time for lunch, and I’m hungry, so I’m done.

OSCON 2007: WxPerl

Eric Wilhelm of Scratch Computing taught a session on wxPerl, a set of bindings for GUI development in Perl, which uses the native widget library of each OS to build the GUI. Whenever we build a GUI at work, from a simple dialog box to a complex application, we tend to use Tk. It would be nice to move to a cross-platform, native-looking GUI library.

Why build applications for the desktop? Speed. Network latency over long distances pushes the limits of people’s patience. Computers are getting so powerful, why not use those resources?

Why use Perl? Well, because it’s Perl.

Good documentation for wxPerl is difficult to find. Apparently someone needs to create a US mirror of the wiki. However, the C++ documentation is quite good.

Eric has created a few helper modules (most of which are on the CPAN) to make life for wxPerl developers a bit easier. He’d like to move more in the direction of Smalltalk, with more interaction and cleanliness between the code and the GUI. It’s still in the works.

One thing I really like is his phrase, “needs more Perlin’.” This means that something needs to be more like Perl. That is to say, it needs to keep easy things easy and make hard things possible… with a slick syntax.

OSCON 2007: Thursday Morning Keynotes

It was much easier to attend this morning’s keynotes, since I managed to get a mostly full night of sleep last night.

Ben Fry started off the keynotes with a talk about the Processing Development Environment, which looks very cool. It’s similar in concept to Logo—which leaves a wonderful aftertaste of nostalgia for me—an entire development environment to do visualization, including a domain specific language to allow the programmer to focus on writing what they mean to do, not how to do it. Coincidentally, I’ll be attending a session on domain specific languages later today. He even wrote code on the fly in the environment, in front of the audience which is a very brave thing to do. But, it was an awesome demonstration of how easy yet powerful the environment is. This keynote was quite good, but he had the advantage of presenting something that can produce very fun and cool visualizations. But, isn’t that the whole point of a keynote: to educate, but still entertain? I can’t wait to play with this software.

Next up is Professor Robin Hanson of George Mason University to talk about “Overcoming Bias.” He joked about not having any slides, and being glad he didn’t after the preceding demonstration (how could he possibly top it?). People, obviously, have preconceived notions of just about everything. We think we understand that people are biased, but Robin is here to tell us that it’s much, much worse than we realize. I usually believe that I am aware of my biases, but this keynote made me think that I need to be more vigilant in watching out for my biases and to continuously evaluate them.

The keynote about bias was well timed, because next Nat introduced Bill Hilf of Microsoft by pointing out that it is a company that appears a bit “schizoid” from the outside, but that large companies often have very divergent views on the inside. Bill is here to give us an update on the status of Open Source at Microsoft. Bill joined Microsoft three and a half years ago, to be our man on the inside so to speak. There’s a concept within Microsoft, created by Bill Gates, called Software Darwinism. It’s exactly what it sounds like: survival of the fittest software in a highly competitive environment. Really? I’d hate to see the competition Microsoft Exchange had. Funny anecdote: a new senior programmer at Microsoft once asked if it was okay to visit a Linux web site. The moral of the story appears to be that Microsoft isn’t really evil; that Microsoft really does contribute to Open Source. I’ll believe it when Ballmer and RMS share a stage (am I biased?). Um. Wow. I don’t even know how to respond this oxymoron. Before Bill could run off the stage, Nat jumped up to put him on the spot about patents and Novell. Way to go Nat!

Nat segued into the next speaker, Rick Falkvinge, the founder of the Pirate Party of Sweden, to talk about Copyright Regime vs. Civil Liberties. While this is a very well done keynote, I find it difficult to summarize it better than the title has already done. The message Rick wants to drive home is that the real conflict isn’t the one on the surface, the one about copyright infringement and the loss of revenue. It’s really about loss of privacy. He briefly summarized the platform of the Pirate Party and showed that they have influenced other parties—in Norway. It’s a hard, uphill battle in the United States, unfortunately. Still, this guy is awesome. He’s actively demonstrating the power an upstart political party with decent ideals can have. It also demonstrates the advantage a small party can have in a parliamentary system, versus the system we have in the States.

The last keynote of the morning, Steve Yegge of Google (but not on behalf of Google), was introduced by Nat as a knowledgeable and funny person. A perfect way to cap off a great morning of keynotes. He’s here to tell us “How to Ignore Marketing and Become Irrelevant in Two Easy Steps.” Open Source developers are notorious for ignoring marketing, much to their own detriment. Unfortunately, he got started off with some technical difficulties. The O’Reilly tech couldn’t get his Mac to sync up properly with the projector system. Stupid Macs :-) . Steve immediately questioned how people choose software. Someone in the audience answered, “logic!” We all got a good laugh out of that. Brands are like pointers. They’re a placeholder for a product in our minds. So how are these brands created? I’m not entirely sure he ever explained it beyond, “they just do.” The single biggest branding problem in Open Source is the name “Open Source.” There’s no brand, no association, and no trademark. I must say, I’m impressed. Even without his slides, Steve managed to give us a smooth, entertaining, and educational presentation. That’s the mark of a great speaker, when he doesn’t even need his slides to get his point across.

No Q&A after these keynotes, since we ran long. So we’re done here.

OSCON 2007: SUN CAN HAZ TRISIKLES

I was not at all impressed by Sun’s OpenSolaris party. The only thing it had going for it was it’s location. It was in the parking garage of the DoubleTree, so I didn’t have far to walk when I bailed.

The wait staff couldn’t pour a beer that was anything less than half head, and they were so inefficient that the beer line was always too long to wait in. The plastic racing tricycles (!!) were broken (as if someone couldn’t have seen that coming). There were ping pong balls and paddles, but no ping pong tables.

Overheard at one point: “Well that’s Sun for you. Always promising, never delivering.”

OSCON 2007: Machine Learning Made Easy with Perl

The key lesson of this session, presented by Lino Ramirez, is that it’s all about empowering people. Perl gives us the power to empower people.

I really enjoyed the video of a tae kwon do match as a real-world analog of software development. Try one technique, see the result (get hit); try another technique, see the result (get knocked down); ad infinitum.

There are three phases: preparation, modeling, and implementation. These phases are not linear in nature. One moves between phases as necessary to design the solution.

PDL was demonstrated in the modeling phase. Brad was pretty happy when one of the slides contained a web site address for information on PDL, which happened to be a web server at his job.

As he delved into the case studies, I started to zone out, so I have little to say about his examples of machine learning and Perl in action. I wanted to enjoy this session more, since I’ve often wanted to get back into using neural networks and other machine learning techniques in my code. Unfortunately, I just found it too difficult to follow his case studies. Still, I have some good pointers for packages that will help me sprinkle some machine learning goodness in my code.

I like his conclusion: “Perl excels at empowering people in all three phases of the development of a machine learning application.” Perl is awesome for rapid application development, which in turn gets solutions to people who need them faster.

OSCON 2007: Perl 6 Update

It’s time for that perennial event known as the Perl 6 Update. What will Larry tell us about Perl 6 this year? He probably won’t be announcing a release date (we should be so lucky). Unfortunately, Damian Conway couldn’t be at OSCON this year, so this session won’t be nearly as entertaining as it has been in years past. On the plus side, Larry informs us that Damian did write the slides… now he just has to interpret them.

New features include adverbial typing, such that class and module names can include adverbial modifiers. These specify things like author, authorities, and versions. The syntax is a bit scary, but they can be aliased.

Perl 6 now has inline comments (yay!). It’s typically Perl, too. The syntax is #{inline comment}, instead of the usual C-like syntax.

Wait, what’s this? Built-ins no longer default to using the $_ variable? How will I write confusing code now?

The zipper/yen operator has been renamed to Z. This is good for me, as I’ve never been very good at memorizing Vim’s digraphs.

The min and max operators now have infix versions. Strange at first, but it looks like it could be useful in some situations ($foo min= $bar).

Ranges are really lazy. So lazy they can be unbounded: for $i (1..*)... (to infinity and beyond!).

The power of the new file test operators demonstrate quite well how useful Perl 6 will be. It takes TIMTOWTDI to levels few Perl coders could ever have imagined.

There’s a MAIN subroutine now. It’s like we’ve stepped back 30 years to be C programmers again. The power it gives the programmer to define command line processing is very cool, though. Perl 6 will even call USAGE for you, if you’ve happened to define it.

Perl 6 has real repeat (do..while) loops now. Real, as in all the loop control statements work.

As if postfix control statements weren’t confusing enough. Now they can be nested! say $foo if $bar while $baz. Actually, I can’t tell you how many times I’ve wished for this.

Continuing the theme of parallelism, Perl 6 will make it easy to parallelize map and even do atomic locking on serial statements. I appreciate that Larry managed to change his slide to mirror what Simon Peyton Jones talked about in his keynote this morning. Very apropos.

Fixed-length arrays? Seriously, what is this, Java? Well, at least it allows you to define array bounds as “eh, whatever.” I especially like the “whatever whatevers” operator (**).

POD lists are dramatically cleaned up. Thank goodness. No more =over or =back. Nested lists! Tables! Bigger! More markup! Better! Includes! More awesome! Really! Useful! POD!

Honestly, I can’t wait to move to Perl 6. I can already see a lot of my code getting a lot shorter. Imagine, entire job control systems that fit in one screen of code!

OSCON 2007: DBD::Gofer

Lunch is over and I’m sitting in the first of two mid-afternoon sessions I’ve chosen on Perl technologies. The first one with Tim Bunce, the extremely knowledgeable author of DBI. He’s presenting DBD::Gofer, a stateless proxy driver for DBI.

This session is very much like other sessions I’ve attended. It’s essentially a brain dump of as many features Tim can squeeze into the alloted time as possible. It’s almost too much to follow. It’s certainly too much to take notes. Fortunately, he’s told us the slides will be available on-line.

From the description of the session, I had hoped DBD::Gofer would scratch an itch we have at work. Essentially, we need to ensure data finds its way into a database, even if the database may not be available. We have a custom solution at the moment, but it would be great if we could replace it with a packaged, maintained module. However, it appears that, while DBD::Gofer makes an excellent proxy, it wouldn’t fit our needs.

Examples have included connection pooling and load balancing, often to reduce load on the main database server. It’s apparent from the use cases that this module was developed for use by heavily trafficked web sites (its development was sponsored by Shopzilla.com). It’s design is modular, so perhaps it can be extended to do what we want. I won’t know until I’ve had a chance to look at the distribution.

Some interesting things for the future are HTTP caching and JSON, effectively turning DBI into a web service. This is cool. I can see this opening up a lot of possibilities as more applications are constructed from individual services, complete in their own right.

OSCON 2007: The Expo Floor

Nothing interested me during this morning’s second session slot, so I took the opportunity to check out the vendor booths on the expo floor. I’m sorry to say that I’m pretty disappointed with it this year. Last year (being my first conference) I was excited to go home with so many free t-shirts and even the meager swag that was being given away in return for nothing more than enough personal information to annoy me for the rest of my life.

This year (being my second conference), I lack any real desire to collect t-shirts—not that many vendors have them anyway. Even if I wanted the t-shirts, I don’t want to go to the effort required to swipe my badge (thus handing over my contact information) and listening to a sales representative.

I have no interest in sales pitches. I want to see cool demos. What can this software do for me? No marketing glossies, please.

The fundamental problem with vendors at an Open Source conference is the demographics. The software is generally free. So businesses have adapted to that by selling services instead. I don’t want these services. Whenever I’ve brought these services back to work, no one wants them.

Oddly, the vendor presence I find most fascinating is the New York Times. I couldn’t figure out why they were here, so I asked. They aren’t selling anything (though they are recruiting Open Source talent—good for them!). Instead, they’re showing off how they use Open Source to develop their on-line services. They even have a blog. They’re even running a BOF session on the use of Amazon Web Services, which I will likely attend.

There are a couple of other booths that are worth visiting. Intel looks cool—and is a good friend to Open Source—and OSL is demonstrating the XO-1. I’ll make a few more rounds of the floor to see if my attitude towards the vendors improves.