abstractwankery.com
taking it to the next level
Adventures in Objective-C
Posted by Nick at 1:32 PM
I think that as time goes on, programmers, coders, and hackers tend to get stuck in their ways. Listening to friends and I go on about the latest fad and how horrible it is outlines that fact, and my recent trip to a Perl conferencesolidifies it. In my high school days, I liked to write in three different languages, with varying levels of success -- Visual Basic, C, and Perl. VB was for playing with Windows apps, C was for hacking around with my BBS and attempting to do Mac development, and Perl was for the web. I didn't do a great job of coding at any of the three languages, as I lacked any formal training. They did get the job done, and I had a lot of fun doing it. Once I was employed as a Perl programmer, I effectively re-learned the language, and have been working primarily with Perl ever since. A few of the jobs have afforded me the opportunity to work with other languages, some C and REALbasic at one, some C# at another, PHP and Python at a different one. None of them became my primary languages. Most fell off my radar after I stopped being required to work with them.

A few years ago, I started to become anywhere from dissatisifed to annoyed with Perl, and started a search for my "next language", something I could enjoy programming in as much as I enjoyed Perl. I played with Python for some time, and I also checked out Ruby with the Rails web framework. I knew about PHP enough that I didn't care to deal with it any more than I had to. I actually got a kick out of Python, but lacked any real world application for it to really do something more substantial. I may still head that direction.

As Catalyst, and later Moose started really building up, I started doing more work in Perl again. Moose made OO programming in Perl not only sane, but actually enjoyable. The Catalyst framework made web development structured, easy to deal with, but powerful to work with and quick to deploy. It was hard to go wrong, and I've been on that path since. My only real deviation was finally getting the chance to really learn Java beyond the theoretical by starting with Android development, and releasing my first Android application, ElJay.

In a sick sort of way, Java really clicked for me. Sure, it takes 10x the lines of code to do the same thing as I'd do elsewhere, but the great threading architecture and the strict typing really turned my crank. Unfortunately, writing Java applications generally means that your app is slow and ugly on every platform, instead of at least having one good one. Android, at least, provides an obvious foundation for Java applications, screwing up that rule.

My latest round of experiments have been using Objective-C. The most common application of that language is as the primary language of Mac OS X and iPhone, using Apple's Cocoa framework. I've been hanging out mostly in the basic CoreFoundation framework using command line tasks, and really enjoying the message sending features, obvious and straightforward OO implementation, and the raw speed of a natively compiled application. My 'big project' is investigating how realistic writing a web application framework in Objective-C would be. How 'realistic' it is can be a challenge to define, but I see it as a few separate things.

* How easy is it to generate a basic framework, similar to the core of Catalyst, that can respond to FastCGI requests quickly?
* How easy is it to extend it to multiple engines, and the opportunity to plug in other models and views?
* How easy is it for the end developer to then write an application against this framework?
* How many developers would be willing to write web applications in a strict typed environment?

I've managed to get through the first and half of the second bulletpoints. I now have a loadable framework that can be plugged into an application that allows basic dispatching of pathnames to a controller via FastCGI, plugged into Apache. The FastCGI component is actually loaded as an engine, and a basic CGI engine is also available. Engines are an abstract class that acts as a simple API, and one could theoretically write ISAPI or other types of connection engines into it. Models and views are not done yet, the controller is just spitting out HTML. I know, I know, that's a big no-no. That comes soon.

Numbers three and four are a little fuzzier. If I take the idea that a lot of newer developers are easily able to create new applications for the iPhone, one would say that Objective-C is not a terribly difficult language to pick up. In fact, the hard piece of just about any language is not the language itself but the framework. Java is easy. Android makes it tougher. Objective-C is easy. Cocoa makes it tougher. In that same vein, a developer may be willing to write a web app in ObjC as long as the framework itself makes it easy for them to do so. If I also add the idea that enterprise developers are now writing web applications in Java and C#, I can't see a reason that another strictly typed language would be an issue. I think the main issue that would need to be overcome is making it easy for people to add new components to the system. Perl has CPAN, Ruby has Gems, and while having something generic for Objective-C may not be appropriate, something specific to the framework just might be. If I follow a similar design pattern as Catalyst, it starts to make more sense. For instance, there are a few ORM systems that are available as C, C++, or ObjC libraries. One would not need to care about grabbing this generic-orm component, but somebody would certainly want an already assembled library for interfacing this web framework with that generic-orm (a la Catalyst::Model::DBIC::Schema).

Anyway, that was a long introduction and explanation to show you that, yes, it's starting to actually work. :)
(click to enlarge)
0 comments
Speaking at Frozen Perl 2010
Posted by Nick at 3:43 PM
I just did my first talk -- ever -- at Frozen Perl 2010, on DBIx::Class in the Real World. Unfortunately, I realized after the talk was accepted just how much content I wanted to go over, so there's a lot of stuff left to talk about.

For those who were there, thank you for dealing with me, and here are the slides. Feel free to contact me if you have any questions, comments, or concerns, and I'll try to help the best that I can.

For those who weren't there, carry on, there's nothing to see here.
0 comments
Releasing Products
Posted by Nick at 8:20 PM
It's such a rush to finally release a long-running project.

My primary full time work involves contracting to a large company in the healthcare field. After nearly twenty months of stop and start work, and then a few months of 100% work, we finally released a fully rewritten site this evening. Is it everything we wanted? No. Are there large pieces that I don't like about it? Sure.

Did we finally do it?

Yes.

Sweet.

(Yes, of course the site is written in Perl. We're using DBIx::Class, Template Toolkit and a custom mod_perl framework over Apache2 and MySQL.)
1 comment
The greatest perl5 evangelism talk I've heard
Posted by Nick at 7:19 AM
mst from Shadowcat Systems does a rant at the Nordic Perl Workshop about Perl5 and raising awareness. I'm not sure if I have the stamina to participate in the "Ironman" competition, but it certainly fires me up.
1 comment
I hate you, Apple.
Posted by Nick at 7:54 PM
So, I installed Apple's Security Update 2009-001 yesterday, and tried to work on one of my Catalyst sites tonight. I got this fantastic error:

IO object version 1.22 does not match bootstrap parameter 1.23 at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/XSLoader.pm line 94.


I head over to CPAN to update a few modules, and same error message with a stacktrace of doom. So, turns out, Apple distributed IO.bundle from way the hell back in 2005, which is what broke all of your other modules that you already updated if you use CPAN for anything at all. But hey, now CPAN is broken, so what now? You get to do a manual install, luckily, CPAN is an archive. Head over to the IO distribution over at CPAN, download the archive, and head into ye olde Terminal. Extract the archive if it hasn't already, enter the directory, and execute:
perl Makefile.PL && make && sudo make install


Ding, everything works again. Write an angry letter to Apple.

Edit: You may find more crap that doesn't work. For instance:

Weak references are not implemented in the version of perl at /Library/Perl/5.8.8/Catalyst.pm line 24


Well, just head into your now-functional CPAN and execute:

force install Scalar::Util


Bam, you made it spicy.
3 comments
i(Phone|Pod) SDK Updates
Posted by Nick at 11:52 AM
Looks like we're starting to get an idea together for the new Cocoa Touch platform. Stay tuned. :)

In other news, the www.whatthefuck.com relaunch has been going really well. Some old timers have come back, and the site is more stable than it ever has been. The speed is still up to snuff too, even though we're using a platform far more abstracted than the original. The original was self rolled Perl, embedded HTML, no CGI.pm, no templating, self-created cookies, the whole shebang. The new system is using the Catalyst Framework as the core, with DBIx::Class for database abstraction, Template Toolkit for the viewable HTML and XML, and utility processes using the Moose OO Framework for Perl. I'm quite happy with the result, with the manageability and maintainability, and the speed I get through FastCGI on Apache.

I've started doing a call out to users on new features and suggestions. From the latest list I put out, I think that after the first half is complete, I'll be ready to do a full launch of the site and start getting the word out.

Oh, and I fixed commenting on the blog. Sorry about that.
0 comments
Perl 5.10.0 Release
Posted by Nick at 2:23 PM
For those who managed to miss it, Perl 5.10.0 was released to CPAN today. This is going to be so cool.

If anything, Moose is now faster, and defined-or is awesome.
1 comment
Movable Type 4
Posted by Nick at 7:04 PM
I upgraded the blog to the newest Movable Type 4 beta, and you're seeing it live now. Let me know if you run into any difficulties.

My first impression is "oh my god, this is really nice!" I've been shopping around for a new blogging tool as MT has been irritating me in a lot of ways, especially since WordPress has been gaining momentum. I couldn't bring myself to install a PHP blog tool, not to mention the fact that this server has a legacy PHP4 installation due to once of the web sites hosted on the machine.

The spam controls are now included out of the box, the editing system is now completely sane, and the whole thing is much easier to navigate. More later, as I have a chance to play with it.
0 comments
The Comeback of a Language
Posted by Nick at 9:16 PM
Not sure what was going on with me this morning, but I think I was trying to pick a fight in #catalyst this morning. I was at work all of about ten minutes before I asked a simple question, amounting to: "Are there any plans to bring Catalyst to a wider audience?" Confusion followed, followed by a decent discussion. The general point I was trying to make is simple. If you ask someone who works near web development if they've ever heard of Ruby on Rails, chances are, they have. If you ask them about Catalyst, you'll usually end up with a shrug. Those who are willing to listen further generally stop listening as soon as you say "framework for perl".

There is a stigma attached to perl for various reasons -- people view perl as unreadable, or slow, or hard to develop in on a large scale. Most people have a perception of perl that dates back to the late 90's, coding against cgi-lib.pl or CGI.pm. Hell, back then, I was rolling my own CGI scripts so they were 'lightweight'. God forbid anyone look at my code from back then. Perl was pushed as a rapid-development, but hacky language, and most people produced a lot of code that looked like line noise or otherwise, and that is what is burned into people's minds. There is an unfortunate percentage of the current perl population that still writes kludgy one script wonders and calls it a web application, and that's also bad for the community, in my opinion. Frankly, a language that holds contests on who can make the most unreadable code, or who can fit the most into one line, generally deserves that stigma.

The other side of the coin is Perl 6, the upcoming complete rewrite of Perl. If you Google for perl 6, you'll find articles talking about its impending release dating back to 2001, yet we still don't have a final revision. The bytecode interpreter is far from complete, and the closest thing there is to a working, usable interpreter is written in Haskell, another higher level language. The whole thing feels kludgy and incomplete to an outsider, and that's probably because compared to other modern object oriented languages like Ruby and Python, Perl 6 is kludgy and incomplete.

So, disillusionment and wankery abounds when it comes to perl, and a lot of it is deserved. It's a perception problem, and one that is almost impossible to solve. But, hell, I'm stubborn, and other people have made far inferior products rise from the ashes.

Those who remember a few years back realize that not many people were aware of or used Ruby before Rails came out, and a lot of old perl hands fell right into Ruby because of its similarities. I find Ruby to go against 'what I mean', so it's a reach when I start pounding out any code. I was hoping to find an alternative when I stumbled upon Catalyst, and I've been hooked since. I think quite a few people would see the same thing, if they only knew what was there.

My plea to #catalyst was simple. Catalyst is a diamond in the rough, a flexible, fast, and powerful web application framework that is very easy to use once you get over the first learning curve. It is an excellent demonstration of modern OO perl development, despite any flaws or issues that still remain in the framework. The problem, however, is there is very little marketing or outreach happening, and without any kind of constant public opinion, the userbase stagnates and eventually shrinks, leaving frameworks like Catalyst to die on the vine. Someone within the Catalyst community, or even tangentally related to the Catalyst community needs to find a way to bring people back into the perl fold by making them aware of the strengths of the framework.

A few things would need to happen, in no particular order. Note that this is only my opinion, and I'd be happy to be told I was wrong.

  • They want their wiki moved from Trac to MojoMojo before they do any major wiki work. Fine, I'll give that one.

  • Get some nice looking skeletons into the default Catalyst project template. Make it look pretty. For some reason, this actually works, and makes people want to do the same.

  • Catalyst's primary development happens on mailing lists and on IRC. This should be outlined somehow within the wiki so creep doesn't occur.

  • The primary focus of catalystframework.org should be marketing and outreach -- a bulletproof example of the stability and scalability of an application written in the framework, with easy to deal with tutorials and a complete set of hyperlinked documentation. Links should be given to external sites who use the framework, as well as third party Catalyst tutorial sites.

  • There needs to be a third party tutorial and development site! You can toot your own horn, but it's hard to convince people that what you have works really well unless they can see other people getting together and doing things really well. The real championing of OS X doesn't happen on apple.com, so the real championing of Catalyst shouldn't be on catalystframework.org. Luckily, it's not, as the site is a bore and makes the project look dead, as it is hardly updated.

  • Along with the third party site comes some community support. Bring people together. Show people to IRC, bring people to a forum. Get a forum of a couple of hundred and hold CatalystConf or something similar. The key to getting the product into the eyes of many is to show people that there is an active following behind it. Lesser languages and frameworks do it and give people confidence to continue developing. Check out Lasso and REALbasic if you have no idea what I mean.

  • Tell people you're using Catalyst. If you run a site that is truly great, and starting to get public attention, mention the framework. The Rails apps are doing it. The PHP people just try to hide that it's PHP behind it.



I'm not talking about zealotry, here. I'm not talking about Catalyst being the best or brightest, or that perl is the best or the brightest. I'm not talking about how Ruby, Python, or PHP suck (this time). I'm only talking about bringing a really great language and a fantastic framework into the foreground so people are at least aware of the options before they talk some smack.

Or maybe, just maybe, I'm completely full of it.
1 comment
Yet Another IRC Bot: whatbot
Posted by Nick at 3:22 PM
Forgive my long absence, been so busy with work and other projects that I haven't really taken the time to update. I really need to find a better way to remedy that.

For now, though, the homegrown project of 'gheibot' has, erm, "matured" into whatbot. Designed as our IRC channel's replacement for infobot, we're looking to expand its appeal and get a few more eyes on it as it actually starts working. It's currently written in OO perl5, on top of Net::IRC, and communicates with SQLite, PostgreSQL, and MySQL. Designed to be rather IO and database agnostic, in theory, it can be adapted to protocols such as AIM, or other databases such as BDB or Microsoft SQL Server.

As of right now, there is a basic extension system, and attempts to duplicate the basic learning and karma capabilities of infobot. Needless to say, it has a while to go.
1 comment