Skip to main content
7 events
when toggle format what by license comment
Jan 11, 2018 at 17:35 comment added Steve @blackjack, I agree one can be too terse, but one can also be too verbose, implementing too many patterns and structures where none is required for clarity, and which then detract from clarity - like setting out to build a garden doghouse, but also implementing 100ft pilings and a tuned mass damper!
Jan 11, 2018 at 16:58 comment added BlackJack @Steve Think „code golf“ — taking such code and rewriting it in more lines does usually make it clearer. „Code golf“ is an extreme, but there are still many programmers out there who think cramming everything into one clever expression is ”elegant” and maybe even faster because compilers are not optimizing good enough.
Jan 10, 2018 at 20:14 comment added doubleYou @Steve I completely agree that you can over-engineer things, i.e. make code longer without making it clearer - otoh, you can always make code shorter at the cost of clarity, so there's no 1:1 relationship here.
Jan 10, 2018 at 16:20 comment added Steve @doubleYou, you say longer code is not automatically less maintainable. I would say that code length is one of the main variables in maintainability and clarity, overtopped only by structural complexity. Any code that becomes longer and more structurally complex ought to deserve it, otherwise simple problems receive a more complex treatment in code than they deserve, and the codebase acquires thickets of unnecessary lines (the "too many levels of indirection" problem).
Jan 10, 2018 at 10:58 comment added doubleYou No I (weakly) recommend it for clarity (showHint vs setHintVisibility). I mentioned the new layer just because OP was worried about it. Also, we just need to add one new method: isLayer4Visible. showHint and hideHint just set the isHintVisible attribute to true/false and that doesn't change.
Jan 10, 2018 at 10:49 comment added Erdrik Ironrose So tl;dr is: You recommend splitting into two functions because you won't have to change them when you add layers? If a layer4 is added, we may need to say "this.layer4.visibility = isHintOn", too, so I'm not sure I agree. If anything, that's a demerit against it, as now when a layer is added we have to edit two functions, not just one.
Jan 10, 2018 at 10:06 history answered doubleYou CC BY-SA 3.0