

Ask HN: I'm a PHP developer, should I learn Rails or Django? - zensavona

I'm a PHP Developer and have used a few different OOP frameworks (Codeigniter, Symfony, FUEL) and CodeIgniter has by far been my favourite (and still my go-to).<p>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?<p>I have played with rails a little, but nothing major, here's what I like:<p>- 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<p>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.<p>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).<p>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).<p>Thanks
======
anthonyb
Why not learn both?

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.

~~~
zensavona
I think I am going to take this approach. Thanks for the advice, all.

~~~
sherjilozair
Maybe, you could tell us about it, when you finish.

------
jamescun
Ideally, you would want something to work on and learn the language best
suited to that, or pick a goal such as "Build iPhone Apps" for example.

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.

~~~
uiri
Don't discount Ruby as just being focused on Rails. I think the only thing
which makes python more general than ruby is that python has a larger
community than ruby does. There are GTK+ and Qt bindings for both languages.
They are very similar languages and I prefer python to ruby solely based on
the larger community around python.

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.

------
LoneWolf
Take this with a grain of salt because I feel I am biased towards PHP but here
it goes.

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.

------
philippb
I think it's great that you want to learn something new. The main question
that I would ask myself is, what adds the most value to my portfolio?

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.

~~~
zensavona
Thanks for the input, and I value the suggestions as they are things that
interest me (I'd love to get into Scala when I have the time).

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.

------
slig
I played with Rails a long time ago and decided to try Django when it hit the
1.0.

You 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.

~~~
zensavona
My friends (co-workers, I don't really have many other technically minded
friends) are pretty much equally split between Django and Rails. They
collaborate between ruby and python camps. I shall give it a go! Thanks!

~~~
alttab
In my experience, rails has a better community and gems are plentiful. Python
is great for certain things, especially larger infrastructures and
applications that run outside of a web request cycle.

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.

------
noeleon
Take something you have coded in PHP and see how easy it is to re-factor in
both languages.

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.

------
cdvonstinkpot
Google: "foo sucks" & see what you can dig up about each language's quirks.

------
stuffihavemade
fyi: webrick (the dev rails server) only needs to be reset for database
changes. Everything else will show up with a refresh.

------
yashchandra
Take a relatively non-complex but not too trivial project that you did in PHP.
Do it in Rails and Django both. See how it feels and then you can possibly
decide. I only work with Python but was not sure between Django and micro-
framework such as Flask. I did a User Management/sign-up application using
both and found Flask to be the right fit for me.

