4 ms·
That code example completely breaks rules #1, #2, and #3 completely. There are probably a lot of ways to refactor that code so that it's still specific. The mos
by RyanZAG 14y ago
That code example completely breaks rules #1, #2, and #3 completely. There are probably a lot of ways to refactor that code so that it's still specific. The most common method is to define constants for each value and then pass them in as 'flags' to the method. For example:
foo( $data, Foo.NEVER_USE_CATS | Foo.DRAW_SQUIGGLIES );
This pattern lets you add in new parameters easily and makes it very clear what parameters are being passed to any function and set sane defaults. This style is widely used in Android to good effect.