programming_general:object-orientation_fundamentals
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
java:object-orientation_fundamentals [2020/09/11 21:51] – [Why object-orientation?] mithat | programming_general:object-orientation_fundamentals [2020/09/11 22:05] – ↷ Page moved from general:object-orientation_fundamentals to programming_general:object-orientation_fundamentals mithat | ||
---|---|---|---|
Line 51: | Line 51: | ||
==== Encapsulation and protection ==== | ==== Encapsulation and protection ==== | ||
- | As a user, I change the state of the oven by engaging one or more of the operations in the oven's interface. In other words, I'm not expected to open up the oven and hack at its guts to make the magnetron work at maximum level for whatever time I want. As a user of the oven, I don't need to know how a magnetron or the power supplies work, and if I am a typical user I don't really care. I only need to know what changes in state to expect from the "cook 1 minute" | + | As a user, I change the state of the oven by engaging one or more of the operations in the oven's interface. In other words, I'm not expected to open up the oven and hack at its guts to make the magnetron work at maximum level for whatever time I want. As a user of the oven, if I am a typical user, I don't really care. I only need to know what changes in state to expect from the "cook 1 minute" |
- | Along the same lines, when I change the clock' | + | Along the same lines, when I change the clock' |
This idea of "not caring about how it works---I only need to know what it does" is the essence of **encapsulation** (literally, "to place in a capsule" | This idea of "not caring about how it works---I only need to know what it does" is the essence of **encapsulation** (literally, "to place in a capsule" | ||
Line 59: | Line 59: | ||
In fact, even if I wanted to get at, for example, magnetron inside or directly change the clock' | In fact, even if I wanted to get at, for example, magnetron inside or directly change the clock' | ||
- | The Keeping someone out of stuff they should not be allowed to access is called **protection** or sometimes **information hiding**. In many (but not all) languages, properly hiding things the user has no business getting into is considered part of encapsulation. | + | Keeping someone out of stuff they should not be allowed to access is called **protection** or sometimes **information hiding**. In many (but not all) languages, properly hiding things the user has no business getting into is considered part of encapsulation. |
==== Objects ==== | ==== Objects ==== | ||
Line 80: | Line 80: | ||
==== Prototype-based object-orientation ==== | ==== Prototype-based object-orientation ==== | ||
- | There is another kind of object-orientation called **prototype-based object-orientation** or **prototype-based programming**. This is the kind of object-orientation used in JavaScript and some other languages.((C++, | + | There is another kind of object-orientation called **prototype-based object-orientation** or **prototype-based programming**. This is the kind of object-orientation used in JavaScript and some other languages.((C++, |
==== Ovens and code ==== | ==== Ovens and code ==== |
programming_general/object-orientation_fundamentals.txt · Last modified: 2020/11/15 00:03 by mithat