http://qs321.pair.com?node_id=259466


in reply to Re: Short Refactoring Tip: let the object do it for you
in thread Short Refactoring Tip: let the object do it for you

Ah, but it isn't common sense. In old-time C, for example, you wouldn't write something like that. Instead, you would write something like:
#define STATUS1 (1 << 0) #define STATUS2 (1 << 1) #define STATUS3 (1 << 2) #define STATUS4 (1 << 3) ... typedef int Status; ... Status product_status = 0; ... if (product_status & (STATUS1 | STATUS2)) { // Do stuff here }
It's imperative programming, man! You gotta be in control or you lose your job! (Think about it - if you couldn't point to incomprehensible code, your PHB would find someone who could. I mean, if anyone could write code that works, then how do you justify your 6-figure consulting fee?)

Also, writing good class interfaces requires both time and understanding of the business domain. Maybe your world allows for these, but no application I've ever had the (mis)fortune to work on has ever been in that most blessed of states. (No, that isn't Texas, either.)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.