PHP Object-Oriented programming--object-oriented basic concepts Day 1

Source: Internet
Author: User
does not face ObjectProgrammer is not a good programmer
I am familiar with facing Object!!!!

The basic concept of object -oriented

Object -oriented practice in PHP

    • The basic concept of object -oriented
    • What is an object
    • The basic composition of the object
    • Features of the object
    • What is object -oriented
    • Why use object -oriented
    • The basic idea of object -oriented
    • Object -oriented Basic principles

What is object -oriented
OO ( object oriented)
? Object (Object)
? for (oriented)

What is an object
Everything is the object of the world
-A person, a car, a plane, a table
-All things visible are objects
-All objects that are not visible (abstract things) can also be objects
An abstract concept


Examples of objects --tables
A table
A person (NBA player)
The ability to run and jump is very important. Playing basketball involves dribbling, shooting, dunks, passing and many other skills.
NBA is the abbreviation of American professional basketball, NBA players belong to a team.
A person (female host)
A female anchor is a host who organizes concerts and gatherings on the internet. They usually use a stage name on the internet. At the time of the online concert, the female anchor will sing songs for everyone.

The basic composition of the object
object contains two parts
The constituent elements of an object
? is the data model of the object that describes the data of the object (for example, several legs of the table, the desktop, the data model of the table in the length and width)
? Also known as an object 's property, or a member variable of an object
Behavior of the object
? is the behavior model of the object that describes what the object can do (the behavior of the object, such as the position of the table move, the NBA player dribbling the pass jump, the female host singing and the audience interaction)
? Also known as the object method

Features of the object
? Every object is unique (such as the NBA player James is James, the unique one.) )
? Object is a specific thing, his function is to complete certain functions (such as the NBA player specific function is to play basketball, the female anchor is a special concert singing)
? objects can be reused (for example, when James finishes the ball, he can have a game, and it can run the next time.)

Basic concepts of object -oriented programming

What is object -oriented?
It's all about keeping objects in mind when you're programming.
object -oriented programming is how programming structures (data organization) are stored through the structure of objects .
Properties, Methods


Why use object -oriented?
The way objects are described more closely to the real world, to the understanding of large business
In the process of program design, when analyzing the world from the perspective of object , we can shorten the distance between program design and real world.

Object -oriented--the essence
Object -oriented is to store the problems in life to be solved in the way of objects .
? Properties (athlete's height/weight/age)
? Method (Run/jump/cast/buckle)
Interaction between objects and objects through the transfer of methods
? Method (James passes to Wade, Wade completes a slam dunk)
Object Programming-- object -oriented basic Concepts Day 1 ">

The basic idea of object -oriented
First step: Identify objects
-Any entity can be identified as an object
Step two: Identify the properties of an object
-The data stored within the object is recognized as a property
-For different business logic, the data that you are concerned about is different, and the attributes stored in the object are different.
Step three: Identify the behavior of an object
-Changes to the object 's own property data
- Object and external interaction
Examples of objects --tables
Object Programming-- object -oriented basic Concepts Day 1 ">
Examples of objects --nba Players
Object Programming-- object -oriented basic Concepts Day 1 ">

Object -oriented Basic principles (also the Basic principles of program design)
The inside of the object is high cohesion (cohesion Poly should have, there is no lack of arms, less legs)
? The object is only responsible for a specific function (the function can be very small, such as singing is not necessary skills, playing basketball is not)
? All object -related content is encapsulated inside the object
objects are low-coupling to the outside (low coupling is especially important, the dependencies are particularly small and code reusability is high)
-The outside world can see some properties of the object (not all of them) such as the age of the NBA players
-The outside world can see that objects can do certain things (not all)

The above describes the PHP object-oriented programming-object-oriented basic concept Day 1, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.