intro to oop php and github
DESCRIPTION
A simple presentation about introduction to PHP OOP and githubTRANSCRIPT
![Page 1: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/1.jpg)
Why PHP?
![Page 2: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/2.jpg)
What does PHP stand for?
Personal HomepagePHP: Hypertext Preprocessor (recursive
acronym)Created by Rasmus Lerdorf (1994)
![Page 3: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/3.jpg)
It’s FREE!!
PHP is open-source
![Page 4: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/4.jpg)
Platform Independent
Can be deployed/installed in different OS
![Page 5: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/5.jpg)
Great Documentation
php.netFunctions are well explained + informative
examples
![Page 6: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/6.jpg)
Large and Active Community
stackoverflowphp.netgithubEtc...
![Page 7: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/7.jpg)
Easy to learn
Simple syntaxWell documentedLots of tutorials
everywhereLots of premade libraries
![Page 8: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/8.jpg)
WHY PHP
It’s FreePlatform IndependentGreat DocumentationLarge and Active CommunityEasy to learn
![Page 9: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/9.jpg)
OBJECT ORIENTED PROGRAMMING
![Page 10: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/10.jpg)
Object Oriented Programming
A programming concept that treats functions and data as objects.
A programming methodology based on objects, instead of functions and procedures.
![Page 11: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/11.jpg)
“I explain that procedural program is built around the "verbs" of the system, the things you want the system to do, whereas object-oriented programming is build about the "nouns," the things in the system, and what they are capable of.”
![Page 12: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/12.jpg)
Object and Class
![Page 13: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/13.jpg)
CLASS
is a "template"/"blueprint" that is used to create objects
usually represents a noun, such as person, place or thing.
![Page 14: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/14.jpg)
CLASS
class PointGuard{
}
![Page 15: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/15.jpg)
OBJECT
In real world object is a material thing that can be seen and touched.
In OOP, object is a self-contained entity that consist of both data and procedures.
An instance of a class
![Page 16: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/16.jpg)
Give examples of real life class and object.
![Page 17: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/17.jpg)
INSTANCE
![Page 18: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/18.jpg)
INSTANCE
layman's term - a case or occurrence of anything
a single copy of an object, there might be one or several objects, but an instance is a specific copy, to which you can have a reference
![Page 19: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/19.jpg)
$instance = new PointGuard();
![Page 20: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/20.jpg)
INHERITANCE
![Page 21: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/21.jpg)
INHERITANCE
biology - the genetic characters transmitted from parents to offspring
OOP - provides reusability of codes. We can add additional codes to an existing class without modifying it.
can be defined as the process of one object acquires the properties of another by making subclasses (parent-child relationship)
![Page 22: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/22.jpg)
INHERITANCE
<?phpclass BasketballPosition{ // some methods and properties}
class PointGuard extends BasketballPosition{ // some methods and properties}
![Page 23: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/23.jpg)
Give examples of inheritance.
![Page 24: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/24.jpg)
Class Properties and Methods
HeightWeightPassDribbleShootReboundBlock
![Page 25: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/25.jpg)
Class Properties
also know as data members and is used to hold data of a class.
The data that it holds are specific to the nature of the class in which it has been defined.
![Page 26: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/26.jpg)
Class Properties
class PointGuard{ public $name; public $ball_handling_level;}
![Page 27: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/27.jpg)
Class Methods
functions that are associated with the classfunctions that can be involve in the class
property processing
![Page 28: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/28.jpg)
Class Methods
class PointGuard{ public $name; public $ball_handling_level;
public function createPlay() { // some processing here }}
![Page 29: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/29.jpg)
Encapsulation
![Page 30: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/30.jpg)
Encapsulation
facilitates the bundling of data with the methods (or other functions) operating on that data.
restricting access to some of the object’s components.
used to hide the values or state of a structured data object inside a class, preventing unauthorized parties' direct access to them.
![Page 31: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/31.jpg)
Encapsulation
Example :Courting a girl
![Page 32: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/32.jpg)
Encapsulation
Access modifiers/Visibility private
property and method can be accessed only inside the class itself and can't be accessed anywhere else
protected property and method can be accessed only
inside the class itself and inside child classes. public
allows the property/method to be accessed from anywhere of code
![Page 33: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/33.jpg)
Private
class Love{ private $hearbeat_per_second = 100;
public function getHeartBeatPerSec() { return $this->heartbeat_per_second; }}
class Valentines extends Love{ public function getHeartBeatPerSecWhenNear() { return $this->heartbeat_per_second * 2; // will produce an error }}
$love = new Love();echo $love->getHeartBeatPerSec(); // will output 100echo $love->heartbeat_per_second; // will produce an error
![Page 34: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/34.jpg)
Protected
class Love{ protected $hearbeat_per_second = 100;
public function getHeartBeatPerSec() { return $this->heartbeat_per_second; }}
class Valentines extends Love{ public function getHeartBeatPerSecWhenNear() { return $this->heartbeat_per_second * 2; // will return 200 }}
$love = new Love();echo $love->getHeartBeatPerSec(); // will output 100echo $love->heartbeat_per_second; // will produce an error
![Page 35: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/35.jpg)
Public
class Love{ public $hearbeat_per_second = 100;
public function getHeartBeatPerSec() { return $this->heartbeat_per_second; }}
class Valentines extends Love{ public function getHeartBeatPerSecWhenNear() { return $this->heartbeat_per_second * 2; // will return 200 }}
$love = new Love();echo $love->getHeartBeatPerSec(); // will output 100echo $love->heartbeat_per_second; // will output 100
![Page 36: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/36.jpg)
Choosing the Right Visibility
START
Accessed externally?
publicY
Deny to children?
privateY
N
N
protected
![Page 37: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/37.jpg)
PHP OOP
Object and ClassInstanceInheritanceClass Properties and MethodsEncapsulation
![Page 38: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/38.jpg)
Introduction to Git and Github
![Page 39: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/39.jpg)
Git whhaaat???
Is a source/version control management software.
Is a software that allows you to track the changes that you make to individual files.
git push
git pull
git commit
![Page 40: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/40.jpg)
Github eeeeee??
is a web-based hosting service for software development projects that use the Git revision control system
“social coding”
![Page 41: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/41.jpg)
Why u no use git and github??
![Page 42: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/42.jpg)
Why u no use git and github??
Git can track your changes to your projects.You can go back to a certain change you
made that you want to recover.
![Page 43: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/43.jpg)
Why u no use git and github??
![Page 44: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/44.jpg)
Why u no use git and github??
Github lets you collaborate with other developers or your project teammates by adding comments or suggestions on commits.
You can also contribute to public/open source projects. (eg. Facebook SDK, Codeigniter, PHP, etc...)
Share your codes to public and get feedback from large community of developers.
![Page 45: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/45.jpg)
Why u no use git and github??
![Page 46: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/46.jpg)
Why u no use git and github??
![Page 47: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/47.jpg)
Commands Overview
git init Initializes a git repository.
git status Check your changes made (untracked files, modified files, staged
files) git commit
Save your changes into one commit history. git push
Push your changes in the remote repository. git pull
Pull changes from remote repository and apply it to your local repository.
git fetch Fetch changes from remote repository but changes will not apply
to your local repository
![Page 48: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/48.jpg)
Git and Github
Git and github can be effectively used in project collaborations.
Can improve a developer’s coding.Can avoid overriding or duplicating codesNot just a developer tool
![Page 49: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/49.jpg)
“Whenever you are asked if you can do a job, tell'em, Certainly, I can! Then get busy and find out how to do it.”
- Theodore Roosevelt
![Page 50: Intro to OOP PHP and Github](https://reader031.vdocuments.us/reader031/viewer/2022012916/553898de4a79594f6c8b47d9/html5/thumbnails/50.jpg)