Timeline for Is `if( hidden ) return;` an antipattern?
Current License: CC BY-SA 3.0
3 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 12, 2013 at 10:45 | vote | accept | bobobobo | ||
| Dec 10, 2013 at 11:35 | comment | added | elmo | And I would say the exact opposite thing. I would say draw() shouldn't look at isVisible(). If it did it should be called drawIfVisible(). Why? Because let's imagine I want a "debug view" where "hidden" things are at 50% opacity. I might want to draw everything visible, and then hidden things on different layer with 50% opacity. With your approach that is not possible as draw() will do nothing. Of course that depends on the rest of code/design, but I would opt for functions doing minimal amount of stuff and only stuff implied by name. | |
| Dec 9, 2013 at 18:35 | history | answered | Matt | CC BY-SA 3.0 |