-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- Alfonso, 11/14/2006 04:39 PM:
I have just started with ruby, and something that I have observed
is that most of the code is indented with 2 spaces. Having
programmed some time with C# and python, it’s very strange to me
so few identation. To me 4 spaces is much better to read. Is there
something like a style guide in ruby that says that you should use
2 spaces or is it all right using 4 or 3 spaces? What do you use
in your code?
The number of spaces for indentation depend on at least four factors:
-
- the length of an average token
-
- wether the token may contain spaces (this is a rare feature but
some languages actually allow this)
- wether the token may contain spaces (this is a rare feature but
-
- the kind of font used to display the code (it can have a narrow,
square or wide shape which means aspect ratios significantly less
than, approximately equal to, or significantly larger than one).
- the kind of font used to display the code (it can have a narrow,
-
- your perception
In other words: Use the indentation that seems appropriate. I’d only
suggest to stick to a certain indentation to avoid inconsistencies
when merging code. Transforming one indentation into another one is a
Ruby one-liner.
Jupp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFFWvGTrhv7B2zGV08RAnphAKC8RjwVBiSes5HmJJbTl/2QEhQgBACghGN7
N7cBFCYUEL9f5EuPUoAZfpk=
=QoEX
-----END PGP SIGNATURE-----