3 ms·
The original idea of encapsulation was not to rely on arbitrary internal knowledge but provide stable procedures. One of real-world examples was not to rely on
by Mikhail_Edoshin 7y ago
The original idea of encapsulation was not to rely on arbitrary internal knowledge but provide stable procedures. One of real-world examples was not to rely on Dorothy in marketing putting the red copy into the blue folder because next month Dorothy may be on vacation, red copies become yellow, and the blue folder is replaced with a green one. Instead the procedure should refer to Senior Marketing assistant, marketing copy, and folder for the current year. No excessive hiding, just stability.
- ssivark 7y agoYes, but what if that appearance of stability is unwarranted? After all, the underlying process is just Dorothy moving things around, and when Dorothy's on vacation things might not be working the way they should. This brings up an interesting aside: they right way to build software for "agile" processes might look very different from the right way to build software for "frozen" (non-agile) processes (big corp, stable processes, few surprises if any, etc.). Ideas such as abstraction/encapsulation that work well for the latter situation might be totally out of place in the former.