-
Couldn't load subscription status.
- Fork 89
Tłumaczenie #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Tłumaczenie #85
Changes from 7 commits
541ba77
d25f5af
cc91c93
777f9c6
5a4e806
67156e1
04d8280
2ea9640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,117 @@ | ||
| # Object Oriented Programming | ||
|
|
||
| <a href="https://coders.school"> | ||
| <img width="500" data-src="coders_school_logo.png" src="coders_school_logo.png" alt="Coders School" class="plain"> | ||
| </a> | ||
|
|
||
| # Programowanie obiektowe | ||
|
|
||
| ## [Moduł 1](module1/) | ||
|
|
||
| ### [Wprowadzenie do programowania obiektowego](module1/presentation_oop_intro.md) | ||
| ### [Wprowadzenie](module1/00_intro.pl.md) | ||
|
|
||
| ### [Modyfikatory dostępu](module1/presentation_access_modifiers.md) | ||
| ### [Modyfikatory dostępu](module1/01_access_modifiers.pl.md) | ||
|
|
||
| ### [Konstruktory i destruktory](module1/presentation_ctor_dtor.md) | ||
| ### [Konstruktory i destruktory](module1/02_ctor_dtor.pl.md) | ||
|
|
||
| ### [Hermetyzacja](module1/presentation_hermetization.md) | ||
| ### [Hermetyzacja](module1/03_hermetization.pl.md) | ||
|
|
||
| ### [Zadania](module1/presentation_tasks.md) | ||
| ### [Zadania](module1/04_tasks.pl.md) | ||
|
|
||
| ### [Projekt grupowy](module1/presentation_homework.md) | ||
| ### [Zadanie domowe](module1/05_homework.pl.md) | ||
|
|
||
| ## [Moduł 2](module2/) | ||
|
|
||
| ### [Dziedziczenie](module2/presentation_inheritance.md) | ||
| ### [Dziedziczenie](module2/00_inheritance.pl.md) | ||
|
|
||
| ### [Metody wirtualne, interfejsy, klasy abstrakcyjne](module2/presentation_virtual.md) | ||
| ### [Metody wirtualne, interfejsy, klasy abstrakcyjne](module2/01_virtual.pl.md) | ||
|
|
||
| ### [Polimorfizm](module2/presentation_polymorphism.md) | ||
| ### [Polimorfizm](module2/02_polymorphism.pl.md) | ||
|
|
||
| ### [Zmienne i funkcje statyczne](module2/presentation_static.md) | ||
| ### [Zmienne i funkcje statyczne](module2/03_static.pl.md) | ||
|
|
||
| ### [Projekt grupowy](module2/presentation_homework.md) | ||
| ### [Zadanie domowe](module2/04_homework.pl.md) | ||
|
|
||
| ### [Przykładowe rozwiązania](module2/05_solutions.pl.md) | ||
|
|
||
| ## [Moduł 3](module3/) | ||
|
|
||
| ### [Przykładowe rozwiązania](module3/presentation_solutions.md) | ||
| ### [Przykładowe rozwiązania](module3/00_solutions.pl.md) | ||
|
|
||
| ### [Polimorfizm](module3/presentation_polymorphism.md) | ||
| ### [Polimorfizm](module3/01_polymorphism.pl.md) | ||
|
|
||
| ### [Zmienne i funkcje statyczne](module3/presentation_static.md) | ||
| ### [Zmienne i funkcje statyczne](module3/02_static.pl.md) | ||
|
|
||
| ### [Projekt grupowy](module3/presentation_homework.md) | ||
| ### [Zadanie domowe](module3/03_homework.pl.md) | ||
|
|
||
| ## [Moduł 4](module4/) | ||
|
|
||
| ### [Cztery filary obiektowości](module4/pillars.md) | ||
| ### [Cztery filary obiektowości](module4/00_pillars.pl.md) | ||
|
|
||
| ### [Abstrakcja](module4/01_abstraction.pl.md) | ||
|
|
||
| ### [Enkapsulacja](module4/02_encapsulation.pl.md) | ||
|
|
||
| ### [Dziedziczenie](module4/03_inheritance.pl.md) | ||
|
|
||
| ### [Polimorfizm](module4/04_polymorphism.pl.md) | ||
|
|
||
| ### [Zadanie](module4/05_exercise_cars.pl.md) | ||
|
|
||
| ### [Post-work](module4/06_post_work.pl.md) | ||
|
|
||
| ___ | ||
|
|
||
| # Object Oriented Programming | ||
|
|
||
| ## [Module 1](module1/) | ||
|
|
||
| ### [Introduction](module1/00_intro.en.md) | ||
|
|
||
| ### [Access modifiers](module1/01_access_modifiers.en.md) | ||
|
|
||
| ### [Constructors and destructors](module1/02_ctor_dtor.en.md) | ||
|
|
||
| ### [Hermetization](module1/03_hermetization.en.md) | ||
|
|
||
| ### [Exercises](module1/04_tasks.en.md) | ||
|
|
||
| ### [Homework](module1/05_homework.en.md) | ||
|
|
||
| ## [Module 2](module2/) | ||
|
|
||
| ### [Inheritance](module2/00_inheritance.en.md) | ||
|
|
||
| ### [Virtual methods, interfaces, abstract classes](module2/01_virtual.en.md) | ||
|
|
||
| ### [Polymorphism](module2/02_polymorphism.en.md) | ||
|
|
||
| ### [Static variables and functions](module2/03_static.en.md) | ||
|
|
||
| ### [Homework](module2/04_homework.en.md) | ||
|
|
||
| ### [Examples of solutions](module2/05_solutions.en.md) | ||
|
|
||
| ## [Module 3](module3/) | ||
|
|
||
| ### [Examples of solutions](module3/00_solutions.en.md) | ||
|
|
||
| ### [Polymorphism](module3/01_polymorphism.en.md) | ||
|
|
||
| ### [Static variables and functions](module3/02_static.en.md) | ||
|
|
||
| ### [Homework](module3/03_homework.en.md) | ||
|
|
||
| ## [Module 4](module4/) | ||
|
|
||
| ### [The four pillars of objectivity](module4/00_pillars.en.md) | ||
|
|
||
| ### [Abstrakcja](module4/abstraction.md) | ||
| ### [Abstraction](module4/01_abstraction.en.md) | ||
|
|
||
| ### [Enkapsulacja](module4/encapsulation.md) | ||
| ### [Encapsulation](module4/02_encapsulation.en.md) | ||
|
|
||
| ### [Dziedziczenie](module4/inheritance.md) | ||
| ### [Inheritance](module4/03_inheritance.en.md) | ||
|
|
||
| ### [Polimorfizm](module4/polymorphism.md) | ||
| ### [Polymorphism](module4/04_polymorphism.en.md) | ||
|
|
||
| ### [Zadanie](module4/exercise_cars.md) | ||
| ### [Exercise](module4/05_exercise_cars.en.md) | ||
|
|
||
| ### [Post-work](module4/post_work.md) | ||
| ### [Post-work](module4/06_post_work.en.md) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| <!-- .slide: data-background="#111111" --> | ||
|
|
||
| # Object oriented programming | ||
|
|
||
| <a href="https://coders.school"> | ||
| <img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain"> | ||
| </a> | ||
|
|
||
| ___ | ||
|
|
||
| ## SHM (Sea Trade Simulator) | ||
|
|
||
| <img height="500" data-src="img/statek.png" src="https://github.com/coders-school/object-oriented-programming/raw/master/module1/img/statek.png" alt="Statek" class="plain"> | ||
|
|
||
| ___ | ||
| <!-- .slide: data-background="#eeeeee" --> | ||
|
|
||
| ## SHM - UML diagram | ||
|
|
||
| <a href="https://raw.githubusercontent.com/coders-school/object-oriented-programming/master/shm-uml.svg"> | ||
| <img height="500" data-src="../shm-uml.svg" src="https://raw.githubusercontent.com/coders-school/object-oriented-programming/master/shm-uml.svg" alt="Diagram klas - SHM" class="plain"> | ||
| </a> | ||
|
|
||
| ___ | ||
|
|
||
| ## Introduction to object oriented programming | ||
|
|
||
| ___ | ||
|
|
||
| ### What is an Object? | ||
|
|
||
| An object in C++ is no different from an actual object in real life. An object is a "specific" object. We can have many identical objects. Some of them can be distinguished by names. In C++ we can have objects such as: | ||
|
|
||
| * <!-- .element: class="fragment fade-in" --> HP computer, Lenovo computer, MacBook computer | ||
| * <!-- .element: class="fragment fade-in" --> HP printer, Epson printer | ||
| * <!-- .element: class="fragment fade-in" --> Stabilo Schwan 306 HB pencil = 2 1/2 | ||
| * <!-- .element: class="fragment fade-in" --> Casio calculator | ||
| * <!-- .element: class="fragment fade-in" --> ... | ||
|
|
||
| The object exists in computer memory while the program is running. We can have many objects of the same type. | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| * <!-- .element: class="fragment fade-in" --> Type: <code>Dog</code> | ||
| * <!-- .element: class="fragment fade-in" --> Objects of type <code>Dog</code>: <code>Max</code>, <code>Milo</code>, <code>Coco</code>, ... | ||
|
|
||
| ___ | ||
|
|
||
| ### What is a class? | ||
|
|
||
| A class is a type. | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| A class in C++ is slightly different from an actual class 🙂 In C++ (or object-oriented programming in general) a class defines the characteristics of an object: | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| * <!-- .element: class="fragment fade-in" --> what properties will this object have (fields) | ||
| * <!-- .element: class="fragment fade-in" --> what methods of operation will it have (methods, functions) | ||
|
|
||
| ___ | ||
|
|
||
| ### Questions | ||
|
|
||
| * <!-- .element: class="fragment fade-in" --> what properties could a <code>computer</code> object have? | ||
| * <!-- .element: class="fragment fade-in" --> what methods could the <code>computer</code> have? | ||
|
|
||
| ```cpp | ||
| class Computer { | ||
| // fields | ||
| Processor processor_; | ||
| Drive drive_; | ||
| Motherboard motherboard_; | ||
| GraphicsCard graphics_card_; | ||
| Memory memory_; | ||
|
|
||
| // methods | ||
| void run(); | ||
| void restart(); | ||
| void shutdown(); | ||
| }; | ||
| ``` | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| ___ | ||
|
|
||
| ## Composition, aggregation | ||
|
|
||
| Nothing prevents one object from being composed of other objects. In this way, we make the structure of our code more understandable. | ||
|
|
||
| Containing one object within another is called composition or aggregation. These are not synonyms, they are two slightly different types of object containment, but that doesn't matter at the moment. For example with a computer: | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| ```cpp | ||
| class Computer { | ||
| Processor processor_; | ||
| Drive drive_; | ||
| Motherboard motherboard_; | ||
| GraphicsCard graphics_card_; | ||
| Memory memory_; | ||
| // ... | ||
| }; | ||
| ``` | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| A computer consists (is composed of) of a processor, drive, motherboard, graphics card, memory. | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| ___ | ||
| <!-- .slide: data-background="#eeeeee" --> | ||
|
|
||
| ## Class diagram - composition, aggregation | ||
|
|
||
| <img height="250" data-src="img/composition_aggregation.png" src="https://github.com/coders-school/object-oriented-programming/raw/master/module1/img/composition_aggregation.png" alt="Kompozycja i agregacja" class="plain"> | ||
|
|
||
| * <!-- .element: class="fragment fade-in" --> Composition: A car contains exactly 1 Carburetor. The carburetor is part of exactly one car. Without a car, the carburetor does nothing, so it cannot function without it. | ||
| * <!-- .element: class="fragment fade-in" --> Aggregation: Pond can contain any number (0 .. *) of Ducks. The duck may be in only one pond at a time or in none (0..1). The duck can live outside the pond. | ||
|
|
||
| [Class diagram - wikipedia](https://en.wikipedia.org/wiki/Class_diagram) | ||
| <!-- .element: class="fragment fade-in" --> | ||
|
|
||
| ___ | ||
|
|
||
| ## Q&A | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||
| <!-- .slide: data-background="#111111" --> | ||||||
|
|
||||||
| # Object oriented programming | ||||||
|
|
||||||
| ## Access modifiers | ||||||
|
|
||||||
| <a href="https://coders.school"> | ||||||
| <img width="500" data-src="../coders_school_logo.png" alt="Coders School" class="plain"> | ||||||
| </a> | ||||||
|
|
||||||
| ___ | ||||||
|
|
||||||
| ## `class` vs `struct` | ||||||
|
|
||||||
| To represent types outside classes (`class`) we still have structures (`struct`). | ||||||
| <!-- .element: class="fragment fade-in" --> | ||||||
|
|
||||||
| The main difference is that all structure elements - its methods and variables - are public by default. By contrast, in the class they are private by default. | ||||||
| <!-- .element: class="fragment fade-in" --> | ||||||
|
|
||||||
| Word `private` means that we only have access to these fields inside the class. We cannot appeal to them outside of this class. Word `public` means that we have external access to the data. | ||||||
| <!-- .element: class="fragment fade-in" --> | ||||||
|
|
||||||
| ___ | ||||||
|
|
||||||
| ## Access modifiers | ||||||
|
|
||||||
| ### `private` vs `public` | ||||||
|
|
||||||
| ```cpp | ||||||
| class Computer { | ||||||
| private: | ||||||
| void restart(); | ||||||
| }; | ||||||
|
|
||||||
| Computer computer; | ||||||
| computer.restart(); // Forbidden, restart is a private member | ||||||
| ``` | ||||||
| <!-- .element: class="fragment fade-in" --> | ||||||
|
|
||||||
| ```cpp | ||||||
| class Computer { | ||||||
| public: | ||||||
| void restart(); | ||||||
| }; | ||||||
|
|
||||||
| Computer computer; | ||||||
| computer.restart(); // Ok | ||||||
| ``` | ||||||
| <!-- .element: class="fragment fade-in" --> | ||||||
|
|
||||||
| ___ | ||||||
|
|
||||||
| ## Access modifier `protected` | ||||||
|
||||||
| ## Access modifier `protected` | |
| ### Access modifier `protected` |
I think it should be sub-paragraph of "Access modifiers"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it matters too much, but I'll add it. Thanks for suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that either abbrevation should be changed to STS or there should explanation something like |SHM(pol. Symulator handlu morskiego) - Sea Trade Simulator"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, putting polish version should clear things out. Thanks 🙂