Object-Oriented Programming
Object-oriented concepts:
Orientation is a kind of programming thought which conforms to the habit of human thinking. There are different kinds of things in real life, and there are all kinds of connections between them. It is object-oriented to use objects in a program to map things in the real world and to describe the relationship between objects.
Process oriented:
Analyze the steps required to resolve the problem, and then use the function to implement each of these steps, using one call at a time.
Object-oriented is to divide the solved problem into several independent objects according to certain rules, then solve the problem by invoking the object's method. Of course, an application can contain multiple objects that implement the functionality of the application through the interaction of multiple objects. This allows the code to be easier to maintain when the application functionality changes and only the individual objects are modified.
Developed in the the 1970s
Solutions for structured programming
Simulating the process of human thought
To act as a delaying "object."
Object oriented Programs
All things are objects
All things in the real world are objects.
objects have certain characteristics and show some behavior
The concept of objects
objects can be seen and touched by tangible entities, such as computers, airplanes, automobiles and so on;
Objects can also represent the role of people or organizations, such as medical treatment, teaching, production and so on;
Objects can also represent events, such as various accidents, performances, fights, meetings, etc.;
objects can represent rules, such as various expert rules, constraints, regular expressions, and so on.
Two elements of an object
Property
A data item that describes the static characteristics (structural properties) of an object. such as describing a person's name, gender, social security number and other attributes.
Method (also known as service)
A series of actions that describe the object's dynamic characteristics (behavioral characteristics). such as everyone has work, learning and other behavioral characteristics.
Encapsulation performance of objects
An object is a collection of a set of properties and related methods. This is one of the major differences between the object-oriented approach and the structured approach.
Objects package data and the operations that are applied to the data into an inseparable, most basic module, so that only a limited number of methods of that class can manipulate and alter the data.
Class
To generalize and classify many things into classes is the method we often adopt when we know the world.
Classification is based on the principle of abstraction, that is, to ignore the non-essential characteristics of things, only pay attention to those with the current objective of the essential characteristics.
Identify the commonalities of things and divide things of a common nature into the same class.
The concept of a class
objects in the same class have the same properties (also known as member variables, which describe the static or structural properties of the Class)
objects in the same class have the same method (also known as a service, which describes the behavior or dynamic characteristics of the Class)
objects in the same class adhere to the same semantic rules. (a common constraint or rule)
Data abstraction
Data abstraction is the process of identifying properties and methods of a specific entity
Principles of object-oriented programming
Packaging
Inherited
Polymorphic
Summarize
Object-Oriented Programming: Object Oriented Programs
The two elements of an object are: properties and methods
Identify the commonalities of things and divide things of a common nature into the same class
Deep understanding of the concept of object-oriented theory is extremely important for writing good programs
Object-Oriented Programming