python:python_misc:oo_fundamentals_with_python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
python:python_misc:oo_fundamentals_with_python [2018/08/20 20:24] – mithat | python:python_misc:oo_fundamentals_with_python [2018/08/23 17:08] – [Class-based object-orientation] mithat | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== What you'll need to know ===== | ===== What you'll need to know ===== | ||
- | In what follows, we assume know basic Python programming concepts including: | + | In what follows, we assume |
* How to create and use variables. | * How to create and use variables. | ||
Line 47: | Line 47: | ||
* And so on. | * And so on. | ||
- | These operations are one that happen to be public-facing (i.e., operations a user can engage). There might very well also be operations that go on inside the oven to support the oven's functioning that the user will never be aware of. All these operations collectively define the oven's behavior. We call the public-facing behavior (i.e., the operations a user can engage) the oven's **interface**. | + | These operations are ones that happen to be public-facing (i.e., operations a user can engage). There might very well also be operations that go on inside the oven to support the oven's functioning that the user will never be aware of. All these operations collectively define the oven's behavior. We call the public-facing behavior (i.e., the operations a user can engage) the oven's **interface**. |
==== Encapsulation and protection ==== | ==== Encapsulation and protection ==== | ||
Line 70: | Line 70: | ||
{{: | {{: | ||
- | I have a Farberware 4241 microwave oven in my office. It's small, but it gets the job done. There is a factory somewhere making these by the thousand million. They make all the Farberware 4241s from a master plan. That master plan defines what the Farberware 4241 //is//. In computing terminology, | + | I have a Farberware 4241 microwave oven in my office. It's small, but it gets the job done. There is a factory somewhere making these by the thousand million, and they make all the Farberware 4241s from a master plan. That master plan defines what the Farberware 4241 //is//. In computing terminology, |
Every Farberware 4241 begins its life identical to every other freshly-made Farberware 4241 because they were made using the same master plan. So, the one in my office that I pulled out of the box last month was identical to the one that I bought my best friend last week later because they were built from the same master plan, or, if you will, the same class. But as my best friend and I started using our ovens, the state of each changed. Note that while the behavior designed into the oven---the operations it's capable of---doesn' | Every Farberware 4241 begins its life identical to every other freshly-made Farberware 4241 because they were made using the same master plan. So, the one in my office that I pulled out of the box last month was identical to the one that I bought my best friend last week later because they were built from the same master plan, or, if you will, the same class. But as my best friend and I started using our ovens, the state of each changed. Note that while the behavior designed into the oven---the operations it's capable of---doesn' |
python/python_misc/oo_fundamentals_with_python.txt · Last modified: 2018/11/30 18:45 by mithat