Live data from Hacker News

Ask HN: PHP & Python/Ruby?

news.ycombinator.com

21–30 of 32 posts

Re: Ask HN: PHP & Python/Ruby?

#21
post #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 t…

You don't mention why one should not choose Erlang, Ruby, etc, nor why one should in fact choose Java. That you also lump Erlang and Ruby together, two very different languages, with different advantages, and of completely different paradigms; further undermines the credibility of your suggestion.

Your reference to script kiddies? The icing on the cake my friend.

Re: Ask HN: PHP & Python/Ruby?

#22
Depends on your circumstances in part.

Will you be doing scientific programming? Python.

Graphical games? Python.

Web apps? Ruby or Python are about comparable.

Do you really really really want multi-line lambdas? Ruby.

Do you really want to make DSL's? Ruby.

Do you really want code that's easy to read and maintain years from now after it's no longer fresh in your mind? Python

Do you want a language with a smaller number of rules for your brain/tools to parse (ie. a more "regular" syntax)? Python.

Do you want as much "magic" and implicit behavior as possible in the language? Ruby

Do you prefer things to be explicit, but still concise? Python

Do you want to be seen as cool and hip as possible? Definitely Ruby rather than Python

Will you likely be writing lots of CPU-bound code and therefore need a language that has a fast runtime characteristics? Python

Do you think Perl is a good thing? Ruby. A bad thing? Python.

Do you want a lot of open source projects and a rich ecosystem? Ruby and Python are about comparable

Do you want to hob-nob with folks who are, on average, generally younger? Ruby

Do you think "end end end end end end" everywhere looks dumb as hell? do Python

Do you think having to type "self self self self self" a lot in classes feel wrong to you? do Ruby.

Want the one of the two that's most popular/blessed/supported by Google? Python

Re: Ask HN: PHP & Python/Ruby?

#23
post #17

Earlier quoted context omitted.

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 fra…

People, please read this parent again. Why are we all comparing PHP to ruby/rails? If you want to be fair use Zend or any other framework to get apples to apples.

Re: Ask HN: PHP & Python/Ruby?

#24
I love CodeIgniter for PHP but every time I peek into RoR I feel like home. The main turn off for me so far was the deployment overhead. With CodeIgniter you can just carry your entire web app in a thumb drive and plug it into any machine that has the basics (webserver, database server etc.) setup. With RoR I felt the deployment is more of an overhead. Dealing with SSH scripts and such haven't felt comfortable to me yet and I have gone back to CodeIgniter for its simplicity and so far there wasn't much of a disappointment. Pretty much everything can be done in CodeIgniter it seems, one way or the other.

Having said that I completely agree that RoR would be the way to go given the elegance of Ruby and the Rails framework. Will surely give it a try couple more times until I feel comfortable dealing with all the aspects of RoR. Until then CodeIgniter for me...

Re: Ask HN: PHP & Python/Ruby?

#25
I'm a Ruby coder and I like it, but I think that you should make a reasonable attempt to study both Ruby and Python at the same time.

The key skill that you're looking to pick up is actually what professionals think of as "full stack web development". That is, you should aim to understand lots of things:

- MVC web frameworks like Rails and micro-frameworks like Sinatra

- MySQL and non-relational datastores like MongoDB

- web and proxy servers like thin and nginx

- Redis! it's like a Swiss Army knife... but also Memcached

- jQuery and Haml/Sass

- Backbone and websockets

I could go on and on... the point is that each of these things are awesome for different tasks. You should try your hand at all of them!

Bonus points: I think that SproutCore is going to be a very BIG deal in 2011. You could get the jump on everyone.

Re: Ask HN: PHP & Python/Ruby?

#26

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.

Python only has single line lambdas.

Rumor control. While it is true that the lambda construct in Python is only one line, Python allows you to define functions in any scope, and pass those functions around. They are full closures. So anything you wanted to do with multi-line lambdas you can.

Re: Ask HN: PHP & Python/Ruby?

#27
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…

I found that RailsTutorial explains Ruby well enough that I didn't need to learn it separately from Rails. The author covers Ruby concepts not found in PHP (such as ranges and symbols) in chapter four. Everything else could be filled in by looking at the online documentation.

Re: Ask HN: PHP & Python/Ruby?

#28
post #26

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.

Python only has single line lambdas. Rumor control. While it is true that the lambda construct in Python is only one line, Python allows you to define functions in any scope, and pass those functions around. They are full closures. So anything you wanted to do with multi-line lambdas you can.

Yes, but I've found it to be rather cumbersome compared to ruby and under utilized. The standard library doesn't seem to make much of an attempt to pass around functions whereas in ruby you are often using code blocks to replace loops.

Ruby's ability to hijack the scope of a given block via class_eval is amazingly useful in creating DSLs. Creating DSLs in ruby is trivial. The router for Rails 3 is a perfect example of this. Python makes this far more difficult.

Re: Ask HN: PHP & Python/Ruby?

#29

Depends on your circumstances in part. Will you be doing scientific programming? Python. Graphical games? Python. Web apps? Ruby or Python are about comparable. Do you really really really want multi-line lambdas? Ruby. Do you really want to make DSL's? Ruby. Do you really want code that's easy to read and maintain years from now after it's no longer fresh in your mind? Python Do you want a language with a smaller nu…

Agree on most of the points. Just two I disagree on.

> Do you really want code that's easy to read and maintain years from now after it's no longer fresh in your mind?

In my experience ruby code isn't inherently less readable than python if you know ruby moderately well. Ruby has more syntax but it's standard library is fairly clear and it's easy to look up.

> Do you think Perl is a bad thing?

I think it's a horrible language and absolutely I love ruby. :) Granted, I learned ruby before I learned perl.

Re: Ask HN: PHP & Python/Ruby?

#30
I am in a similar situation.. I consider myself very proficient in PHP (and have been doing it full-time for 2 years since school). Being forced to use one language all the time didn't sit too well with me. Recently, I picked up a few python books and made a new app just for fun with python/GAE. 100% free (minus the book costs) and it was eye opening in many regards. Seeing all the beautiful language constructs that python has available compared to PHP made me very jealous. I fully intend to jump into the Ruby world eventually to see what all the fuss is about - However, I recommend you do what I did and try some small stuff with GAE just because of the ridiculously easy setup/deployment. Lets you focus more on the language and coding.
Post reply on HN