Ask HN: django vs php: a hard choice
I am currently a php developer so I know my way around php and I'm able to make the application I have in mind without any problems. But I'm also very interested in django, a relatively new thing for me but it sure does look promising and worth my time to invest further.
I tend to choose php because I know it, I know it is well supported, it scales without large problems, I can configure it and optimize it without a problem.
While django is very fast in terms of development time, it's a challenge, probably good for my career if I can add django/python developer to my CV and it has a great community.
But I have doubts for choosing django... For starters, I don't know if it's 'economical' to choose django in terms of performance. Does django beat pure php in complex sites pageviews? In other words, do I have to scale faster with django then with php? Will I be able to find additional programmers if my website becomes a success? I live in Europe and I don't have the impression django/python developers are common here (prove me wrong!). How is the support going to be? I'm always surprised to see very old php4 code runs fine on the newest php5 release, but I heard djando changes quite often and you have to re-write code if you want to use a newer release.
Like I said, I don't have any real-world experience with django, so I'd like your advice/thoughts on this.
27 comments
[ 3.4 ms ] story [ 70.2 ms ] thread- Don't worry about scaling problems - if you have scaling problems you have a succes already. 99% of startups unfortunately never get to have scaling problems.
- The main focus should be to get the killer-webapp up and running, not getting a CV or trying out a new technology. Starting a company is in itself a huge challenge. No need to add to the risk by trying to do it in a language you're not familiar with. If you're good at PHP stick with it.
Just my two cents...
Where in Europe are you from btw?
You should try it for a small test site. Either you will like it or you won't. IMO, scaling problems in web apps are a application design issue, not a technology issue. JM2C.
django is a framework, and PHP is a language. You should be comparing django to CakePHP (or whatever) or PHP to Python.
Assuming the latter, having gone from C++ to VB (pre-.com) to ASP to PHP to Ruby (briefly) to Python, I really prefer python as a language.
I think mixmax's advice though should be heeded.
They may be different, but the choice is not orthogonal: you can't choose to use django and php for the same piece of code.
It has MVC architecture, is decently fast, and has an active community behind it.
Good luck either way!
- Don't worry about scaling, like mixmax said.
- The main focus should be to get the killer-webapp up and running, not getting a CV or trying out new technology. However, you don't have to step far outside the PHP communities to see people shitting on PHP everywhere.
If PHP is the only thing you know, do yourself a favour and widen your horizons. Not necessarily for this particular project, but because when the time comes, and you are getting fed up with PHP's shortcomings, at least you know there is a way out.
Me, myself? I'm a heavily invested C#/.Net developer, but prior to that I have worked with Atmel AVR Assembly, Motorola 68k assembly, Basic, Pascal, Python, Arexx, C, VHDL, Verilog, LabView, Matlab, Java and god knows what. Oh, and yes, PHP.
I may stick to C#, but I know there is another world out there. So should you.
You might want to look at the recetn django articles
http://jeffcroft.com/blog/2008/jul/25/top-ten-things-suck-ab...
http://42topics.com/blog/2008/04/five-things-i-hate-about-dj...
http://justin.harmonize.fm/index.php/2008/09/django-round-2/
It's certainly a good skill to have from an employment point of view - the Django job market has exploded over the past year, see http://www.djangogigs.com/
Python is a nicer language than PHP, and Django is a nice framework. If you already have knowledge of php then you can probably get your app running faster with a php framework such as Symfony.
Then stick with it.
And, reiterating what some of the other posters have said, don't worry about the scaling. A well designed app in PHP or Django or Java or Rails (Twitter failed because of its flawed design...not because Rails sucks) or whatever else will scale.
If however, you have the dual goals of getting your site up and running and also learning new and better technology that has the possibility of making you more effective in the future (initial development on your current project will be slower, but it will pay off in the long run), then go with Django... Or Rails... I'm a recovering PHP-aholic, who's moving onto Ruby, so I just had to put that in.
Good luck.
For my current RAD project, the client has their own IT staff who don't want to support another environment, so it was back to PHP. On Rasmus' good words, I tried using the CodeIgniter framework (never used a pre-existing PHP framework before) but ran into pain with its many kludges to support PHP 4. Then found Kohana, which is CodeIgniter rebuilt for PHP 5 only. I'm lovin' it.
I was all gung-ho for server-side JS, but Kohana combined with my own ORM is going very nicely. (I don't know about Kohana's ORM--I started working on mine before I had decided to use any framework.) The biggest benefits, of course, are that it runs most everywhere and my long experience with PHP prevents the odd surprises I was always running into with the JS frameworks.
And, hey, first class functions and closure are coming in PHP 5.3!
So the grass isn't always greener--it seems what I was missing was a better way of organizing my code as much as straight language power. So try a good PHP framework--I recommend Kohana. And even though python and js are more powerful languages, having a whole bunch of stuff already built for you and ready to run anywhere beats power and a clean room most of the time.
PHP 5.3. is exciting stuff yet my worry is that most PHP code monkeys will not give it's feature set a second glance. On a unrelated note I've been working with HaXe to produce PHP apps. So far I'm LOVIN it! Do give it a try.
Of course most people won't get into the PHP 5.3 features, but I'm not going to lose sleep over it.
And HaXe... I've been thinking about it for a long time, but I always end up thinking no. What's the web framework and view/template story there? It doesn't appeal for writing client-side JS b/c there I have jQuery, and I very much doubt HaXe would end up easier to write.
Thankfully my day job consists of me hacking in CI (which is a Godsend) but my current passion lies in HaXe. So if anything try out other languages to expand your mind. But if you don't have the time and luxury and you want to get that killer app up and running. You might as well stick to your main competency and slug it out in PHP.
If you're a PHP guy and know, as you said, that you can get this out fast and well in PHP then definitely don't try killing yourself to produce it in Python atop Django.
However, if you're truly interested (and you've got the time! which you don't!) in Python then give it a go as Django is a marvelous framework. You'll probably also find that you prefer Python as a language as you become more familiar with it.
PHP or Python? and Framework or homebrew?
If you switch from PHP to Python and things don't work out, you'll blame Python. I'd stick with PHP.
If you use a framework and it doesn't work out you can just code away from the framework. I'd go with Zend Framework. It takes some effort to learn the router stuff, but never seeing another url that ends with .php is worth it on it's own.
Good luck!
But all advice is quite pointless -- suppose you decide not to try out Django. Without actually realizing how it works, you will always have lingering doubts about whether it would have served your purpose better.
A lot of people don't understand the difference between Flash and Flex. There is a large overlap in functionality, but a big difference also. Should I use Fs or Fx? Without actually using it for a bit, you can't tell.
It's like going to a restaurant and seeing somebody eating something. They look happy eating it, but you don't know if it fits your own appetite unless you try it yourself :)
But - I always come back to PHP (and the wonderful CodeIgniter framework) when I actually need to get something accomplished. I know it like the back of my hand and I don't care what any of you say about the other languages and frameworks - I could not develop my applications anywhere near as quickly as I could in PHP.
Yes, some of those frameworks are designed for rapid development - once you know the parent language! I say find a powerful framework for PHP designed for rapid development and stick with what you know. Play with Python and Ruby on your own time.
1. Django is quite difficult to learn. You'll waste a month or two getting into the framework
2. You will NOT find developers to work on Django, and the ones you do will be VERY expensive
3. Once you know Django well, you'll find that there is not that much of a faster development cycle than PHP, unless you are doing something newspaper related. For newspaper related sites, there are shortcuts, but for everything else, it's pretty much the same routine
4. Hosting for django is expensive. On a $10 a month host, a PHP site will run fast. For Django you need to get a $100 virtual server. Big difference.
5. Django does very little PR, so the language seems to be cooling off in terms of visibility. This means - less applications, less snippets, few books. It's becoming a bit of an elitist culture, which sucks big time
6. The IRC channel is becoming like the C++ channel. Snobby and condenscating.
Recently, a person I know decided to rewrite his entire Django app in Rails because he could not find any developer for his Django app.
It's not a hard choice. Go with PHP.
1. Django is NOT difficult to learn, in fact I found it very intuitive and easy.
2. This is definitely improving - more and more django developers all the time.
3. Django may have started at a newspaper, but there is nothing newspaper specific about the framework design. Sure there may be middleware modules with newspaper related functionality - but you don't need to install them!
4. WRONG! webfaction.com has great service and easy django hosting for under $10.00 and Django installs with one click!
5. How many books do you need to figure it out? I have a dozen Django books - most of them really good. But I still get most of my Django information online.
6. Well, is it really true or just a reflection?
It's not a hard choice - if you like working with great tools and a great language go with Python/Django; If you hire someone else to do it for you go with whatever makes sense for hiring and the economics of software development.