<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://staging.moocwiki.org/index.php?action=history&amp;feed=atom&amp;title=English%3AObject-Oriented_Programming</id>
	<title>English:Object-Oriented Programming - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://staging.moocwiki.org/index.php?action=history&amp;feed=atom&amp;title=English%3AObject-Oriented_Programming"/>
	<link rel="alternate" type="text/html" href="https://staging.moocwiki.org/index.php?title=English:Object-Oriented_Programming&amp;action=history"/>
	<updated>2026-09-27T03:33:02Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in MOOCsWiki Staging</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://staging.moocwiki.org/index.php?title=English:Object-Oriented_Programming&amp;diff=47960&amp;oldid=prev</id>
		<title>Glanz: aiMOOC über GPT aiMOOC Action erstellt</title>
		<link rel="alternate" type="text/html" href="https://staging.moocwiki.org/index.php?title=English:Object-Oriented_Programming&amp;diff=47960&amp;oldid=prev"/>
		<updated>2026-08-29T12:25:45Z</updated>

		<summary type="html">&lt;p&gt;aiMOOC über GPT aiMOOC Action erstellt&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{T}}&lt;br /&gt;
[[Category:English]]&lt;br /&gt;
[[Category:Object-Oriented Programming]]&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
Object-oriented programming, usually shortened to &amp;#039;&amp;#039;&amp;#039;OOP&amp;#039;&amp;#039;&amp;#039;, is a way of organizing software around interacting objects. An object combines &amp;#039;&amp;#039;&amp;#039;state&amp;#039;&amp;#039;&amp;#039; with &amp;#039;&amp;#039;&amp;#039;behavior&amp;#039;&amp;#039;&amp;#039;: for example, a digital library item might store a title and availability status while providing methods for borrowing, returning, or displaying information. A &amp;#039;&amp;#039;&amp;#039;class&amp;#039;&amp;#039;&amp;#039; is a description from which objects can be created in class-based object-oriented languages.&lt;br /&gt;
&lt;br /&gt;
This aiMOOC is designed for &amp;#039;&amp;#039;&amp;#039;Grades 11–13&amp;#039;&amp;#039;&amp;#039;. You should already be comfortable with variables, conditions, loops, functions, and basic data structures. The examples use Python because its class syntax is compact, while comparisons with Java and C++ show that the same design ideas can be expressed differently across languages.&lt;br /&gt;
&lt;br /&gt;
By the end of the course, you should be able to explain classes and objects, design encapsulated classes, use inheritance and composition appropriately, reason about polymorphism, read basic [[English:Unified Modeling Language|UML]] diagrams, test object behavior, and evaluate object-oriented designs rather than merely copying syntax.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|https://www.youtube.com/watch?v=SiBw7os-_zI|500|center}}&lt;br /&gt;
&lt;br /&gt;
The video above gives a compact overview of encapsulation, abstraction, inheritance, and polymorphism. These four ideas are often taught as the main pillars of OOP, but real object-oriented languages differ, and good design also depends on composition, interfaces, testing, and clear responsibilities.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Historical Context =&lt;br /&gt;
&lt;br /&gt;
Object-oriented ideas developed over decades. [[English:Simula|Simula]] in the 1960s introduced important class and object concepts. In the 1970s, [[English:Smalltalk|Smalltalk]] made message passing and objects central to its programming model. Alan Kay, one of the influential researchers associated with Smalltalk at Xerox PARC, helped popularize the term &amp;quot;object-oriented programming.&amp;quot; Modern languages such as Java, C++, Python, C#, Kotlin, Swift, and Ruby use different combinations of object-oriented features.&lt;br /&gt;
&lt;br /&gt;
[[File:Alan Kay.jpg|400px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
Alan Kay during a 2005 presentation. Studying the history of OOP helps you see that it is not one fixed recipe but a family of ideas about how software entities can hold state and cooperate through behavior.&lt;br /&gt;
&lt;br /&gt;
[[File:Alto-smalltalk.png|500px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
The Smalltalk environment illustrates an important historical idea: programs can be explored as networks of objects, classes, and messages inside an interactive development environment.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Classes, Objects, State, and Behavior =&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Classes and Instances ==&lt;br /&gt;
&lt;br /&gt;
In a class-based language, a &amp;#039;&amp;#039;&amp;#039;class&amp;#039;&amp;#039;&amp;#039; defines a kind of object. An &amp;#039;&amp;#039;&amp;#039;instance&amp;#039;&amp;#039;&amp;#039; is one concrete object created from that class. If `Book` is a class, then one object may represent a particular novel while another represents a textbook. Both use the same class definition, but each can store different instance data.&lt;br /&gt;
&lt;br /&gt;
A constructor or initializer establishes an object&amp;#039;s starting state. Instance methods define operations that act on that state. In Python, `__init__` is the method normally used to initialize a new instance after it is created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Book:&lt;br /&gt;
    def __init__(self, title, pages):&lt;br /&gt;
        self.title = title&lt;br /&gt;
        self.pages = pages&lt;br /&gt;
        self.available = True&lt;br /&gt;
&lt;br /&gt;
    def borrow(self):&lt;br /&gt;
        if self.available:&lt;br /&gt;
            self.available = False&lt;br /&gt;
            return True&lt;br /&gt;
        return False&lt;br /&gt;
&lt;br /&gt;
book_a = Book(&amp;quot;The Time Machine&amp;quot;, 128)&lt;br /&gt;
book_b = Book(&amp;quot;Algorithms&amp;quot;, 700)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
`book_a` and `book_b` are different objects. A change to `book_a.available` does not automatically change `book_b.available`. This distinction between a class-level description and instance-level state is fundamental.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|https://www.youtube.com/watch?v=e4fwY9ZsxPw|500|center}}&lt;br /&gt;
&lt;br /&gt;
The CS50P lecture above develops classes, objects, instance methods, validation, properties, class methods, inheritance, and operator overloading in Python. Use the chapter markers to revisit individual concepts after reading the sections below.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Reading a Class Diagram ==&lt;br /&gt;
&lt;br /&gt;
A UML class diagram can show classes, attributes, operations, and relationships. A class box is often divided into compartments for the class name, its attributes, and its methods. UML is a modeling language, not executable code, so the same diagram can guide implementations in different programming languages.&lt;br /&gt;
&lt;br /&gt;
[[File:UML class diagram example.svg|600px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
When you read a class diagram, ask: What responsibility does each class have? Which data belongs inside it? Which operations should it expose? Which relationships are essential? A diagram is useful only when it improves thinking and communication.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Encapsulation and Abstraction =&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Encapsulation ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Encapsulation&amp;#039;&amp;#039;&amp;#039; means bundling related state and behavior and controlling how internal state is accessed or changed. The goal is not simply to make fields private. The deeper goal is to protect valid states and provide a clear public interface.&lt;br /&gt;
&lt;br /&gt;
Suppose a `BankAccount` balance must never be changed by arbitrary code. A deposit method can reject invalid amounts before modifying the state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class BankAccount:&lt;br /&gt;
    def __init__(self, owner):&lt;br /&gt;
        self.owner = owner&lt;br /&gt;
        self._balance = 0.0&lt;br /&gt;
&lt;br /&gt;
    def deposit(self, amount):&lt;br /&gt;
        if amount &amp;lt;= 0:&lt;br /&gt;
            raise ValueError(&amp;quot;Amount must be positive&amp;quot;)&lt;br /&gt;
        self._balance += amount&lt;br /&gt;
&lt;br /&gt;
    def balance(self):&lt;br /&gt;
        return self._balance&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Python&amp;#039;s single leading underscore is a convention signaling non-public use; it is not the same as Java&amp;#039;s compiler-enforced `private` access. Java and C++ provide explicit access modifiers. This difference matters: encapsulation is a design principle, while access-control syntax is one language mechanism that can support it.&lt;br /&gt;
&lt;br /&gt;
[[File:UML class diagram with access modifiers.svg|600px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
In UML class diagrams, visibility symbols can indicate public, protected, and private members. The diagram helps you reason about which parts of a class form its external contract and which are implementation details.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Abstraction ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Abstraction&amp;#039;&amp;#039;&amp;#039; means focusing on essential capabilities while hiding unnecessary implementation detail. When you call `list.append` in Python or `add` on a Java collection, you use an operation without needing to know every internal step.&lt;br /&gt;
&lt;br /&gt;
An interface or abstract base class can describe what collaborating objects must be able to do. In Java, an interface declares a contract that implementing classes must satisfy. In Python, similar designs can be expressed through abstract base classes, protocols, or simpler duck typing depending on the situation.&lt;br /&gt;
&lt;br /&gt;
Good abstraction reduces the amount of information you must hold in your head at once. Bad abstraction can make code harder to understand if it introduces layers without a clear purpose.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Inheritance, Overriding, and Polymorphism =&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Inheritance ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inheritance&amp;#039;&amp;#039;&amp;#039; creates a relationship in which a subclass derives features from a superclass. It is often described with an &amp;quot;is-a&amp;quot; relationship: a `SavingsAccount` is a kind of `BankAccount`. Inheritance can reduce duplication and support substitution, but deep class hierarchies can become rigid and difficult to change.&lt;br /&gt;
&lt;br /&gt;
[[File:CPT-OOP-inheritance.svg|600px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
The inheritance diagram above uses vehicles to show a hierarchy. A useful design question is whether every subclass can safely be treated as the superclass. If the answer is doubtful, inheritance may be the wrong relationship.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Notification:&lt;br /&gt;
    def send(self, message):&lt;br /&gt;
        raise NotImplementedError&lt;br /&gt;
&lt;br /&gt;
class EmailNotification(Notification):&lt;br /&gt;
    def send(self, message):&lt;br /&gt;
        return f&amp;quot;Email sent: {message}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class SmsNotification(Notification):&lt;br /&gt;
    def send(self, message):&lt;br /&gt;
        return f&amp;quot;SMS sent: {message}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
`EmailNotification` and `SmsNotification` override the same operation with different implementations.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Polymorphism ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Polymorphism&amp;#039;&amp;#039;&amp;#039; allows the same operation to work with objects of different concrete types. In the example below, the loop does not need a separate `if` statement for each notification type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
channels = [EmailNotification(), SmsNotification()]&lt;br /&gt;
&lt;br /&gt;
for channel in channels:&lt;br /&gt;
    print(channel.send(&amp;quot;Exam room changed&amp;quot;))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expression `channel.send(...)` has the same shape each time, but the concrete object determines which implementation runs. This is subtype polymorphism through method overriding. Other forms of polymorphism also exist, including parametric polymorphism through generics.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|https://www.youtube.com/watch?v=wN0x9eZLix4|500|center}}&lt;br /&gt;
&lt;br /&gt;
The C++ course above shows classes, access control, constructors, encapsulation, abstraction, inheritance, and polymorphism in another language. Compare its syntax with Python rather than assuming that every language implements OOP in exactly the same way.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Composition and Object Collaboration =&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Composition&amp;#039;&amp;#039;&amp;#039; means building an object from other objects. It usually represents a &amp;quot;has-a&amp;quot; relationship. A `Car` has an `Engine`; a `Course` has enrolled `Student` objects; a `Library` has a collection of `Book` objects.&lt;br /&gt;
&lt;br /&gt;
Composition is often more flexible than inheritance because collaborators can be replaced without forcing everything into one class hierarchy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Engine:&lt;br /&gt;
    def start(self):&lt;br /&gt;
        return &amp;quot;engine started&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Car:&lt;br /&gt;
    def __init__(self, engine):&lt;br /&gt;
        self.engine = engine&lt;br /&gt;
&lt;br /&gt;
    def start(self):&lt;br /&gt;
        return self.engine.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here `Car` delegates starting behavior to an `Engine`. The car does not need to inherit from the engine. This separation also makes testing easier because a test double could be supplied in place of a real engine.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Message passing&amp;#039;&amp;#039;&amp;#039; is a useful mental model for object collaboration: one object asks another object to perform an operation. In most mainstream OOP languages, this appears as a method call.&lt;br /&gt;
&lt;br /&gt;
[[File:CPT-Sequence-diagram.svg|400px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
A UML sequence diagram emphasizes interactions over time. It can help you trace which object sends a request, which object responds, and where responsibilities are concentrated.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Designing with UML and Responsibilities =&lt;br /&gt;
&lt;br /&gt;
Before writing code, you can sketch a system in terms of responsibilities. Consider a school media-lending system:&lt;br /&gt;
&lt;br /&gt;
# [[English:Library item|Library item]]: Stores shared information such as title and inventory identifier.&lt;br /&gt;
# [[English:Book|Book]]: Adds book-specific data such as author or ISBN.&lt;br /&gt;
# [[English:Borrower|Borrower]]: Represents a person allowed to borrow items.&lt;br /&gt;
# [[English:Loan|Loan]]: Records which borrower has which item and when it is due.&lt;br /&gt;
# [[English:Library service|Library service]]: Coordinates borrowing rules rather than putting every rule into one large data class.&lt;br /&gt;
&lt;br /&gt;
A strong class usually has &amp;#039;&amp;#039;&amp;#039;high cohesion&amp;#039;&amp;#039;&amp;#039;: its fields and methods contribute to a focused purpose. Classes should also avoid unnecessary &amp;#039;&amp;#039;&amp;#039;coupling&amp;#039;&amp;#039;&amp;#039;, meaning they should depend on as few implementation details of other classes as practical.&lt;br /&gt;
&lt;br /&gt;
[[File:UML diagram of classes that model pages and titles in MediaWiki.svg|700px|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
This real-world class diagram from the MediaWiki codebase is intentionally more complex than the earlier examples. Do not try to memorize it. Instead, identify repeated design signals: interfaces, class relationships, dependencies, and groups of responsibilities.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Interfaces and Dependency Boundaries ==&lt;br /&gt;
&lt;br /&gt;
Interfaces can separate what a component needs from how another component provides it. For example, a `ReportService` might depend on a `Storage` interface rather than directly on one database class. Then a test can use an in-memory implementation, while production code can use a database implementation.&lt;br /&gt;
&lt;br /&gt;
This idea supports the principle of programming to a stable abstraction rather than to a volatile implementation. It can reduce coupling, but interfaces should be introduced where they clarify a real boundary rather than everywhere by habit.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Design Principles for Advanced Learners ==&lt;br /&gt;
&lt;br /&gt;
The [[English:SOLID|SOLID]] principles are a widely discussed set of object-oriented design guidelines. At Grades 11–13, use them as questions rather than absolute rules:&lt;br /&gt;
&lt;br /&gt;
# [[English:Single-responsibility principle|Single-responsibility principle]]: Does this class have one focused reason to change?&lt;br /&gt;
# [[English:Open–closed principle|Open–closed principle]]: Can new behavior be added without repeatedly rewriting stable code?&lt;br /&gt;
# [[English:Liskov substitution principle|Liskov substitution principle]]: Can a subtype be used wherever its base type is expected without breaking the intended behavior?&lt;br /&gt;
# [[English:Interface segregation principle|Interface segregation principle]]: Are clients forced to depend on operations they do not need?&lt;br /&gt;
# [[English:Dependency inversion principle|Dependency inversion principle]]: Do high-level policies avoid depending directly on low-level implementation details?&lt;br /&gt;
&lt;br /&gt;
These principles can conflict with simplicity if applied mechanically. A small program may need only a few clear classes. Good design is judged by readability, correctness, adaptability, and testability in context.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Testing and Debugging Object-Oriented Code =&lt;br /&gt;
&lt;br /&gt;
Unit tests should verify observable behavior and important state transitions. For example, a borrowing test can check that an available item becomes unavailable after a successful loan, that a second loan attempt is rejected, and that returning the item restores availability.&lt;br /&gt;
&lt;br /&gt;
A useful testing habit is to arrange the initial objects, perform one meaningful action, and then assert the expected outcome. When a class is difficult to test, that may reveal excessive coupling, hidden dependencies, or too many responsibilities.&lt;br /&gt;
&lt;br /&gt;
Common design and debugging problems include:&lt;br /&gt;
# [[English:Shared mutable state|Shared mutable state]]: Multiple objects unexpectedly change the same data.&lt;br /&gt;
# [[English:God object|God object]]: One class controls too many unrelated responsibilities.&lt;br /&gt;
# [[English:Deep inheritance hierarchy|Deep inheritance hierarchy]]: Behavior is spread across many ancestor classes.&lt;br /&gt;
# [[English:Leaky abstraction|Leaky abstraction]]: Clients must understand internal details to use a class correctly.&lt;br /&gt;
# [[English:Primitive obsession|Primitive obsession]]: Domain ideas are represented only by strings or numbers when a small dedicated type would improve validity and clarity.&lt;br /&gt;
&lt;br /&gt;
Refactoring changes the internal structure of code while preserving intended external behavior. Useful refactorings include extracting a method, extracting a class, replacing a conditional with polymorphism when justified, or replacing inheritance with composition when a hierarchy is unstable.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Comparing OOP Across Languages =&lt;br /&gt;
&lt;br /&gt;
OOP is not identical in every language. Python supports multiple inheritance and dynamic attribute lookup. Java allows a class to extend one direct superclass while implementing multiple interfaces. C++ supports multiple inheritance and gives programmers detailed control over object lifetime and memory management. JavaScript uses prototype-based inheritance rather than the classical class model underneath its `class` syntax.&lt;br /&gt;
&lt;br /&gt;
You should therefore separate &amp;#039;&amp;#039;&amp;#039;design concepts&amp;#039;&amp;#039;&amp;#039; from &amp;#039;&amp;#039;&amp;#039;language syntax&amp;#039;&amp;#039;&amp;#039;. The question &amp;quot;What is the responsibility of this object?&amp;quot; is language-independent. The question &amp;quot;How do I declare a private field?&amp;quot; depends on the language.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|https://www.youtube.com/watch?v=g7QWqKj0ch8|500|center}}&lt;br /&gt;
&lt;br /&gt;
This CS50 Beyond lecture places object-oriented programming beside other computer-science ideas. Use it to reflect on when OOP is one helpful tool among several rather than the only possible programming style.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Responsible and Effective Use of OOP =&lt;br /&gt;
&lt;br /&gt;
OOP is useful when a problem contains entities with meaningful state, behavior, and collaboration. It can be especially effective in graphical applications, simulations, games, enterprise systems, and large codebases with clear domain concepts. It is not automatically the best solution for every task. Small scripts, data pipelines, numerical programs, and functional designs may be clearer with other structures.&lt;br /&gt;
&lt;br /&gt;
The key question is not &amp;quot;How many classes can I create?&amp;quot; but &amp;quot;Which structure makes the program easiest to understand, test, change, and use correctly?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Reliable References =&lt;br /&gt;
&lt;br /&gt;
For further study, compare explanations from several authoritative sources:&lt;br /&gt;
# [https://dev.java/learn/oop/ Dev.java: Objects, Classes, Interfaces, Packages, and Inheritance]&lt;br /&gt;
# [https://docs.python.org/3/tutorial/classes.html Python documentation: Classes]&lt;br /&gt;
# [https://en.wikipedia.org/wiki/Object-oriented_programming Wikipedia: Object-oriented programming]&lt;br /&gt;
# [https://commons.wikimedia.org/wiki/Class_diagram Wikimedia Commons: Class diagrams]&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Interactive Tasks =&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Quiz: Test Your Knowledge ==&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What is an object in class-based object-oriented programming?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(An instance that combines state with behavior)&lt;br /&gt;
(!A file that contains only comments)&lt;br /&gt;
(!A loop that repeats class definitions)&lt;br /&gt;
(!A diagram that can execute itself)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What is the main role of a class?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(To define a kind of object and its shared structure and behavior)&lt;br /&gt;
(!To guarantee that every program uses inheritance)&lt;br /&gt;
(!To replace all functions in a program)&lt;br /&gt;
(!To store only global variables)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Which idea focuses on protecting valid internal state behind a controlled interface?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(Encapsulation)&lt;br /&gt;
(!Compilation)&lt;br /&gt;
(!Recursion)&lt;br /&gt;
(!Serialization)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Which relationship is best described as a car has an engine?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(Composition)&lt;br /&gt;
(!Inheritance)&lt;br /&gt;
(!Overriding)&lt;br /&gt;
(!Iteration)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What happens when a subclass provides its own implementation of an inherited method?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(The method is overridden)&lt;br /&gt;
(!The object becomes immutable)&lt;br /&gt;
(!The class is deleted)&lt;br /&gt;
(!The method becomes a variable)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What does subtype polymorphism allow?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(The same operation to use different implementations for different object types)&lt;br /&gt;
(!Every object to contain identical data)&lt;br /&gt;
(!A program to avoid all type relationships)&lt;br /&gt;
(!A constructor to run more than once automatically)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;What does a UML class diagram primarily describe?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(Classes attributes operations and relationships)&lt;br /&gt;
(!The exact CPU instructions of a running program)&lt;br /&gt;
(!Only the order of loop iterations)&lt;br /&gt;
(!The physical wiring of a computer)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Why can composition be preferable to inheritance?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(It can reduce rigid class hierarchies and make collaborators replaceable)&lt;br /&gt;
(!It prevents objects from having methods)&lt;br /&gt;
(!It removes the need for testing)&lt;br /&gt;
(!It makes all fields public)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Which statement about OOP across languages is correct?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(Object-oriented concepts are similar but language mechanisms differ)&lt;br /&gt;
(!All object-oriented languages use identical syntax)&lt;br /&gt;
(!All object-oriented languages require multiple inheritance)&lt;br /&gt;
(!All object-oriented languages enforce privacy in the same way)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MC}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Which quality describes a class whose members contribute to one focused purpose?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
(High cohesion)&lt;br /&gt;
(!High randomness)&lt;br /&gt;
(!High duplication)&lt;br /&gt;
(!High ambiguity)&lt;br /&gt;
&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Memory Game ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;memo-quiz&amp;quot;&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| Class || Blueprint or definition used to create objects&lt;br /&gt;
|-&lt;br /&gt;
| Instance || One concrete object created from a class&lt;br /&gt;
|-&lt;br /&gt;
| Encapsulation || Controlled access to internal state through a defined interface&lt;br /&gt;
|-&lt;br /&gt;
| Inheritance || Deriving a more specific class from a more general one&lt;br /&gt;
|-&lt;br /&gt;
| Polymorphism || Using one operation with different concrete implementations&lt;br /&gt;
|-&lt;br /&gt;
| Composition || Building an object from collaborating contained objects&lt;br /&gt;
|-&lt;br /&gt;
| Cohesion || Degree to which a class has a focused responsibility&lt;br /&gt;
|}&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Drag and Drop ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;lueckentext-quiz&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Match the correct terms.&lt;br /&gt;
! Topic&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Protect internal state with methods&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Encapsulation&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Create a specialized subtype&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Inheritance&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Delegate work to a contained collaborator&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Composition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Use the same call on different concrete types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Polymorphism&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Show static class relationships&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| Class diagram&lt;br /&gt;
|}&lt;br /&gt;
{{E}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Crossword Puzzle ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;kreuzwort-quiz&amp;quot;&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| Encapsulation || Which concept controls access to internal state through a public interface?&lt;br /&gt;
|-&lt;br /&gt;
| Inheritance || Which mechanism derives a subclass from a superclass?&lt;br /&gt;
|-&lt;br /&gt;
| Polymorphism || Which concept lets one operation use different implementations?&lt;br /&gt;
|-&lt;br /&gt;
| Abstraction || Which concept hides unnecessary implementation detail?&lt;br /&gt;
|-&lt;br /&gt;
| Constructor || What initializes a newly created object in many class-based languages?&lt;br /&gt;
|-&lt;br /&gt;
| Interface || What defines a contract of operations that an implementing class agrees to provide?&lt;br /&gt;
|}&lt;br /&gt;
{{E}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== LearningApps ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;iframe&amp;gt; https://learningapps.org/index.php?s=Object-Oriented+Programming &amp;lt;/iframe&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
== Cloze Text ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;quiz display=simple&amp;gt;&lt;br /&gt;
{&amp;#039;&amp;#039;&amp;#039;Complete the text.&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
|type=&amp;quot;{}&amp;quot;}&lt;br /&gt;
A class defines a kind of { object } and its shared structure. One concrete object created from a class is called an { instance }. Data stored by an object represents its { state }. Operations associated with an object are commonly called { methods }. Protecting internal state behind a controlled interface supports { encapsulation }. Hiding unnecessary implementation detail is called { abstraction }. A subclass can derive features from a superclass through { inheritance }. Different object types can respond to the same operation through { polymorphism }. Building an object from contained collaborators is called { composition }. UML can represent static class relationships in a class { diagram }.&lt;br /&gt;
&amp;lt;/quiz&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Open-Ended Tasks =&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
=== Easy ===&lt;br /&gt;
# [[English:Object inventory|Object inventory]]: Find five objects in your classroom or home. For each one, list possible state and behavior, then decide which details would belong in a software class.&lt;br /&gt;
# [[English:Class card|Class card]]: Design one class card for a school-related object with a class name, at least three attributes, and at least three methods.&lt;br /&gt;
# [[English:Instance comparison|Instance comparison]]: Create two instances of the same simple class in Python, give them different state, and explain why changing one instance does not automatically change the other.&lt;br /&gt;
# [[English:UML sketch|UML sketch]]: Draw a basic UML class diagram for a `Student` class and annotate what each compartment means.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
=== Standard ===&lt;br /&gt;
# [[English:Encapsulation experiment|Encapsulation experiment]]: Implement a class with one state invariant, such as a non-negative balance or bounded score, and write tests showing that invalid updates are rejected.&lt;br /&gt;
# [[English:Inheritance review|Inheritance review]]: Build a small superclass and two subclasses, override one method, then explain where polymorphism appears when the objects are stored in one collection.&lt;br /&gt;
# [[English:Composition redesign|Composition redesign]]: Take a design that uses inheritance and redesign it using composition. Compare flexibility, coupling, and readability.&lt;br /&gt;
# [[English:Sequence diagram project|Sequence diagram project]]: Model a borrowing or login process with at least three collaborating objects and create a UML sequence diagram that shows the messages between them.&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
=== Advanced ===&lt;br /&gt;
# [[English:Design interview|Design interview]]: Interview a software developer or advanced computing student about when they prefer composition, inheritance, or interfaces. Compare the interview with the design principles in this course.&lt;br /&gt;
# [[English:Refactoring investigation|Refactoring investigation]]: Find or create a small program with a god object, split its responsibilities across coherent classes, and document the behavior you preserved with tests.&lt;br /&gt;
# [[English:Cross-language OOP study|Cross-language OOP study]]: Implement the same two-class design in two languages such as Python and Java, then produce a short video explaining differences in access control, inheritance, constructors, and typing.&lt;br /&gt;
# [[English:Architecture challenge|Architecture challenge]]: Design a small school media-lending system with classes, interfaces or abstract types, composition, tests, and UML diagrams. Justify each major dependency and identify one design you deliberately rejected.&lt;br /&gt;
&lt;br /&gt;
{{:Open Task - Create a MOOC}}&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Learning Assessment =&lt;br /&gt;
&lt;br /&gt;
# [[English:Model a changing system|Model a changing system]]: Design an object model for a bicycle-rental system in which bicycles can be available, reserved, rented, or under repair; justify where each state change is controlled and explain how your design prevents invalid transitions.&lt;br /&gt;
# [[English:Evaluate inheritance|Evaluate inheritance]]: Given a proposed hierarchy in which `Rectangle` inherits from `Square` or `Square` inherits from `Rectangle`, analyze substitution problems and recommend inheritance, composition, or separate types with reasons.&lt;br /&gt;
# [[English:Refactor conditional logic|Refactor conditional logic]]: Transform a program that uses repeated type checks for payment methods into a polymorphic design, then explain whether the change improved cohesion and extensibility enough to justify the added abstraction.&lt;br /&gt;
# [[English:Test an abstraction boundary|Test an abstraction boundary]]: Create unit tests for a service that depends on a storage interface, use a test double in place of real storage, and explain what this reveals about coupling.&lt;br /&gt;
# [[English:Compare language mechanisms|Compare language mechanisms]]: Explain how encapsulation and inheritance differ between Python and Java, distinguishing the design idea from the syntax used by each language.&lt;br /&gt;
# [[English:Defend a design|Defend a design]]: Present a UML class diagram and sequence diagram for a small application, then defend your assignment of responsibilities against an alternative design proposed by a peer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Evidence of Learning =&lt;br /&gt;
&lt;br /&gt;
Evidence of learning should show more than vocabulary recall. Strong evidence includes:&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Knowledge&amp;#039;&amp;#039;&amp;#039;: Accurate explanations of classes, objects, state, behavior, encapsulation, abstraction, inheritance, composition, polymorphism, interfaces, cohesion, coupling, and UML relationships.&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Programming skills&amp;#039;&amp;#039;&amp;#039;: Correct creation of classes and instances, controlled state changes, method overriding, collaborator injection, and meaningful automated tests.&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Design skills&amp;#039;&amp;#039;&amp;#039;: Clear responsibility assignment, justified use or rejection of inheritance, appropriate composition, and recognition of excessive coupling or weak cohesion.&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Products&amp;#039;&amp;#039;&amp;#039;: Working source code, UML class diagrams, sequence diagrams, test suites, refactoring notes, comparison reports, or explanatory videos.&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Reasoning&amp;#039;&amp;#039;&amp;#039;: Explanations that connect a design decision to consequences for correctness, readability, testability, and future change.&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;Transfer&amp;#039;&amp;#039;&amp;#039;: Ability to recognize object-oriented ideas in a new language or domain and to choose a different programming style when OOP would not improve the solution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= OERs on the Topic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;iframe&amp;gt; https://en.m.wikipedia.org/wiki/Object-oriented_programming &amp;lt;/iframe&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= Linked Learning Areas =&lt;br /&gt;
&lt;br /&gt;
{| align=center&lt;br /&gt;
{{:D-Tab}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[English:Object-Oriented Programming|Object-Oriented Programming]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
# [[English:Class|Class]]&lt;br /&gt;
# [[English:Object|Object]]&lt;br /&gt;
# [[English:Encapsulation|Encapsulation]]&lt;br /&gt;
# [[English:Abstraction|Abstraction]]&lt;br /&gt;
# [[English:Inheritance|Inheritance]]&lt;br /&gt;
# [[English:Polymorphism|Polymorphism]]&lt;br /&gt;
# [[English:Composition over inheritance|Composition over inheritance]]&lt;br /&gt;
# [[English:Interface|Interface]]&lt;br /&gt;
# [[English:Unified Modeling Language|Unified Modeling Language]]&lt;br /&gt;
# [[English:Software design pattern|Software design pattern]]&lt;br /&gt;
# [[English:Unit testing|Unit testing]]&lt;br /&gt;
# [[English:Refactoring|Refactoring]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{BR}}&lt;br /&gt;
= aiMOOC Projects =&lt;br /&gt;
[[Category:English]]&lt;br /&gt;
[[Category:Object-Oriented Programming]]&lt;br /&gt;
[[Category:Computer Science]]&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:Software Engineering]]&lt;br /&gt;
[[Category:Grades 11-13]]&lt;br /&gt;
[[Category:AI_MOOC]]&lt;br /&gt;
[[Category:GPT aiMOOC]]&lt;br /&gt;
{{MT}}&lt;/div&gt;</summary>
		<author><name>Glanz</name></author>
	</entry>
</feed>