Live data from Hacker News

Ask HN: PHP & Python/Ruby?

news.ycombinator.com

1–10 of 32 posts

Ask HN: PHP & Python/Ruby?

#1
I'm decently proficient in PHP. I chose it initially because it was easy to learn and (very easy) to deploy.

I just finished a series of small web projects, and am looking to start something more ambitious. Before I do, I want to reevaluate my choice of language: should I switch to python or ruby?

Let's say I would switch to ruby...

1) How much more productive/efficient would it make my coding?

2) How hard and expensive (relatively) would it be to deploy?

3) Why shouldn't I switch?

4) Other major ruby advantages?

And finally, how should I go about the transition if its worth making the jump to ruby/python?

Re: Ask HN: PHP & Python/Ruby?

#2
This is fairly even. I would take a look at each and decide which style you like better.

In general... ruby there are many ways to do things ( bit of a perl influence there ), python tends towards one sanctioned way to do things. That is a horrible overstatement but somewhat true.

I would advise you to send a few days with each and see which seems more natural. I prefer ruby w/ its blocks and more smalltalk and lisp-ish feel to things but I did python programming for a number of years and you will be fine learning either.

You should switch from php even if you go back to php to learn something new and expand your knowledge AND don't stop there, keep learning and go father afield later. Pick a functional language like scheme, clojure, haskell etc and learn that. Get up and cozy w/ smalltalk for some serious OO learning. Spend sometime with Erlang. Never stop switching what you use to learn even if you keep going back to other things to pay your bills- Java, Perl & C++ payed by bill for 7 years but during that time I learned Dylan, Smalltalk, Scheme, Python & several more.. each one I learned made me a better programmer.

Re: Ask HN: PHP & Python/Ruby?

#4
I originally learned web development through LAMP. I boosted my proficiency when I learned to program in MVC via codeigniter and kohanaphp.

Then I learned Ruby on Rails.

Kohana and codeigniter set up an MVC environment much like Ruby on rails does. The biggest difference for me is that if you look at kohana, you see how much effort it takes to get PHP to act in a way that Ruby does natively.

Kohana sets up PHP so you have access to all sorts of nifty methods by accessing the system Kohana classes and helpers. In ruby, everything is an object.

So long story short, I find DSL's in PHP try very hard to emulate how Ruby already behaves. So I prefer Ruby frameworks like sinatra and Rails.

Re: Ask HN: PHP & Python/Ruby?

#5
If you DO decide to switch from PHP to Ruby on Rails make sure to get very familiar with Ruby before you dive into Rails, otherwise learning rails will be very frustrating. You can also try out Sinatra before Rails. Sinatra is a great lightweight framework that I've been using extensively. It is awesome. http://www.sinatrarb.com/

Regarding whether or not to switch I will say this: you can build whatever you want with either language. The big reason you should switch is the fun and challenge of learning something new. Both languages/frameworks have their advantages and disadvantages. You will be LESS productive if you switch languages at first because you will be new and will have to learn the 'ruby way of doing things'. Eventually you may end up more productive in the long run, but productivity is influenced by so many factors and language/framework is just one of them.

Regarding deployment, Heroku (free for small apps) is a good option for if you don't want to deal with deployment much. Linode ($20/mo minimum) is great if you need to do anything fancy and/or want to have root access to your deployment environment.

http://railstutorial.org is the best rails tutorial I've seen

Good Luck!

Re: Ask HN: PHP & Python/Ruby?

#6
I was in your boat 3 years ago. I decided on Ruby on Rails and am very fortunate I made that decision. It's really not as much about efficiency, productivity, expense, etc. as it is enjoyment of working in a language/framework that's highly elegant. Learning Ruby on Rails (or Python/Django) will far outweigh productivity gains for your first project. However, it will be worth it in the end.

For me, it mostly comes down to the fact that there's almost always an easy answer for questions in Rails. Pagination? Sorting? AJAX? There's usually a "Best" way too, that makes it easy in deciding which library/plugin to choose.

Re: Ask HN: PHP & Python/Ruby?

#7
I have to recommend ruby if only for Ruby Version Manager and bundler. Ruby also has multiline lambdas (code blocks). Python only has single line lambdas.

Disclosure: I've been using ruby (and rails) for 2 years and I am absolutely addicted to it.

Re: Ask HN: PHP & Python/Ruby?

#9
Either Python or Ruby will put you in good hands -- I suspect Ruby is probably better overall if web development is your main focus, but I have to admit that I prefer Python, just due to its amazing infrastructure (scipy / numpy, SAGE, NLTK, so on and so forth). Spend a couple of days working through tutorials in either language, and then just pick one or the other based on your gut; you really can't go wrong and you can always learn the other one later. Linode is what I recommend to set up Python hosting, but it means you have to get your hands a bit dirty with installing packages and the like, which you may or may not be interested in doing. You can also just download Virtualbox and set up a VM locally and experiment for free.

Re: Ask HN: PHP & Python/Ruby?

#10
post #5

If you DO decide to switch from PHP to Ruby on Rails make sure to get very familiar with Ruby before you dive into Rails, otherwise learning rails will be very frustrating. You can also try out Sinatra before Rails. Sinatra is a great lightweight framework that I've been using extensively. It is awesome. http://www.sinatrarb.com/ Regarding whether or not to switch I will say this: you can build whatever you want with…

+1 on railstutorial.org. Great site.
Post reply on HN