Live data from Hacker News

Ask HN: PHP & Python/Ruby?

news.ycombinator.com

11–20 of 32 posts

Re: Ask HN: PHP & Python/Ruby?

#11
post #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…

I wish I could upvote this more times.

I love Kohana, and I'm looking forward to learning Ruby/Rails this year. I have a few small projects lined up to work on while learning, which should be pretty fun, too.

Re: Ask HN: PHP & Python/Ruby?

#12
I can only speak for Ruby - it's what I chose when I moved from PHO development several years ago.

1. I am much more productive in Ruby than I ever was in PHP because the language is more consistent and testing is built in. But it takes a long time to understand Ruby so that you can be proficient.

2. it's not hard nor expensive anymore. Dreamhost hosts Rails applications just like PHP apps. Linode.com has VPS setups and scripts to get you going. Heroku is free for small apps. Worry about building something deployable first, and then tackle deployment.

3. You shouldn't switch if you can't take the short-term productivity hit. You're not going to be as productive in Ruby right off the bat because it's new. My interns all agree that the first two weeks of Ruby with me are pretty rough, (80 hours or so) but after that they take off. But it takes a lot longer to program Ruby like Ruby and not like PHP.

4. My opinion will get in the way here, and a lot of the really cool stuff isn't really for beginners. But I am so happy I have the tools I need to accomplish the crazy tasks I've gotten myself into.

5. RailsTutorial.org is a great start - the pdf is free. Also, I run RailsMentors.org - maybe you can find someone there willing to guide you. However, be prepared to come with questions and do some work. Also, find a local user group and hang out. A lot of Ruby people love to help you get started as long as you're willing to put forth the effort.

Feel free to ping me with questions. bphogan on twitter.

Best of luck.

Re: Ask HN: PHP & Python/Ruby?

#13

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.

I've been using ruby (and rails)... I am absolutely addicted to it.

This experience is pretty common. I think that says a lot.

Re: Ask HN: PHP & Python/Ruby?

#14
I think Rails is much more stable. The Python frameworks seem to release more often (for me, at least). Ruby also has good libraries for web specific purposes, Python has more overall. For example, a website might release an API and a wrapper for Ruby, Python, and Java. However, an obscure project might have an official Python wrapper but not a Ruby wrapper.

Re: Ask HN: PHP & Python/Ruby?

#15
post #3

Don't compare languages, compare frameworks, and don't ask us, do the tutorials.

This was down voted but it brings up valid a point. There are a lot of posts asking which language the OP should learn. It's redundant and very subjective. Yet at the same time people love their languages, their religion, what helps them wake up in the morning and so these posts are very popular.

Re: Ask HN: PHP & Python/Ruby?

#16
1. That depends a lot on you, and it goes without saying that you won't likely be more productive on your first project or two while you're still learning the language and libraries. Web frameworks in general try to do some of the work for you. Rails, in particular takes a lot of the busy work out of writing a "typical" web app. I think I'm probably twice as productive on a big project with Rails than with bare PHP. I haven't used any PHP frameworks.

2. There's a bit of a tradeoff between ease of deployment and cost. Specialized hosting services like Heroku are very easy, but can get pricey, especially as you scale. Setting up and running your own VPS can be very cheap[0], but requires learning basic *nix server administration. You should probably learn that anyway, as a web developer, but it does add to the barrier to entry.

3. Switching could be a distraction from actually getting stuff done. You can expect a significant drop in productivity as you learn, especially if PHP is the only language you know. There's a lot of new stuff in Ruby, and Rails has a decent-size API. You may also want to consider the universality of PHP on cheap web hosts if you're writing code for other people to run on their own servers.

4. Ruby, as a language seems to me like the designers really kept the user experience in mind. It's similar to the advantages often cited for Apple products. I've heard similar things about Python, but I haven't used it nearly as much. Another advantage I've found over PHP is that example code in both Ruby and Python is much more likely to be exemplary. There's a lot of example code for PHP floating around on forums and blogs that would be better used for counterexamples.

[0] prgmr.com starts at $5/month, though that plan isn't enough to handle much traffic.

Re: Ask HN: PHP & Python/Ruby?

