Blog posts tagged "patterns"

Session “Flash” in PHP

December 7th, 2005

Doing some PHP hacking tonight, I was missing Rails’ “flash”. So I coded up a quick and dirty implementation of the read-once session status notification pattern. The code

Tagged: Uncategorized , , , ,

As Seen in the Inbox

November 30th, 2005

my eastern reversible destiny; ebullient barnacle turkey y propitious zeiss novice, coverlet upsilon mausoleum remiss optoelectronic emblematic irritant sesame morphology. ambrosia shim grunt switchblade filigree gait amino caleb duration budge embargoes allied

Random gibberish, and yet 100,000 years of pattern matching expertise refuses to let it go that easily, finding primordial poetry, and humor.

Has anyone wondered what the extreme, cut throat Darwinian pressure of the spam wars might be evolving?

And what kind of AI could such a crucible produce I wonder? Vicious and deceptive? Slippery, polymorphic and rentless? Recent samples seem to suggest a cryptic, Delphian source of Zen koans.

Tagged: Uncategorized , , ,

MySQL, and the CASE for Class Table Inheritance

August 14th, 2004

At work we’re using Class Table Inheritance to model the core data structures of our as yet nameless open source CRM. (actually it has a code name, but I don’t like it, so we’ll pretend it’s nameless)

This week as I learned both the name of this pattern, and the SQL to implement it efficiently in MySQL I thought I’d share some notes on what we’ve come up with.

Read the rest of this entry »

Tagged: Uncategorized , , , , , , , , ,

Grooving Up Slowly

March 17th, 2004

I finally made it a SeaJUG meeting last night, Ted Leung speaking on Groovy proved to be an irresistible draw (and I was in town for once). This was also my first venture across the 520 bridge, into deepest, darkest suburbia (Bellevue). Wilhelm and Ted took pity on my carless state, and were great company

SeaJUG is a great group; smart, friendly, and intellectually curious. There are several vibrant subgroups including a Scheme group, a GoF study group, a regular language agnostic pair programming night, and a new Eclipse group (first meeting is first Tuesday in April, and I’ll be out of town, bah). I can also see that it would be an intimidating group to present to, especially bullshit, and this was confirmed by quiet evil laughter describing their last vendor visit.

Groovy

Groovy has fascinated me since I first heard of it. I’m a dedicated “scripting” language hacker. Life is too short, and there are too many interesting problems to solve to slave away in the service of the compiler. And yet I’ve definitely felt the pull for more rigor and structure at times (generally when I was having to work with someone else’s code). Much of Perl works by consensus, I agree to call a method just so, and you agree not to muck with my internal variables (or the symbol table). Java works by locks (and shotguns, according to Larry Wall). Groovy provides a gradient, I can be as dynamic, and loose, and experimental as I want, or as locked down and precise, and I can change my mind, over time, about which way to go.

Groovy is a Java compatible, dynamic language, built on the JVM. You can pare it down to something it will make a Perl programmer pause (no classes, no methods, objects defined at runtime as closures, no semicolons), or add structure, type declarations, and all sorts of baggage all the way up to Java itself. Code can be run interactively, or can be compiled to Java bytecode. (one wag even suggested you could write Groovy, compile, and then use a decompiler to get your Java code. This is not recommended)

The Groovy developers have done a lot of work adding the syntactic sugar which makes scripting languages fun. Primitives are auto-boxed, and collections have been instrumented with a variety of useful methods that will make your functional programmers feel right at home. They’ve also been building some powerful domain specific constructs for operating on tree structures (XML/Ant/GUI widgets), building web pages (as ugly as PHP on a bad day, should make it popular!), and marshalling data into and out a relational DB. And lastly they address the other thing life is too short for, reinventing the wheel (especially as they seem to get more square each time). Because Groovy is compiling down to Java bytecode you have total, native access to many many high quality Java libraries.

See Ted’s slides. (understanding of closures is highly recommended)

Would I Use It?

Not this month. Not next month either. The syntax is still somewhat influx (if you’re a language hacker, that makes now a great time to get involved), and there were part which seemed either undefined or ambigous never a good thing in a programming language. There also feels like there has been a lack of discipline, too many special cases in the syntax, and a sense that the designers are kids in a candy shop running amok borrowing syntax from all their favorite languages. Still I’m excited about it. Its about 6 months old. I think 6 more months will tell us how successful its going to be.

Ted

Ted is as smart, interesting, and informed as you would expect him to be reading his blog. He kept his cool in the face of hardware trouble, and a large contingent of the audience who weren’t buying it. As Ted said, “to fully buy into Groovy, you have to buy into some assumptions about how software should be developed, which is philosophical bordering on religious.” He is talking about agile software development, which I occasionally forget still has its detractors, and its unintiated.

Rabble Rousing

