Jim Jewett
Posts: 11
Nickname: jimj
Registered: Apr, 2005
|
|
Re: Shit or chocolate?
|
Posted: Feb 23, 2006 6:30 AM
|
|
> Clean abstractions are best reflected in clean, > terse code but terseness of the code is not a > goal in itself.
This is (almost) one of the disagreements between yourself and python. Terseness, no (python isn't perl), but readability -- absolutely. Python prefers longer code when it is more readable.
The catch is that boilerplate -- almost anything an IDE can add for you -- usually makes code less readable, if only because it is less likely to fit on a line, or a screen, or because you have to spend some mental effort skipping the boilerplate.
Java in practice has often stopped looking like source code, and started looking like an intermediate product that the tools generate. This isn't a problem when you are writing it, but it is a problem when you are trying to maintain it, particularly if you aren't using the same environment as the person who wrote it.
For example, you agree that getters and setters are typically boilerplate that shouldn't be written by hand. I agree wholeheartedly, and would also add that they therefore shouldn't even appear in the code. When you see a getter or setter, it *should* stick out to indicate that something is unusual. In java it doesn't, but the IDE can help you overcome that. In python, the very existence of a getter or setter sticks out naturally. (Constructors are a weak point here, because of the self.name=name idiom for handling initializer arguments.)
|
|