Object-oriented Programming
, abbreviation OOP), It's a kind of programming idea .Process oriented programming takes function as the basic unit of program . When programming , Write groups of functions , Then execute the functions step by step , That is, the sequential execution of a set of functions . To simplify programming , Process oriented functions continue to be divided into subfunctions , That is to cut large function into small function to reduce the complexity of the system .
Process oriented programming , The core is " The process ", Focus on the steps to solve the problem , That is, what to do first and then what to do . Process oriented programming is like a pipeline , It's a kind of mechanical thinking . If program starts with the solving a big problem , Process oriented programming thinking will decompose a big problem into many small problems , These small problems can be further decomposed , Until the small problem is simple enough to be solved in one small step .
The object-oriented programming takes the object as the basic unit of the program , When programming , Design many objects ( Class ), Each object has the ability to solve some corresponding problems . Our object-oriented programming is based on process oriented programming , Class is the function ( Small steps ) It was packaged , As long as you find the specific class , Create objects , You can call the specific functions .
Object oriented is a thinking mode used to solve problems , In later development , Look for someone first , Call specific functions in the object . If there is really no object that can complete the requirements , Then define your own class , And define the required functions into the object , Convenient for future use .
Object oriented is an abstract programming idea , There is an idea in many programming languages .
1) demand
for example : Wash the clothes
reflection : There are several ways to do laundry ?
answer : Hand wash and Machine wash .
2) Process oriented laundry
Hand washing is equivalent to washing clothes facing the process :
After so many steps , You finally finished your clothes , But I'm exhausted .
3) Object oriented laundry
Machine washing is equivalent to object-oriented washing clothes .
This washing machine is the object , Put the clothes in the washing machine :
You sit by the window and watch the sunset , Sigh that life is so beautiful !
4) summary :
reflection : Compare two ways of washing clothes , Which way is simpler ?
answer : Machine washing is simpler .
Machine wash only needs to find a washing machine , Add simple operations to complete the laundry work , And don't care what's going on inside the washing machine .
Object oriented is to treat programming as a thing , For the outside world , Things are used directly , Don't worry about his internal situation . Programming is about setting what things can do .
Object oriented programming is the use of class and object To create various models , To realize the description of the real world .
The reason for using object-oriented programming :
Class
class : A class refers to the same feature extraction of the same thing , Extract the same attribute method and define it in the class .Object
object : An object is an instance of a class , The object is concrete , Class is abstract .Catalog 1. What is computer language 2. Compiler language and interpretive language in high level language (1) Compiler language (2) Explanatory language (3) Compiled language and interpreted language execution process 3. Knowledge expansion : 4. About Python 1. What is computer language ...
Catalog 1.Python Introduction to development environment 2.Python The classification of interpreters 3. download Python Interpreter 4. install Python Interpreter 5.Python Interpreter validation 1.Python Introduction to development environment So-called " Desire for work ...
Catalog 1.Python The interaction mode of 2.IDLE Instructions for use of tools 3.Sublime3 Installation and configuration of tools (1)Sublime3 Installation (2)Sublime3 Configuration of 4. Use Sublime Write and debug Pytho ...
Catalog 1.Pycharm download 2.Pycharm install 3.PyCharm Interface is introduced 4. Basic use (1) newly build Python project (2) To write Python Code (3) Execute the code to see the results (4) Set up PyCharm ...
Catalog 1. The function of annotation 2. Classification of notes Single-line comments Multiline comment 3. Notes 4. When do I need to use comments 5. summary Tips : Finished the preparatory work ahead , The following article begins to introduce Python The basic grammar of . Python ...
Catalog 1. Definition of variables 2.Python Variable description 3.Python Define variables in (1) Definition grammar (2) Identifier definition rules (3) Built in keywords (4) Identifier naming habits 4. Using variables 1. Definition of variables In the program , The data are all ...
Catalog 1. Data type introduction 2. Numerical type (Number) 3. Boolean type (bool) 4.None( Null value ) 5. Constant 6. character string (String) 1. Data type introduction (1) What is data type In the life , What we use everyday ...
Catalog 1. See variable types 2. Escape character (1) Escape character description (2) Example (3) Comparison table of common escape characters 3. Character encoding (1) Introduction to character encoding (2)Python Character encoding in (3) The encoding format is applied to different scenes Tips : On ...
Catalog 1. What is formatted output 2.Python Five ways to format output Mode one : Use... Between strings + No. splices Mode two :print() Function can output multiple strings at the same time Mode three : Placeholder method Mode 4 :f Formatting method ( recommend ) Methods five ...
Catalog 1. Why data type conversion 2. The essence of data type conversion 3. Functions used in data type conversion 4. Common data type conversion function (1)int() function (2)float() function (3)str() function (4)bool( ...
A recent project requires something like Taobao , Baidu search when the automatic retrieval scheme . Naturally thought of using datalist label . But I met a bug, After two days of research . I have some results to share with you ~~ First of all to see bug Well !~ Because the first test of the project is to use 36 ...
// Playground - noun: a place where people can play import UIKit // For-In loop // 1 Traversing the number range ... { prin ...
Eclipse Development c++ contrast : Microsoft VC++6.0: Too old , Yes win7 Not compatible , Now Microsoft's Visual Studio: The package is too large , several G, A bunch of stuff you don't need , Asking for money , teach It's troublesome to apply for Education Edition DOS Next ...
The last one realized demo Path analysis of the nearest facility point on the map , Typhoon tracks are added in this chapter , The screenshot is as follows : The following is a brief introduction to relevant knowledge points : cordon Cordon coordinate set : var lineArr24=[[127,34],[127,21],[11 ...
ES6 Object.assign One . Basic usage Object.assign Method is used to convert the source object (source) All enumerable properties of , Copy to target object (target). It requires at least two objects as parameters , The first parameter is the target ...
Portal Come back and have a look 51nod, Find yourself falling into rank4 了 , Cut to the point and answer rank3. You can't do it at a glance , This kind of thing should find rules slowly …… Then I see that the data range is actually small , It should be a single time log Of , Is it possible to divide and conquer . #inc ...
1. Customize a comparator , Its parameters are the attributes to be sorted . 2. Pass the comparator with parameters into sort(). var data = [ {name: "Bruce", age: 23, id: 16 ...
My computer win10 After the system has been upgraded many times , It often happens that all settings are sometimes disabled solve : C:\WINDOWS\system32>sfc /SCANNOW Start the system scan . This process will take some time . Start system scanning ...
A very small one HTML project , Use .Git To record and track this project . Including the following : Create a version Library . Add and modify files . Create a new branch . Tag and organize the version Library . Clone version Library . Create a version Library Creating a Repos ...
We can create multiple desktops , The window tasks running on each desktop do not interfere with each other , This is the virtual desktop Create a virtual desktop :Win + Ctrl + D View virtual desktop :Win + Tab Delete current virtual desktop :Win + Ctrl + F4 Switch to ...