He ended by addressing the fact that much of programming is mechanical, and that far from happening accidentally, or improving over time this trend is getting worse. With top heavy, byzantine architectures like EJB, or the ever deepening W3C XML stack, you see the work of the large technology vendors who are interested in keeping entry difficult, work rote (and therefore cheaply offshore-able), and profits up. As he ended with “the big corporations are going to solve this for you, we need to solve this for ourselves” I had a brief moment of cognitive dissonance as my worlds collided and I couldn’t remember if I was at an anti-globalization meeting, or a software users group. This is the sort of stuff people should at least bring up at the next CATS meeting.

Chandler

It was fascinating to get an inside update on Chandler, a project I’ve watched with fascination since its early days. (Thankfully I’ve got a job I’m very happy with, and so I didn’t have to embarrass myself by pumping him for contacts as the OSAF.) I’m looking forward to Mitch Kapor’s keynote at next week’s PyCon (not that I’ll be attending)

Mixins

And he addressed the problem I’ve always had with mixins. (recently reinvented by the AOP crowd apparently as “static cross cutting”) You see when I hear mixins the first thing I think about (or the second, after I think about too many late nights struggling with Mailman) is ice cream from Herrell’s. Herrell’s is a Boston (and Northampton) ice cream shop that will pound your ice cream out flat, mix all sorts of wonderful things into it, and roll it up again. Turns out that that is the origin of the term. Back when it was Steve’s and the MIT hackers were working on the original Lisp machine. Wow.

Tagged: Uncategorized , , , , , ,

Web Development with Perl.

September 10th, 2002

In preparation for doing the Protest.net re-write I’m doing some research on web frameworks. I find myself rewriting the same central dispatcher code, adding refinements, like a redirect method (similiar to the forward() method in servlets) and in general missing some of the refinements of Java’s web environments (servlets, Struts, bundles for i18n) while refusing to give up Perl, CPAN, and Template Toolkit.

This is my brain dump so far. Lots of questions, a few answers. The next step will be firing up the text editor and looking under the hood.

Steal from the Best

Applications I’m going to examine for ideas to steal, particularily framework ideas (error handling, inner loop, etc.)

  • Moveable Type – in my few glaces at the code its seemed intelligent, and well structured. Runs under mod_perl and CGI, handles some complex UI demands like pages that use redirects to update progress bars, and re-entrant forms.
  • Bricolage – based on Mason, I’ve been hearing good things about this CMS, particular about its clever Burners abstraction, hope to find other good things under the hood. Don’t really know much about Mason, not sure if that is going to be barrier
  • RT – popular, mod_perl and Mason, ticket tracking software. Also supports email, and command line interfaces.
  • Scoop – haven’t looked at Scoop in a while, but I remember it seemed well done (having just come from looking at Slashcode 1.0), I wonder if it will stand the test of time. Not expecting to find anything all that relevant, but maybe. Will probably do a quick skim of the CMS parade: Slash, Everything2, and maybe LiveJournal. Definitely want to look at LiveJournal’s embedding instructions.
  • ?? Do you any Perl web applications you would consider examples of best practices??

Perl Frameworks

  • OpenInteract seems popular, and uses TT2, but leaves me cold, partially because I’m just not crazy about persistence layers. But I should probably spend some time looking at it. ?? Any expirences using it ??
  • Mason natively uses an embedded, page based execution model, which seems PHP-like to me, but Design Issues with Mason: What are Components For? seems to be simple guidelines for avoiding the siren calls. There is an Oreilly book coming out on it, which will be available online, but the author says, don’t expect it until mid-October.
  • Wombat is billed as an implementation of the Servlet API in Perl, but I can find exactly zero reference to anyone using it, never a good sign.
  • AxKit is a web framework built along the lines of Cocoon. I bet there are seriously cool ideas to steal in there, but I’ve been burned pretty badly playing with XSLT and don’t want to go back into that water right now.
  • OpenFrame also seems interesting. It has the request and response objects ala servlets, and acme is being paid to work on it, and it has a “Slot” concept which seems similiar to Brico’s Burner concept, and supports TT2. However it bills itself as an “open source application framework for distributed media applications.” Which isn’t really what we are building.
  • A few others are listed at Application Servers and Toolkits based on modperl. Also, Web Frameworks and their Template Engines is interesting.
  • Last time I was looking at this stuff there was JellyBean, which no longer seems maintained, and Iadio, which no longer exists.
  • I found a simple home-rolled framework that feels simliar to the one I did for Rockwood. It was mentioned in this interesting thread.
  • The book, Perl for the Web from New Riders, is freely available online and seems interesting if out of date.

Piecemealing with Modules

UPDATE: After looking at the available options, and at Struts 1.1, I would go with Java if I didn’t know I would have an insurrection on my hands.

Tagged: Uncategorized , , , , , ,