Routing v0.2 Released

I’ve released a new version of Routing v0.2.1. This update resolves issues with the route preferences and correctly prioritizes static routes. The internal route decisions are now handled by a scoring system. There are still a few bugs, but Routing is fast moving toward something usable.

Head over here to grab the latest version. I also wrote some documentation this evening for you to examine!

No comments.

PHP Routing

If you’ve ever written web applications in Python using Pylons or TurboGears (>=1.1), you’re probably familiar with an incredibly handy tool known as Routes. It’s modeled after the Ruby on Rails routes system and does quite a marvelous job at mapping friendly, SEO URLs to useful code. If you’re not aware of it, you really should check it out.

However, I was curious to see if it were possible to create a Routes-inspired PHP library that would perform essentially the same task. I’m sure there’s an already-written PHP routes system, and I’ve allowed myself to fall into the not invented here trap. But, that’s part of the fun in coding: If you don’t like what someone else wrote or you want to give it a hand yourself, no one is stopping you. It’s great.

Thus, I’ve written Routing, the PHP routes system. It’s similar in syntax and intent to Python Routes with the exception that it’s PHPized (in other words: bastardized). If you read the sources, you might be able to see a little Python influence here and there (along with my frustrations toward PHP as a language vented in silence). I wouldn’t recommend it as anything short of entertainment as yet; I haven’t cleaned up the sources, and I expect they’re going to be really messy for a little while. The route search mechanism is awful, and I plan on refactoring it in a future revision. For now, the system works, and that’s good enough. (That’s my INTJ side talking.)

So, if you’re curious enough to take a look, head over to the Routing Trac page. I have some downloads posted there in a variety of formats (.zip, .tar.gz, and .tar.bz2). There’s no API documentation yet. I’m going to add it soon. Since Routing was born on Wednesday, August 5th, 2009 it’s quite young. However, I have some preliminary unit tests written (also incomplete) that you can read to get a general understanding of how Routing works. If you’re more interested in the principle behind Routing, you might want to read the documentation for Python Routes. Routes and Routing work roughly the same with the exception that Routing, unlike Python Routes, is extraordinarily buggy. I hope I can evolve this into something of an acceptable sibling to Routes but that will take time and a whole lot of effort. I have a few additional ideas, too.

1 comment.

PHP: Things that Annoy Me

It seems that nearly everyone who has dabbled to one extreme or another in PHP has a few gripes related to the language’s ad hoc design. It isn’t a very elegant language, nor is it well-suited to much outside the world of web applications. What it does do it does reasonably well, and its bar of entry is low enough that even novices can have a working site up and running with some dynamic components here and there within a few days of playing with sample code. Unlike more complicated frameworks of the Java, Python, or Ruby worlds, PHP requires little–if any–knowledge of common design patterns and practices. For better or for worse it’s a language that grew out of a set of utilities and still retains much of this feel–and design.

The volume of “PHP annoys me” articles have blossomed tremendously over the years. I think this is partially the result that those of us who essentially “grew up” with the language are now discovering with increasing frustration that the very things which made the language easy to use are what cause it (or more appropriately us) so much grief.

I’d like to contribute a little to beating this particular dead horse. Maybe it’s not quite dead yet.

Ahh, how I could make a Monty Python reference out of that!

Update, June 21, 2009 If you like this article, you might be interested in this site. Read more…

No comments.