#17
post #3

Don't compare languages, compare frameworks, and don't ask us, do the tutorials.

This was down voted but it brings up valid a point. There are a lot of posts asking which language the OP should learn. It's redundant and very subjective. Yet at the same time people love their languages, their religion, what helps them wake up in the morning and so these posts are very popular.

More importantly I was making the point that people rarely write websites "in Ruby" or "in Python", they write them in "Rails" or "Django".

People often write websites "in PHP" and that is a big, heavy and sharp double edged sword: it is this flexibility that has contributed largely to PHPs terrible reputation amongst languages.

The OP is looking to "take things more seriously" so that means developing PHP with a framework, hence it's not relevant to compare Python to Ruby to PHP - the language and it's syntax will have far less impact on the OPs experience than will the structure, idioms and deployment requirements of various frameworks written in each of those langauges.

Re: Ask HN: PHP & Python/Ruby?

#18
I've taken a different approach switching to ruby(on rails). I was eager to learn a framework to simplify stuff in php, so I learned CakePHP. This MVC experience eventually led me to the bigger brother ruby on rails and from there, I bought the pickaxe book and learned ruby. Was this the best way? definitely not :)

So my advice is: First, work a weekend with bare ruby, there are lots of good and extensive resources on the web. Second, if you enjoyed working with ruby, try another weekend learning basic MVC Rails. Good resource is rails for zombies (http://railsforzombies.org/), where the basics are well shown, and you can work through this on one weekend. Third, try converting one of your small projects to rails. There will be a lot of hiccups and frustration, but once the first project is done, you will simply love ruby.

I hope this helped you a bit, although I have not directly answered your questions (mostly because the given answers are the ones I would write, too).

Re: Ask HN: PHP & Python/Ruby?

#19
Short version: I'm in the same boat. I have a lot of experience in PHP (personal + professional) projects. I invested my time in learning frameworks (Symfony, Doctrine + Propel) and have tons of plugins and utilities classes. Feel free to investigate languages and learn tricks. But, don't switch unless the return on investment is high enough.

Personally, I ended up switching for my personal projects only. I look at my PHP code and despite my skills the language is simply limiting me. It's limiting my approach to problems, the readability/flexiblity of my code and the solutions I implement. Even if I have a saying in which technology I implement my solutions with, most of the web dev stuff is fairly well done in PHP _especially_ if you're using sophisticated frameworks. That's why, for clients, I'm still using PHP (for now)

Long version:

1) Ruby and Python are excellent languages. Elegant, readable, dynamic and in general well implemented. Personally, I prefer Ruby because I find it well designed and more intuitive than Python. Ruby is full OOP where Python has those built-in functions and I never know if the call to open and close a file is built-in or part of the File class. In general, Ruby tries to put things together in classes/modules and avoid "lost" functions.

Also, you can fully customize stuff in Ruby. To me, that's an advantage because after a couple of layers in your business model, if your want to do something like Product 3) Why shouldn't you switch? Like I said, it depends on the kind of dev you're doing. Most PHP programmers are enthusiastic hobbyists and PHP is more than enough to satisfy their needs. So, if you don't see a net return on switching to Ruby, don't. It's worth investigating languages but rarely worth switching e.g Haskell taught me a lot about modularity and gave me a new perspective on programming but I'm not gonna implement my next web app in Haskell

About the transition:

In my case, I like to experiment with languages using a problem. For example, I have a couple of batches in PHP and I needed threading. Guess what my first Ruby app was? So, find a project or something you'd like to build and ideally it's something you can't do with your current language or maybe something that is easier to build with Ruby.

Anyway, I enjoyed writing this stuff down. Hope it helps.

Re: Ask HN: PHP & Python/Ruby?

#20
If you really want to excel and learn, pick up Java. It is so completely different from PHP that you'll learn a tonne (and likely appreciate PHP more).

The upside is that there is always a market for Java developers (not that there isn't one for PHP but it's good to have options).

I'm sure that the script kiddies will bury this post and tell you to learn Erlang, Ruby, etc (which are all good in their own right) but that's this old cat's 2 cents.

Post reply on HN