Ask HN: I'm a PHP developer, should I learn Rails or Django?
I am definitely seeing the benefits of learning Ruby (rails) or Pyrhon (Django) and my programmer buddies argue their framework/language of choice into the ground. Can someone who has used both give me some more objective advice?
I have played with rails a little, but nothing major, here's what I like:
- rubygems is awesome, this is how (code) package management should be - seamless MVC, although I use MVC principles in PHP, it still feels clunky - lots of learning resources from what I can see - high level language = rapid development
What I don't like: - very high level language, PHP seems to be somewhat the 'C' of web languages these days. - I feel like there is a magic box between my code and the browser and often have no idea what makes certain things work and other not. - very different syntax, I am used to C style languages (Obj C, C++, PHP) - the webserver which comes with rails needs to be restarted to acknowledge changes - I like that I can hit cmd+s, refresh my browser and see changes in PHP.
All I really know about Django is that ALL of the people I know who use it absolutely love it and swear by it (much like Mac owners).
I'm a web developer for a small tech company, I build medium sized web apps and have a large amount of creative/technology freedom over my projects. I'm 19 and have been using PHP for the past 5 years or so, it has been the only (web) language I have used to build anything non-trivial (although my brief stint with Rails taught me much about MVC and how it should be implemented).
Thanks
17 comments
[ 2.1 ms ] story [ 35.3 ms ] threadYou have one really good argument for going with Django: your friends use it. You can ask them tips, talk about it, and they certainly help you in the right direction.
Aside from that, I recommend you to try the Django tutorial, shouldn't take you more than a couple of hours https://docs.djangoproject.com/en/dev/intro/tutorial01/
Also, the small webserver bundled with Django will restart automatically whenever you change a file.
Rails, once learned, is so fucking fast at developing applications it should be illegal.
Right tool for the right job, for sure. Generally, rails works great for web apps and is releasing versions faster than companies can keep up with it.
I highly recommend rails. Django code base is a mess the last time I looked at it and rails has more industry cred and can get you out of client work and into product development easier. Just my experience anyway.
Ruby is a fun language and Rails is, essentially, its killer app. Programming Rails apps means learning a lot of conventions, a lot of "the right way" to do things. It's not just code style, but about good software engineering practices -- testing, database migrations, and multiple environments are all built in and easy to use. There are also some tremendous environment and deployment tools out there. RVM and bundler make dependencies easy to manage, and HAML greatly cleans up the HTML side of things. As mentioned elsewhere, Rails development can be really fast once you've got up to speed, but that can take time and cause serious headaches for anyone who walks into maintaining an existing reasonably complex project.
I love Python and use it all the time. It does have a bit of a problem with legacy libraries moving to Python 3, Django being one of them (if you want to try Django, use Python 2.7). Django was built for a newspaper website, as such it has some slightly odd conventions that can be confusing at first. Notably it makes the distinction between an app (reusable piece of functionality) and a site (comprising one or more apps). It has a strict template engine (by default), that has its own DSL which requires some getting used to. Django generates a lot less files than Rails by default, and generally feels more compact. It also has a really nice admin feature out of the box.
How much value does another similar backend language give?
My thoughts on this would be: Not to much. I would rather look for something that makes you a more interesting engineer. You could e.g. learn to make android apps. That would make you a quite valuable person being able to code mobile frontend and a backend service. Or a backend language/framework that is far different and let's you solve problems that you run into with PHP on high traffic websites. Some companies started using Scala for high performance parts of their service. Or get a good understanding of Apache Lucene a search engine.
But something that is more different from PHP and will make you a more interesting engineer.
I guess I should have been clearer, I am specifically looking into Rails/Django because what I do primarily is build web apps. I feel like I am reaching a plateau of productivity with PHP because of it's nature and my ruby/python toting peers are far ahead while only using this tech for 1-2 years max.
I am getting the feeling that Rails is going to be the best match for what I am looking for, mainly because of the huge library of gems.
Again, thanks for the input though.
If I had to give my opinion between Ruby or Python; I would say Python, as it is multi-disciplinary. Python can be used for everything from website to high performance computing and have great communities backing them up allowing you to be a more fluid and interesting engineer; Whereas Ruby (and its defacto framework, Rails) tends to be geared towards just web development. Just my 2 cents.
Re: Rails vs Django; I prefer Django because of the magic box complaint you have with Rails. I don't really feel that with Django although, of course, YMMV.
Pick a small(ish) project and go at it in both frameworks. You've said that you have friends who know both, and you've already got a handle on web dev through PHP, so maybe Rails one weekend, and Django the next. Now you know which one you like the best, rather than relying on other peoples' opinions.
There are no downsides to knowing all of these web frameworks, eventually you will find yourself in a position where company X only wants Ruby, or company Y only writes python.
Python while a nice language that I have tried, I absolutely hate the indentation, I hate to have to write code and care about its indentation, I prefer to write my code without caring about it and let my editor format it for me when I'm done or need to read it.
As for Ruby while I can't talk much about the language, the comunity itself kind of scares me, I have the idea that they are some sort of zealots who attack anyone that doesn't use Ruby. (sorry Ruby guys that's the feeling I have), the little I know about the language is that I don't like the syntax much but I am a C like syntax lover.
Now for PHP one of my loved languages (Java and C++ are others), I like the syntax, I like to have braces on my code makes it easy for me to read, but I guess on how much you are used to it, there are some nice libraries too, but some are heavy (Zend is one of them, does a lot but it's heavy), a lot of things that I do are done in PHP, while it may not be the fastest code running, it's one of the fastest to write.
Once again beware, this reflects my way of viewing the languages.