631.70K
Category: programmingprogramming

История и основные моменты объектно-ориентированного программирования

1.

The history and the main points of
object-oriented programming
Mayorov Alexey
21.M09-пу

2.

Programming paradigms
• Procedural
• Object-oriented
• Functional

3.

Problems of procedural programming
Writing a program in a procedural style at some point leads to a number of intractable problems.
For example, suppose the program needs to implement work with a certain number of circles. The minimum data required to create a separate circle is the coordinates of its center x and
y, as well as the radius r. One of the simple solutions is to choose some kind of data structure, for example, a list:
$ circle = [-2, 3, 10] # x, y, r
This solution has 3 main problems:
1. The non-obvious purpose of each list item.
The developer can mean [x, y, r] or [r, x, y], in addition, to access the circle parameter, you need to know exactly its index.
2. Lack of control over the values.
circle['r'] = -5 which should not be the case in principle. This inability to perform built-in data validation is perhaps the most negative aspect of an exclusively procedural approach.
3. Low efficiency of using existing code.
The third problem arises when there is a need to simultaneously work not only with circles, but also with other geometric shapes (including in the same way). For example, for a ring
or an ellipse, you will need to create a new data structure with similar characteristics, largely duplicating the functionality of a circle (draw yourself on the screen, move to a point,
etc.), although some code could be reused.

4.

Object-oriented programming
The terms "object-" and "oriented" in the modern sense of these words appeared at MIT in the late 1950s and early
1960s. In the environment of artificial intelligence specialists, the term "object" could refer to identified elements with
properties (attributes).
Objects as a formalized concept appeared in programming in the 1960s in Simula 67, an
upgraded version of Simula I, a programming language focused on discrete event
modeling.
The Smalltalk language, which was invented by Alan Kay and some other scientists, actually
imposed the use of "objects" and "messages" as a basis for calculations. The creators of
Smalltalk were inspired by some of the ideas of Simula, but Smalltalk was developed as a fully
dynamic system in which classes can be created and changed dynamically, and not just
statically as in Simula.
As you can see, it turns out that the first OOP language was Simula. But the first "pure" OOP language was Smalltalk.
"Pure" is sometimes called an OOP language, all types of which are or can be transparently represented by classes.

5.

Object-oriented programming
OOP has long dominated software development
and represents the best option between complexity and
code quality.
Moreover, there are popular languages that are
designed around this paradigm, for example, Java and
C#.
OOP is presented in almost all programming
languages (Python, Ruby, Rust, PHP, Perl, C++, …)

6.

Object-oriented programming
So what is OOP?
A programming methodology based on the representation
of a program as a set of interacting objects, each of which
is an instance of a certain class, and classes form an
inheritance hierarchy.
The main principles are:
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction (optional)

7.

GRASP Patterns
GRASP Patterns are patterns used in object-oriented design to solve common tasks of assigning
responsibilities to classes and objects. They are the direct output from the OOP principles.
Basically, they are also principles.
There are 9 of them:
Information Expert
Creator
Controller
Low Coupling
High Cohesion
Polymorphism
Indirection
Pure Fabrication
Protected Variations

8.

GoF Patterns
GoF (Gang of Four) Patterns are the effective solutions of common problems in OOP applications
development.
GoF Design Patterns are divided into three categories:
1. Creational:
The design patterns that deal with the creation of an object
2. Structural:
The design patterns in this category deals with the class
structure such as Inheritance and Composition.
3. Behavioral:
This type of design patterns provide solution for the better
interaction between objects, how to provide lose coupling,
and flexibility to extend easily in future.

9.

SOLID
SOLID principles establish practices that lend to developing software with considerations for
maintaining and extending as the project grows. Adopting these practices can also contribute to
avoiding code issues, refactoring code, and Agile or Adaptive software development.
There are 5 of them:
1. Single Responsibility Principle
2. Open-Close Principle
3. Liskov Substitution Principle
4. Interface Segregation Principle
5. Dependency Inversion

10.

OOP knowledge scheme
OOP Three
main
principles
SOLID
GRASP
Patterns
GoF Patterns
English     Русский Rules