back

by sergiotapia·13y ago·view on hn ↗
COMPLETELY 100% unscientific, but in my glances and reading of the Django docs I found that they make heavy usage of symbols such as [, ] in code.

I like Ruby's terseness. Fewer keystrokes is a win for me, especially when you have a shit keyboard (pardon my french).

Django feels very CakePHP-y, if that makes any sense?

QUICK DUMB EXAMPLE:

Django:

    from django.db import models

    class Person(models.Model):
      first_name = models.CharField(max_length=30)
      last_name = models.CharField(max_length=30)
Rails:

    class Person < ActiveRecord::Base
      attr_accessible :first_name, :last_name
      validates :first_name, :length => { :maximum => 30 }
      validates :last_name, :length => { :maximum => 30 }
    end
---

Which is simpler to type, ergonomically speaking?

5 comments
You are probably trolling, but just the same, I don't like it when people get downvoted without explanation. Ergonomically speaking, count the number of characters that need to be input by holding the shift key, and that will tell you which is simpler to type.

edit: Well when I started replying, you were well into the light grey and with no reply.

Just because you do not agree does not mean I'm trolling. Don't do that here on HN.
I didn't mean it as an insult. But when you make a statement then provide an example that contradicts it, that's usually a troll move. Ergonomically speaking, the example you provided is easier to type for Django than Rails. Again, didn't mean to offend.
I don't agree with your point or its opposite, but the example you give seems like it is at odds with your observations on brevity and symbol usage.
"Fewer keystrokes"

Your example, Ruby has 26% more characters (194 vs 154).

"I found that they make heavy usage of symbols such as [, ] in code."

Your example, 3 sets of parentheses, 4 equal signs, 4 underscores, one colon in Python.

In Rails, 2 sets of braces, 4 assignment operators (=>), 10 colons, 4 underscores and a <.

I guess I'm not seeing either the brevity or heavier use of symbols in your example...

with Ruby 1.9 you don't need the '=>' for hash values:

    class Person < ActiveRecord::Base
      attr_accessible :first_name, :last_name
      validates :first_name, length: { maximum: 30 }
      validates :last_name, length: { maximum: 30 }
    end
This is kinda funny, because your example is full of : which is even more annoying to type than ,

If you have a shit keyboard, treat yourself to a nice one, I bought a mechanical one for 50€ and it is pretty damn good and I plan to keep it forever.