One small leap

I was reading Gavin King’s spec preview for web beans and started thinking, I should implement something like this in perl or php. Yeah, I know, crazy. I started thinking more about it.

JBoss Seam has a lot of good points. But a lot of baggage that comes from Java frameworks. A lot of that baggage comes from java, from static variable typing, from it’s automatic garbage collector. Reference counting and shared nothing statelessness, or apache MPMs (thinking perl modules, remember for a while, create at leisure, destroy at leisure statefulness) have a lot to say for it (them) in terms of stupid memory management. And I’m stupid.

I started thinking about using Python, because lists are great, remembering GNUEnterprise code that was very clean. But mod_perl beckons. Why can’t there be good Apache Modules. Maybe a master server (Apache) launching a pool of custom python or ruby servers (fastCGI) with application state is the way to go.

Anyway, I started thinking simpler. I know I don’t want to implement a complex J2EE spec. But a few crumbs of goodness would be nice. Like, for instance, a payment handler annotation. Or a data transfer annotation. Admit it, we all love DTOs, because it really is the right way to do things. ORM tools create DTOs, they’re just more complex, slow, and imprecise.

The beauty of Ruby on Rails is in ActiveRecord, but it’s just too inflexible. You end up hand coding anyway, and fighting it and start thinking about designing your DB as a collection of rows of objects. And then start iterating to search. Bad!

But a good DTO can be a poor man’s stored procedure and ORM. But who wants to maintain it. Now, of course a framework to do alot of the heavy lifting, and another one to only load the code you need is nice too, but we can start with a simple annotation. I know this isn’t revolutionary, but what if you added annotations to PHP? A quick search finds I’m not the first to think of this.

Really, DTOs aren’t specifically what I had in mind, but they’d be the most popular, and easiest to implement (naively.) But what got me going was the idea of @RequestScoped, @SessionScoped, @ApplicationScoped, @ConversationScoped (would this be a cross-application transaction) — those would be really nice. A simple include, and annotations, and your PHP Web HaX0r becomes an enterprise developer overnight. And Session scopes can be interchanged.

I know this is the path of madness Java went down, but really, a take it or leave it approach, and keeping it simple could really improve the quality of a lot of PHP code out there.

SCA_SDO looks promising, but too complex, too correct.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s