[josm-dev] Jumbo Patch
Ulf Lamping
ulf.lamping at web.de
Sun Dec 16 10:16:03 GMT 2007
Gervase Markham schrieb:
> Frederik Ramm wrote:
>
>> I know the basic ideas & advantages behind encapsulation. Hotspot
>> inlining stuff removes the runtime cost of it, but the code bloat
>> remains; for everything that might have to be accessed from the
>> outside, you need a getter and setter - and they carry *no* additional
>> information, except the tiny percentage of getters and setters where
>> you actually do something other than just reading or writing a private
>> variable.
>>
> What do you mean by "code bloat" anyway? It's not like you need to
> _read_ this code. It just has to be there. Put it at the bottom of the
> class if you like. I'm sure you can't be worried about the extra 1
> second it takes to do a checkout, or the extra 5k it takes up on disk.
>
Well, that argument is wrong IMHO. If there are a few hundred lines of
getters and setters in each file and I fully want to understand the code
I have to read all of it. I don't know what there might be, as there
could be some additional code in the get/set methods. So this isn't only
about file size.
>> I don't know which of the en-vogue programming paradigms this was but
>> there is one that basically says "don't over-engineer, just write
>> exactly the code you need to solve the problem at hand". I would like
>> to be able to do that, write exactly the code required, instead of
>> using 50% of my code lines to pave the way for something that might
>> come in handy later. Or might not.
>>
> Over-engineering is not about added lines of code, it's about added code
> complexity. Getters and setters don't add _complexity_ - like you said,
> they are entirely trivial.
>
Complexity doesn't necessarily mean complex code, it can also mean lot's
of files with lot's of stuff in it that in the end is essentially
trivial. It can take quite some time to fully read the whole code idea
but the code in it then is still actually trivial.
All in all, this getter/setter thing sounds like another "karma" of
programming (like tab vs. space, the right indenting, ...) - there's no
"one and only truth". So arguing is pretty pointless, as both sides will
have their believe and won't convince each other ...
Regards, ULFL
More information about the josm-dev
mailing list