{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner

Python vs Ruby: Maintainability

One of my favorite subjects is comparing and contrasting tools and frameworks available today. Python and Ruby are probably the big 2 languages right now in web development.

Now, a language is less important than the framework. However, the language sets the stage for framework's philosophies. Obviously all frameworks are different, but Django acts like Python and Rails acts like Ruby.

Writing a full article would be way too much. I've used both tools extensively for years. I am totally biased, I much prefer Rails to Django. Django does have its place though, and there are some things that the Python community simply does better.

Consider this the first in a series of articles comparing the two. This one, will be on the topic of maintainability. Maintainability is how easy it is to change/fix a product after it has been released.

Python culture

The Python culture is very idealistic. You get a total sense that there is a Right and a Wrong way to do something. Often times they will not have shortcuts you find in other languages, because the culture is very against having multiple ways of doing things.

The reason for this is readability. Something that Python excels at. I think it's probably the biggest goal of the Python community: to force readable code. It's actually difficult to make unreadable Python code.

It certainly isn't always concise (compared to Ruby, but very concise to Java/C++). Still, concise and readable are not the same thing.

Python also has this concept of 'Pythonic', which really means the Right way of doing something. They also have a king: Guido van Rossum. If you're in a debate with someone about Python, and you can find Guido saying something on the topic, Guido is always right.

This all moves towards this goal of simplicity and readability. For this reason, Python is without a doubt the easiest language to read. If I had to work on a project with developers I knew were going to suck, I would push hard for Python.

Ruby culture

Ruby has an incredible culture. It is similar to Python in some ways, open source is very much encouraged, it's practical, not run by a corporation, and it's just flat out an awesome language.

Backwards compatibility and readability though, definitely are not the main focus of Ruby. It's important, sure, but it takes the back-seat to productivity.

Ruby is very, very productive. There may be multiple ways to do things. As an example, with Django, authentication is built into the framework, there is one Right way to do it. Ruby has no built in authentication, and you can either do it yourself, use Warden, Devise, Sorcery or many other options. Each themselves has good and bad things about it, but they all work well.

You can absolutely get things done faster with Ruby. Especially when it comes to things like caching, nosql, workers. I know Python better than Ruby, but I still work much faster with Ruby.

Ruby has no king, it has a creator (Matz) but to be honest, I don't know much about him. I just know he works for Heroku. I'm sure he has a large influence on the community, but not like Guido.

Maintainability is also mitigated through other means. Rather than focusing on readability, it's taken care of simply by having less and better code. Also, the heavy focus on test-driven development absolutely reduces the amount of bugs, and can almost remove the chance of regressions.

I would also argue the gem system is much better than Python's packages, resulting in making it easier to share code between projects/companies/people. Python has always done this well, but things like Ruby's Bundler are just way better than anything Python has.

So in some ways, Ruby just doesn't need to be as readable to stay maintainable.


Still, Python wins in maintainability. This is both because the code is readable, and has a heavy emphasis on backwards compatibility.

However, maintainability is not everything. In fact, I think most developers focus TOO hard on it. Getting the product out the door is absolutely more important.

Also, while the language helps with maintainability, it's up to the developer. You can have super maintainable C code, and totally unmaintainable Python code. The language helps, but it is really nothing compared to the engineer.

My good friend Max Kanat-Alexander said this so well:

Python is the easiest language to read, Ruby is the most fun to write.

I could never have said it better myself.

Source: http://jeffdickey.info/python-vs-ruby-maintainability

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks