Which to use: PHP, Django, Rails or something else?
November 23, 2008 10:53 AM   Subscribe

What programming language or framework should I use for my simple Web database project?

Here's my project: taking a database of local property assessment data and posting it, searchably and sortably, onto a usable public Web site. Ideally with goodies like a mobile-friendly version, links to Google Maps and so forth.

I want to do this, in part, because I want to learn skills that'll be useful in future public-facing Web projects.

I know HTML and can wrangle PHP about as well as I could speak Spanish after two years in high school. I messed around a little with Django back in 2006, but didn't seem to have the basic programming vocabulary that its creators assumed.

I've been running a couple Wordpress blogs off a Dreamhost server for a couple years, so the hosting is lined up.

There's no deadline, but I'm giving myself one week to work on this full-time.

Right now, I'm thinking of either:

- doing it all in PHP/MySQL (the boring and perhaps sloppy option)
- diving into Django again (the dogged option)
- trying to learn Rails, like the friends keep telling me (the A.D.D./ambitious option)

My questions:

- Are Django and Rails way too overpowered for this project?
- At this point, is Django looking like a dead end? Should I be investing my framework-learning energy in the broader Rails community?
- Should I be considering some other option altogether, such as Drupal?
posted by teracloth to Computers & Internet (11 answers total) 5 users marked this as a favorite
Since you claim (above) to lack "basic programming vocabulary" perhaps you should take this as an opportunity to hammer down a solid understanding of one language.

I would actually recommend you avoid ANY framework for this project. A framework doesn't enable a system -- it just makes it easier. But anything you could do with a framework you could also do without.

Develop it in straight PHP .... then when you have some time port it to something else as a learning opportunity.

Ruby/php/python can all do what you want no sweat.
posted by SirStan at 11:00 AM on November 23, 2008

I'll second SirStan's suggestion. If you don't know a programming language, learning a framework is something that can wait. If you know a little PHP, that's the way to go. Once you know PHP pretty thoroughly, it will be fairly trivial to learn Python or Ruby, and you can investigate frameworks when you feel you need to use a framework to lessen the amount of repetitive work you're doing.
posted by me & my monkey at 11:20 AM on November 23, 2008

If you do it in PHP -- you can avoid the "sloppiness" by not writing procedural code. Make sure that you are defining everything as objects, and use a templating engine (smarty). If your index.php, or any other 'page' is more than 10 lines, your doing it wrong :).
posted by SirStan at 11:35 AM on November 23, 2008

Best answer: I did some of the same research not too long ago and my conclusion was that Django wasn't dead at all, rather RoR was loosing steam. PHP is still going strong, but as you mentioned, it's kind of the sloppy choice.

In my opinion, PHP is a sort of patchwork language that has evolved to meet the needs of just about anything you want to do in web development. It's not pretty, but it's supported everywhere, easy to use, easy to learn and capable. Perhaps the biggest downside with PHP is that it allows you as a programmer to use sloppy practices to get results. And this sloppy code leads to difficulty in expanding and maintaining code later.

That said, PHP can also be used with good practices and produce fairly clean code. The creator of the website cdbaby.com had a long blog entry about how he jumped on the RoR bandwagon early and devoted over a year to redesigning his site after hiring a core rails developer to work with him full time. They failed to rebuild the site in rails because the framework was too strict and even after all the modifications by the core developer, they still couldn't make it do what they wanted. So he went back to PHP and redesigned the whole site using the better programming principles he learned in the process like DRY and MVC and had the whole thing done in something like 3 months.

I'm currently working with Django instead of PHP because I decided that I wanted to learn a solid and beautiful language that is Python. And I'll have to tell you that it's been difficult for me. The principles of the strongly OO Python are not difficult. And the syntax is elegant and easier than anything I've ever worked with. But Django as a framework abstracts the core language so much that there are many levels of logic separating your goal from the core processes that go on in the background. And this can sometimes be challenging to work with.

I'm sometimes having a very hard time discovering the necessary methods to get the results I want in Django. I'm confident that in time the framework will make me a much faster web developer for my future projects. But for now, the learning curve has reduced my productivity to almost a standstill. I spend days reading tutorials and playing with practice code instead of working on my own project. And I know that if I used PHP which I am already somewhat experienced with, I would have long been done with the project I'm currently only a fifth of the way through.

