PHP object-oriented programming-basic concepts of object-oriented DAY1

Source: Internet
Author: User
: This article mainly introduces PHP object-oriented programming-the basic concept of object-oriented day1. if you are interested in PHP tutorials, refer to it. Not oriented ObjectNot a good programmer
Familiar Object!!!!

OrientedObjectBasic concepts

PHP orientationObjectPractice

  • OrientedObjectBasic concepts
  • What isObject
  • ObjectBasic components
  • ObjectFeatures
  • What is orientationObject
  • Why use orientedObject
  • OrientedObjectBasic ideas
  • OrientedObjectOfBasic principles

What is orientationObject
OrientedObject(Object Oriented)
?Object(Object)
? Oriented)

What isObject
Everything in the worldObject
-One person, one car, one plane, and one table
-All visible things areObject
-All invisibleObject(Abstract thing) can also beObject
An abstract concept


ObjectExample-table
One table
One person (NBA player)
The running and jumping capabilities are very important. Playing basketball involves multiple skills, such as dribbling, shooting, dunk, and passing.
NBA is short for American professional basketball. NBA players belong to one team.
One person (female broadcaster)
Anchor is the host who organizes concerts and parties on the Internet. They usually use an art name online. When an online concert is held, the female anchor will sing songs for everyone.

ObjectBasic components
ObjectContains two parts
ObjectElements
? YesObjectData model used to describeObjectData (for example, the legs of a table, the desktop, and the length and width are the data models of the table)
? Also knownObjectOrObjectMember variable
ObjectAction
? YesObjectBehavior model, used to describeObjectWhat can be done (ObjectSuch as moving the table, passing the ball and jumping by NBA players, and interacting with the audience by singing the female)
? Also knownObjectMethod

ObjectFeatures
? EveryObjectThey are all unique (for example, NBA player James is James and is unique .)
?ObjectIt is a specific thing. His function is to complete specific functions (for example, NBA players are dedicated to playing basketball, and female broadcasters are dedicated to singing at concerts)
?ObjectYes, it can be used repeatedly (for example, James can play the next game after playing this game, and the next game can be run after the game is completed)

OrientedObjectBasic Programming Concepts

What is orientationObject?
Orientation is to keepObjectFocus on
OrientedObjectProgramming means that when programming, the programming structure (data organization mode) passes throughObjectStructure for storage
Attributes and methods


Why useObject?
ObjectThe description method is more suitable for the real world and is conducive to the understanding of large businesses.
Used in programmingObjectWhen analyzing the world, we can draw closer the distance between program design and the real world.

OrientedObject-- Substance
OrientedObjectIs to use the problems to be solved in life.ObjectStorage
? Attribute (athlete's height/weight/age)
? Method (run/jump/Cast/buckle)
ObjectAndObjectInteraction is completed through method transfer.
? Method (James passes the ball to Wade and Wade completes a dunk)
ObjectProgramming-orientedObjectBasic concepts of DAY 1 ">

OrientedObjectBasic ideas
Step 1: recognitionObject
-Any entity can be recognized asObject
Step 2: recognitionObjectAttributes
-ObjectThe data stored in it is recognized as a property.
-Different business logic focuses on different data,ObjectThe attributes stored in the bucket are also different.
Step 3: recognitionObjectAction
-ObjectChanges to your own attribute data
-ObjectExternal interaction
ObjectExample-table
ObjectProgramming-orientedObjectBasic concepts of DAY 1 ">
ObjectExample-NBA players
ObjectProgramming-orientedObjectBasic concepts of DAY 1 ">

OrientedObjectOfBasic principles(It's also programmedBasic principles)
ObjectThe interior is highly cohesive (high cohesion can be found in some cases, and there will be no lack of arm or legs)
?ObjectOnly responsible for a specific function (such as singing is not a required skill or playing basketball)
? AllObjectThe related content is encapsulatedObjectInternal
ObjectLow coupling (low coupling is especially important, the dependency between each other is very small, and the code is highly reusable)
-The external world can be seenObjectSome attributes (not all), such as the age of NBA players
-The external world can be seenObjectSomething can be done (not all)

The above introduces PHP object-oriented programming-the basic concept of object-oriented DAY 1, including some content, hope to be helpful to friends who are interested in PHP tutorials.

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.