3 ms·
I think that's a vision of OO that not many OO programs that I've seen actually follow. It's more common to see OO programs where object methods represent the
by sixbrx 7y ago
I think that's a vision of OO that not many OO programs that I've seen actually follow. It's more common to see OO programs where object methods represent the computations, not the whole objects, while the bundled data is used to store resulting state of the computations, with much or all of the data hidden to preserve invariants for that state. Just acting directly on the data like that without an intermediate representation of the computation itself is just the sort of liberty that the video I mentioned in the sibling post, warns about that can turn into unwanted constraints in some cases.
- gambler 7y ago>I think that's a vision of OO that not many OO programs that I've seen actually follow. Maybe not, but it absolutely was part of the original vision. This is why Smalltalk 80 implements if/else statements and loops as methods, rather than keywords. A boolean in smalltalk is not just a value. It's a latent algorithm for choosing between two blocks of code at some later point in time. It's also a latent algorithm for operating on other booleans via binary logic methods. Until you start seeing objects this way, you will not be able to appreciate the elegance of object-oriented programming. Here are some examples of how this can work in non-trivial scenarios: http://www.vpri.org/pdf/tr2007003_ometa.pdf http://www.vpri.org/pdf/tr2007003_ometa.pdf https://bracha.org/executableGrammars.pdf https://bracha.org/executableGrammars.pdf