On Thu, Oct 14, 2010 at 10:19 AM, Josh Berry <[email protected]> wrote:
> I mean, is:
>
> public void Foo(int x,
> int y
> String z) {
> ...
> }
>
> truly that unreadable?
>
This is pretty readable but overall, you shouldn't be using ASCII art in
code.
Here is why.
First of all, you put a burden on developers to spend time neatly aligning
their code. That's a lot of space pressing and deleting, eyeballing and
doing it again.
Second, they have to realign everything whenever a refactoring occurs (say,
you rename a method) or even simple changes are made to the code (e.g.
adding a parameter or changing a type).
But the worst part is that the two points above make merging and diffing a
nightmare. Suddenly, every single commit is a mix of real changes and
cosmetic changes. Lines get flagged as changes just because the amount of
spaces in front of the first letter has changed.
It's really, really painful.
All of this explains why most organizations forbid ASCII art in the code.
It's just easier for writing code, reading code, merging and diffing code
and it's not that much more unreadable than the alternative (FYI, that's the
code style that Google imposes).
I find that simply breaking lines at your column limit (I like 100) and
making extra indentations if the line is a continuation to be very readable
and an approach that mitigates all the problems above considerably.
--
Cédric
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.