1. OOP ¶
Object Oriented Programming : ๊ฐ์ฒด ์งํฅ ํ๋ก๊ทธ๋๋ฐ. ๊ฐ์ฒด๋ฅผ ์งํฅํ๋ ํ๋ก๊ทธ๋๋ฐ์
๋๋ค.์ด ์ด์ ์ Object Based Progamming ๊ฒ์ด ์์๋ค.์ด ๋ค์ ์ธ๋์ ํ๋ก๊ทธ๋๋ฐ ๊ธฐ๋ฒ์ GenericProgramming์ด๋ผ๊ณ ์ด์ผ๊ธฐ๋๋ค.
1.1.1. Definition ¶
Object-oriented programming is based in the principle of recursive design.
1. Everything is an object.
2. Objects perform computation by making requests of each other through the passing of messages.
3. Every object has it's own memory, which consists of other objects.
4. Every object is an instance of a class. A class groups similar objects.
5. The class is the repository for behabior associated with an object.
6. Classes are organized into singly-rooted tree structure, called an inheritance hirearchy.
1. Everything is an object.
2. Objects perform computation by making requests of each other through the passing of messages.
3. Every object has it's own memory, which consists of other objects.
4. Every object is an instance of a class. A class groups similar objects.
5. The class is the repository for behabior associated with an object.
6. Classes are organized into singly-rooted tree structure, called an inheritance hirearchy.
1.1.2. Basic Idea ¶
โEmphasis from verbs to nounsโ
Itโs a natural way for people to โthink in objectsโ.
Program consists of objects interacting with eachother Objects provide services.
Itโs a natural way for people to โthink in objectsโ.
Program consists of objects interacting with eachother Objects provide services.
1.2. ์ฉ์ด ¶
- Class
- Object
- Instance
- Association(์ฐ๊ด)
- Relation(๊ด๊ณ)
- Inheritance(์์)
- Method
- protocol
- Encapsulation(์บก์ํ)
- Interface
- Implementation(๊ตฌํ : ์ธ๊ฐ์ ๊ฐ๋
์์ ์กด์ฌํ๋ ์๊ฐ๊ณผ ์ฌ์ ๋ฑ์ ์ค์ ๋ฌผ๋ฆฌ์ ์ธ ๊ฐ์ฒด๋ก ๊ตฌ์ฑํ๋ ์ผ๋ จ์ ์์
. ์๋ฅผ ๋ค์ด ์๋ก์ด ๊ตฌ์กฐ์ ์ปดํจํฐ ์์คํ
์ ๋ง๋ค์ด ๋ด๋ ์์
๊ณผ ์ค๊ณ ๊ณผ์ ์ ๊ฑฐ์ณ์ ์ ๋ฌ๋ ๋ด์ฉ์ ์ค์ ํ๋ก๊ทธ๋จ์ผ๋ก ๊ตฌ์ฑํ์ฌ ์ปดํจํฐ์์ ์ฌ์ฉํ ์ ์๋๋ก ํ๋ ์์
๋ฑ์ด ๋ชจ๋ ๊ตฌํ ์์
์ ํ ๊ฐ์ง์ ํด๋น๋๋ค๊ณ ํ ์ ์๋ค. : ์ ๋ณด๋ฌธํ์ฌ ์ปดํจํฐ ์ฉ์ด์ฌ์ ๋ฐ์ท)
- Attribute
- Class variable
- Data member
- Member function
- Operation
- Private and public members
- Polymorfism
- Virtual functions
- Templates
- Generic programming
1.2.1. Basic rules to define objects ¶
Objects should correspond real word objects
Responsibily area should be simple and compact
All actions should be delegated to objects
Donโt mix responsibilities
Keep responsibily areas as general as possible to garantie reuse.
Responsibily area should be simple and compact
All actions should be delegated to objects
Donโt mix responsibilities
Keep responsibily areas as general as possible to garantie reuse.