I tried to use RoR before going to Django. I was very frustrated with the number of changes that seemed to make every book on the subject full of errors by the time it was published. I also found web hosting support for Rails to be difficult and expensive. Though I think that if you have friends currently using Rails (or Django for that matter as it suffers somewhat from the same hosting support trouble), you will find it easier to navigate the tricky business of getting started. And $15 a month is a small price to pay if you save time programming. But will you?

Django seemed like a better option to me because it's far more flexible than Rails seems to be. It isn't "opinionated" and part of the core philosophy of it is to keep functional areas of the framework interoperable, but not bound to each other. You can use custom logic anywhere you want if the built in tools don't do exactly as you like. Also Google is (starting with) only supporting Python as the programming language for it's new App Engine service. Django can be used there, though they push for their own "framework" To me that's a huge vote of confidence for Python and also Django as a framework that they support out of popularity.

To me it seems to come down to the question of what you plan to do after this site is built. Are you going to continue to develop websites on a more or less full time basis? Or is it a hobby like thing that you do when you have an idea? I think it's worth learning more complicated languages only if you will use them often enough to get past the learning curve they demand. And don't forget practice. How much Spanish do you remember a few years later if you don't use it often?
posted by davathar at 11:41 AM on November 23, 2008 [4 favorites]

Response by poster: Thoughtful answers.

I guess the first three of you have nailed me: almost everything I read suggests that I shouldn't be bothering with a framework until I'm fully fluent in a basic language. (Though in my defense, SirStan, I didn't know PHP at all when I retreated from Django in 2006.) Davathar, I don't expect to do programming anything close to full time, so your advice is well-taken.

My basic reason for wanting to learn a framework is not that I want to save time myself, but that I want a more intuitive understanding of how frameworks COULD save time for a real programmer.

For now, I'm leaning toward SirStan's advice: do PHP right.
posted by teracloth at 12:17 PM on November 23, 2008

Python is probably my favorite language, so I'm tempted to recommend that. However, there's a huge amount of momentum behind the Ruby/Rails platform right now. And Ruby is a nice little language. PHP is great for cobbling stuff together—particularly if you already know the language—but if you're going to spend some time learning the quirks of a new language and it's libraries, I'd say to go with Rails. The little I've played with it, Rails (and Ruby) seems to be a very rational, sensibly designed system. I couldn't say that about PHP.
posted by paulg at 12:24 PM on November 23, 2008

I'd actually suggest doing it in plain Python (that is, no Django, just some simple cgi and html libraries). Or PHP for that matter. Then, write version two with Django. Having done it once the easy-at-first-hard-in-the-long-run way, you'll have a better understanding of what Django is trying to do for you.
posted by hattifattener at 2:50 PM on November 23, 2008

I agree with the advice above that you need to do something once in the worse way possible and then your next project can adhere to the framework. Since you have done PHP perhaps PHP done right would be a good fit. The only downside with that is that PHP makes it so easy to fall into bad habits.

That's why I have been reasonably pleased with Django as I have picked up for my latest project that I have been working on. I personally found Django to be easier to understand than Rails (but I am biased since I know Python better than Rails and generally like the Python syntax better than Ruby). To me, the Rails abstractions make it harder to understand what is going on under the covers whereas the all configuration is code approach of Django is mega sweet and cool.
posted by mmascolino at 2:54 PM on November 23, 2008

For now, I'm leaning toward SirStan's advice: do PHP right.

In that case, definitely look at the Zend Framework. It's loose requirements allow you to choose to implement "best practices" or not, and it's internal structure is very elegant and clean... which helps you keep your code the same.
posted by SpecialK at 3:44 PM on November 23, 2008

My advice when starting a new project in an unfamiliar environment: plan on throwing away your first attempt. Programming is a wicked problem; you'll need to develop a partial solution in order to really understand what it is you have to do. Once you've developed something that sort-of works, you should know enough to start over and do it correctly.
posted by SPrintF at 6:33 PM on November 23, 2008

Have a look at the showmedo site. I found the "Learn Django: create a wiki in 20 minutes" video to be a real eye-opener.
posted by aroberge at 6:54 PM on November 23, 2008 [2 favorites]

« Older Different names for the same place across...   |   Help me find some two-year-old cool. Newer »
This thread is closed to new comments.