Framework fetish and rants on SolarPHP, Django, and Python

I’ve been looking at more frameworks — I know, it’s a problem. Including an in depth look at Joomla and a peek at SolarPHP, including a look at YAWP, Savant, PDO.I’m not going to use Solar, but a day spent looking at it is a day wasted. A quick criticism: It’s too “magical”, requires too much memorization, has tons of errors in it’s documentation.

I wish there was an easy way to submit errata or make changes. The SolarPHP manual is a wiki (which supposedly gives them an excuse to prevent page navigation), but normal users can’t edit it (which is fine), but there should be a workflow to propose changes — that’s a problem with wikis in general, no workflow, but it goes counter to the wiki “philosophy” which is silly.

Solar has a very obtuse system. While someone familiar with Rails-like applications can figure it out (with the help of the documentation and some guesswork — because the documentation includes things like mis-named files that cause opaque error messages. Every error you make will produce an exception with the exact same text:

“Exception encountered in the fetch() method. in Solar.php line 363”

and the stack trace doesn’t even mention your application code at all.

While Rails had an unusual configuration system, it had reasonable defaults, that were fairly easy to learn. Every framework that imitates Rails and adopts convention over configuration has the problem that it’s not Rails. The further you stray from Rails the more users will be frustrated when it diverges. Corollarily(?), the closer you hew to Rails, the more frustrated you’ll be when it (often unexpectedly — read: undocumentedly) diverges. I don’t want to learn a new “convention over configuration” for every framework.

SolarPHP’s ORM sucks, too. While I didn’t look into enough to say how much it sucks, it’s a rule that anything that copies hibernate sucks, and suffers the same problem as Rails imitators. The more it diverges from Hibernate’s syntax (even if it’s an improvement), the worse it is. And I’ve a hunch that Solar’s ORM isn’t nearly powerful or flexible enough to justify it. I categorically refuse to learn another ORM syntax.

SolarPHP’s templating is unimpressive, it’s MVC file layout is uninspired (and non-standard), it’s authentication is inadequate, it’s localization is simplistic (but works — on the otherhand, how hard is a string substitution?) In short, it didn’t really bring anything that appealed to me, while giving enough frustrations (mainly with the documentation) and annoyances (mainly because of differences with my knowledge of existing frameworks) to put me off.

I can’t believe it, but it seems to not even have a scaffolding script to help you learn (or not need to learn) it’s file layout structure.

Anyway, I’ve distilled some requirements out of the experience. I think a good framework should:

  1. Get out of the way
  2. Be obvious about what it’s doing
  3. Leverage existing knowledge and techniques
  4. Help write better code by:
    1. Making code simpler, less verbose
    2. Help me stay organized
    3. Help me avoid shooting myself in the foot
  5. Allow hacks when needed

I’ll post more on that later.

I’m not trying to hate on SolarPHP. It’s bearing the brunt of my accumulated dissatisfaction with frameworks. I mentioned before that the only ones that have really excited me (since Rails) are Wicket and CodeIgniter. The former runs on Java, which in my book makes it only suitable for intranets or large (read: managed by a full time sysadmin) sites. The latter is too simplistic by just a little bit. It could actually benefit from a bit more magic, and things like authentication and ajax left as an exercise for the user. Which is fine, especially if you were going to build everything from scratch (or from Zend / eZ) yourself anyway.

One framework I haven’t looked at, but (to spread the hate around) I’m sure I wouldn’t like is Django. That’s just from the general impression I’ve gotten by crowdsurfing the intermemeoshere. I’m sure Lawrence, Kansas is a nice town and all, but building a CMS for a small community newspaper isn’t exactly brain surgery. Chicago crime is way cool, but that’s just showing off Google web services with a neat idea. It could’ve been done in VBscript and it would have been just as cool.

My impression is that Django consists of the core team marketing it plus a bunch of people who thing Python is cooler than Ruby. The one thing python has over ruby is a halfway decent Apache module. And I do mean halfway. At that end of the spectrum (near the very bottom) speed, is not a deciding factor. I think python’s syntax is silly, though like almost everyone else, I thought tuples as a type were cool. You can get the practical benefits of that in PHP nowadays with list() — which I think is prettier syntax.

To all the PHP haters out there whose only arguments are “it’s possible to write code that has a SQL injection vulnerabily” and “I don’t like (or understand) some of the function names”, I don’t want to hear it. PHP isn’t the best language in the world, get over it. But it’s got a better syntax (and object model) than Python.

Do you know what “def” means? It means “define function”. Defining a function with part of the word “define” is empirically uglier than with the word “function” and less fun than abbreviating it “fun.” Mandatory underscores, bad keywords and yes that horrible white space delimiter are enough to make me not want to use python.

If you don’t like PHP function names, it’s probably because you never learned C. Hint: the 3 or so example functions that hurt people’s tender sensibilities in every “I hate PHP” rant are direct transcriptions of functions used to write your favorite scripting language, which was written in C and I almost guarantee it has the dreaded strpos(), strlen(), et al, buried in it’s source code.

The fact that every rant on PHP contains complaints about the same functions as a usenet post from 1997 shows that they don’t really have their own opinion on it.

And don’t get me started on “self”. Python’s bolted on objects may be better than Perl’s but that’s not saying anything at all. One thing that appealed to me about Python was that you could take more control of your request lifecyle — what I really liked about mod_perl, but it turns out that building it all into index.php is both faster and more stable.

But I’ll probably check out Django, and learn from it too. I’m sure I’ll find things I like and things I hate, and things I hadn’t thought of. Do I think it’ll have that “killer feature” that will make me want to switch? No, but I’ll still enjoy it. I enjoy Python, I just don’t like it’s syntax. And all other things being equal (which they practically are), I’d rather use PHP’s syntax, and put up with it’s shortcomings.

I did like my time studying SolarPHP, even if I don’t want to use it. I learned some interesting things with dependency injection in PHP that I could never pull off myself. And as much as I maligned it’s ORM, I could never build something like it — and even if I could, I’m sure someone would hate my API.

Whew! This turned out to be quite a rant, and with any luck, I’ll draw vultures, both for and against. Which is something I definitely don’t want. I’m well aware that your average script kiddie can kick techno-sand in my puny face, and the only reason I feel comfortable ranting is because I’m sure no one more nerd-savvy than my mom will read this post. But with the way search engines work these days, my little flicker of ill-informed self-commentary will probably draw moths and rangers with buckets of techno-water to douse my fragile ego.

Maybe I should get some adwords up before the bonfire starts.

I’ll post what I really wanted to, next.


7 thoughts on “Framework fetish and rants on SolarPHP, Django, and Python

  1. Pingback: The Ideal framework « Fiji Ecuador Seattle Greece Montana

  2. Pingback: Need to reign in blogs « ONE SHORE INC

  3. Pingback: Next steps « Building

  4. I can’t believe how stupid and immature some of your points are:

    “It could’ve been done in VBscript and it would have been just as cool”.

    then unbelievably you go onto say:

    “And as much as I maligned it’s ORM, I could never build something like it — and even if I could, I’m sure someone would hate my API”

    RIGHT AFTER you’ve just called Django’s efforts a “CMS for a small community newspaper” – jesus, get a clue! You’re entitled to an opinion of course, but FFS just get some facts before you vomit FUD all over yourself.

    Approve this comment – your clients and employers will probably want to see it.

  5. Why would anyone want to see your comment?

    I could have been wrong. I don’t know everything, and I admitted I don’t know much about Django. Chicagocrime is still cool, and could still have been done with Perl CGI. So there! I thought I’d throw in a little more immaturity.

    If I didn’t use google and wikipedia to see if I’d offended the author of Django or at least a resident of Kansas (just the other day, I inadvertantly offended the author of Canoo Web Test, but it was just a typo, I swear), I would have responded directly to you in email, but apparently I offended the fan of an actor I’ve never heard of who lives in England.

    I’m sure Django works fine for you. A fansite is an excellent candidate for a CMS framework. And I hope you get your website back up soon. Sorry that was just a little bit more immaturity. I’ve had my share of outages.

    I’m curious how you found my pathetic blog, though. Apart from the owners of products I ignorantly lambast who find it by looking for every mention of their own project on technorati or somewhere (and I assume my posts would be near the bottom), the only traffic I seem to get is from people who have trouble installing Bugzilla or ImageMagick or something like that.

    I promise to try and post a little more accurately, or at least less incendiarily. Because you’re right, potential clients or employers might get the wrong impression, that I’m some two bit Hani Suleiman, Marc Fleury, Theo de Raadt, or Zed Shaw wannabe, and I’m nowhere near talented enough to pull that kind of attitude and get away with it.

    On the odd chance though that someone traces your own comments on my (apparently increasingly popular) blog, you might want to up the maturity on your posts yourself. But if I were in a position to hire, I wouldn’t judge you on it, and would try not to let your taste in cinema affect my decision either.

    (He’s one of my favorites. Check out the Trinity movies if you like a good spaghetti western comedy.)

  6. By the way, your domain is available. Maybe I’ll register and post a bunch of messages on blogs from talking about how cool and insightful fijiaaron is. And I’ll put up a website, maybe even using TurboGears.

    Sadly, seems to be already taken. Which might also be evidence that my favorite actor is cooler than yours.

    I have way to much time on my hands.

Leave a Reply

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

You are commenting using your 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