Why Is Ruby More Suitable for Rails Than Python

What does Ruby have that Python doesn't, and vice versa?

You can have code in the class definition in both Ruby and Python. However, in Ruby you have a reference to the class (self). In Python you don't have a reference to the class, as the class isn't defined yet.

An example:

class Kaka
puts self
end

self in this case is the class, and this code would print out "Kaka". There is no way to print out the class name or in other ways access the class from the class definition body in Python.

Why are Ruby and Python more suited for programming outside an IDE than Groovy?

I disagree with the assertion that groovy is harder to develop with outside of an IDE. I've done serious python and groovy development, and a little bit of ruby, mostly without an IDE.

While there isn't a pdb style debugger, there's a console: groovysh is a non-GUI console, command line app, and groovyConsole is a GUI with simple syntax highlighting and editing. The rails and TDD philosophies emphasize development with tests rather than debuggers, and I find I rarely, if ever, feel the need to use a full-on debugger if I've got good test coverage. Whether this matters to you really depends on your own style of development.

Groovy simplifies the whole jar/classpath mess. While you can still set the classpath if you want, it's much easier to let groovy manage it entirely. Groovy automatically includes jars in $GROOVY_HOME/lib and ~/.groovy/lib in the classpath. Installing a library is simply copying it there. Better than that, with @Grab, you can declare your dependencies right at the top of your script, and groovy will automatically download the version you specify, and recursively get all of its dependencies and set up the proper classpath and classloaders; it can even manage two libraries that depend different versions of the same jar. Grails also has declarative dependencies.

The groovy language itself is just as concise and flexible as either ruby or python. While you can write it like full-blown Java, groovy can be written to look very similar to ruby.

One valid complaint against groovy vs python and ruby is that the startup time of the JVM is still noticeably worse.

Why does Ruby seem to have fewer projects than other programming languages?

There's a lot of activity with Ruby in web-based development. You just have to join the right communities and lists.

I don't think it will ever be as popular as C/C++ (because of the existence of already deployed code and a developer base) or Java (because I imagine it isn't quite as easy to understand at first).

Please advise on Ruby vs Python, for someone who likes LISP a lot

I'd go with Ruby. It's got all kinds of metaprogramming and duck punching hacks that make it really easy to extend. Features like blocks may not seem like much at first, but they make for some really clean syntax if you use them right. Open classes can be debugging hell if you screw them up, but if you're a responsible programmer, you can do things like 2.days.from_now (example from Rails) really easily (Python can do this too, I think, but with a bit more pain)

PS: Check out "Why Ruby is an acceptable LISP".

Web service: PHP or Ruby on Rails or Python?

Ruby-on-rails, Python and PHP would all be excellent choices for developing a web service in. All the languages are capable (with of course Ruby being the language that Ruby on Rails is written in), have strong frameworks if that is your fancy (Django being a good python example, and something like Drupal or CakePHP being good PHP examples) and can play nicely with MySql.

I'd say that it would depend mostly on your past experience and what you'd be the most comfortable with. Assuming that you're developing C# on .NET and have experience with Objective-C PHP may be a good choice because it is most certainly from the C family of languages. So the syntax might be more familiar and a bit easier to deal with.

I'm a PHP developer so I'll give you that slant and let more knowledgeable developers with the others give theirs as well. PHP is tightly integrated with Apache, which can make some of the more mundane tasks that you'd have to handle with the others a bit more trivial (though when working with a framework those are usually removed). The PHP documentation is second to none and is a great resource for getting up and going easily. It has decent speed and there are good caching mechanisms out there to get more performance out of it. I know that getting up and running with PHP on Dreamhost is trivial. I haven't done it in the other instances although it wouldn't surprise me if those were just as easy as well.

I'd suggest digging a bit more into the documentation and frameworks for each language to find out what suits you best.

Django or Ruby on Rails

I kind of like the Python language
better and it seems to be more
full-featured than Ruby for
statistical, scientific and networking
(let me know if you think this is
wrong).

If you think you'll need libraries like NumPy or SciPy, probably best to stick with python/django. I've struggled to find ruby equivalents.

However, the RoR community seems to be
much bigger

Bigger is of course not going to be better. I've had great experiences with the django community in terms of support, and the pluggable app ecosystem is maturing quite quickly.

I would also add that I find the django documentation to be very easy to follow.



Related Topics



Leave a reply



Submit