; ikamy.ch

PHP OOP Object Orientation Programming

Udemy
OOP Object Orientation Programming
Lawrence Turton
   

Learning object oriented programming may seem like a chaw but in reality once learnt it's not difficult. However many programmers learn object orientation programming instead of the whole object orientation process, for example what do we mean by object orientation? What does the APIE acronym stand for and do we understand all concepts of this acronym? Those who may even have a general knowledge of object orientation programming may want to take this course because it'll give a higher definition of object orientation and all concepts that surround it. To truly understand how to program in an object oriented manner then we must first understand all there is to know about the concepts, ideologies and fundamental understanding not just the syntax of any one language.

If you just know how to program object oriented then that will not cut it. What happens when you need to map out an application are you using UML and are you using it correctly? Everything we do in the programming world is for real world use so understanding the syntax only or understanding object orientation in a general way will not cut in large scale projects. So those programmers who may have been exposed to object orientation syntax may find this course of some use and don't for object oriented analyse and design don't refer to any programming language. Also new comers will definitely learn a boat load from this course in the simplest manner possible right from the start even if you don't want to do the programming part.

This course includes lectures that break subjects down like abstraction, polymorphism, inheritance and encapsulation in a simplified spoon fed manner for anyone to understand from beginner or even an experienced programmer who wants to know more about the object oriented fundamentals.

What are the requirements?
Have general knowledge of the PHP language but not required for OOA or OOD What am I going to get from this course?

APIE (Abstraction, Polymorphism, Inheritance & Encapsulation)
Object oriented analysis, design & programming
UML or Unified Modelling Language
Sequence diagrams
Class syntax of PHP
What is the target audience?

Have a full understanding of the concepts behind OO not just programming
People who want to learn the full process of OO
Want further understanding of certain aspects of OO
Learn OO PHP syntax that can be generalised to other programming languages as well

Udemy
OOP Object Orientation Programming in php-7
Saira Sadiq
   

1st section of the course starts with an introduction to object oriented programming. What is OOP? and why we need it ? and what was before OOP?. A little detail about procedural language.We will also learn how to add OOPness in our programming. Then the advantages of object oriented programming.

In 2nd section we will discuss the basics of OOP with real life example and then how to map it in objects, classes, properties and method.

Then how to create objects and classes in php? How to add properties and methods? How to use them? And at the end of this section we will learn about parameters and return values of a method.

3rd section describes the visibility and its three levels. Then why we need to define public, private or protected visibility of properties and methods in a class.

4th section describes the concept of constants in classes.

5th section describes about data encapsulation. Why we need it? And how to implement it and then the benefits of encapsulation.

In 6th section we will discuss about inheritance with real life example. Then how to translate it in classes, properties and methods in php code. What is ISA and HASA relationship and where to use ISA and where to use HASA in classes and objects.

7th section describes the problem when a child class needs its own version of parent class method then how overriding of method solves this problem. Then how you can preserve parent class method’s functionality while overriding.

8th section describes how you can block inheritance and method overriding using final keyword.

9th section describes what is the meaning of abstract in real world, then what is the meaning of abstract classes, why we need i? What are the abstract methods and why we need it? Then we will also discuss how to create abstract classes and methods in php.

At the end what are the key points for abstract classes and methods.

In 10th section we will discuss what happens when two classes from completely different class hierarchies need some similar behaviour and how interface solve this problem.

In 11th section we will discuss what happens when an object is born and when it dies. How we can handle things in both situations using constructor and destructor. How to define and use constructor and destructor using magic methods __construct() and __destruct().

12th section describes a situation where we need only one copy of properties and methods for all objects of a class. Static keyword can solve this problem. So we will see how we can create and use static properties and methods without creating an object of a class.

In 13th section describes that there are 15 magic methods in php. So we will discuss these magic methods one by one in detail.

14th section is the biggest one in this course. In this we will discuss about errors and exceptions.

What supposed to be an error in php? How they happen? What are the different types of errors? .how you can trigger errors by yourself? And what are the logical error? Then we will see how we can report errors when they happen and how you can change error reporting settings in php.ini. We will also learn the 4 ways to deal with errors. Then how to use an error handler and at last how you can log error messages.

After errors we will discuss about what may be the risky behavior of your code and how we can use exceptions to handle that risky behaviour. We will see how we can try some risky behaviour then how we can throw an exception if anything wrong happens and how we can catch that exception. Then the detail discussion on exception class in php and the stack trace for the exception. Then how you can make your own custom exceptions by extending php’s built in exception class. Why we need to use try with multiple catches and how to re-throw an exception. What happens when there is an uncaught exception in your code.what is an exception handler.

Then at the end of this section we will discuss the changes in errors and exceptions in php7.

15th section describe how you can autoload classes in your code without using include and require statements. Then the use of autoloader function for this purpose. Then we will discuss to autoload namespace classes in your code using Psr-0 and Psr-4 autoloading standards but before that we will discuss what are the namespaces in php.

16th section is about object serialization. Why we need to serialize an object. Then when and how to unserialize it. We will also learn how to do task that are prior to serializing an object using __sleep() magic method.Then how to do task right away after unserializing an object using __wakeup() magic method.

17th section is about cloning of an object in which we will discuss two types of cloning that are shallow copy and deep copy. In deep copy cloning we will also discuss about __clone() magic method. Then we will see recursive cloning and then double linking problem in cloning. At the end we will discuss Deep copy cloning using serialization.

18th section is about Type hinting. In this we will see how we can use non scalar and scalar data types for type hinting. We will also discuss about strict scalar data types and TypeError exception thats been introduced in php7.

In 19th section we will learn two ways of comparing objects. First one is using Comparison operator (==) and 2nd one is using Identity operator (===).

20th section is about overloading an object. we will learn How to do property overloading Using __get(), __set(), __isset() and __unset() magic methods. Then how to do method overloading Using __call(), __callStatic() magic methods.

21st section describes about traits. First we will discuss deadly diamond of death problem in multiple inheritance. Then single inheritance and its limitations. Then how traits provide multiple inheritance thing in php. Then what will be the precedence order if a parent class and a trait have same method and then what will be the precedence order if a trait and current class have the same method. We will also discuss to use multiple traits and then how to compose a trait from other traits.

At the end we will discuss abstract and static trait members and trait properties.

22nd section describes late static binding. For this first we will discuss some basic concepts of binding like what is binding, early binding and late binding?

Then what is the problem with early binding of self keyword and at the end its solution which is late static binding.

23rd section describes object iteration. First we will get some idea about some basic concepts like traverse, iterate and iterate using loops. Then what is object iteration and how you can iterate an object using Iterator Interface and IteratorAggregate Interface .

What are the requirements?
Little knowledge of basic PHP.
What am I going to get from this course?
Almost all topics of object oriented programming given in PHP manual.
Apply Advanced OOP concepts in your applications.
Covers almost all topics of OOP in any PHP certification.
Add OOP skill in your CV.
What is the target audience?
If you are a newborn in php and have a very basic knowledge of php.
If you are an intermediate php developer.
If you need complete php7 object oriented knowledge.
If you want to learn Object Oriented Programming using real life examples.
If you want to learn each concepts of OOP in complete detail.
If you want to prepare for a php job interview.
If you wanted to add object oriented programming skill in your CV.
If you wanted to add some serious OOPness in your programming.
If you need prompt response from your instructor.





«back

Variable Variable

to convert the result of a Variable to variable $$.
$a=hello - $hello = hello everyone then $$a ->hello everyone
«back

Function Arrays

array_shift pull out 1st element of array
array_unshift push to 1st element of array
array_pop pull out last element of array
array_push push to last element of array
«back

Static Variable

inside a function static $a will keep the value if call multiple time
function test1(){
static $a;
$a++; }
each time function is called $a will increment by 1
«back

Object Class

Define class start with class + Name (camel case)
to get all classes get_declared_classes() result is array and we can do foreach
to see if class exists class_exists("ClassName") return true false
method is function inside class
to get methods get_class_methods(\"ClassName\") return array
bool method_exist("ClassName",("methodname"))

instatiate a class
$var= new ClassName() we could pass some args inside
if we want to know a $var instance of a class is get_class($var)and will return class name
or bool is_a($var,ClassName)
so to call a function of a class instance $var->function
to reference inside class we use $this
properties are variables that are inside a class
inside class if we declare properties we need var in front unless we put public, private, protected called "access modifiers"
the same apply access modifiers apply to methods
public can be accessed from outside a class
protected available within class or inherited class
private only available within class and not even on inherited class
if we want to get property value through instance $var->property without $ in front of property () is for function
to get class variable or properties get_class_vars("ClassName") associative array name of properties and values
bool propery_exists("ClassName","property_name") no $ sign


Inheritance
will inherit the properties and methods of his parents
when a child class ClassName extends ParentClass
We can override the parent properties and methods in the child by using the same name
to get parent class of child get_parent_class("ChildClass") blank if false
bool is_subclass_of("ChildClass","ParentClass") or vice-versa to see true of false

Static
We can declare a property or method as static and it is usable even if there is no instance of that class
eg property static $var or static function name
to call from outside or assign Classname::$property with $ sign or Classname::static_function()
to call or assign within the class we use self:: or static:: for late binding
Note:static variable are share within the inheritance tree so where a value to one it will be the same for all
if we want to refer to parent properties or method we use parent::
parent:: could be used with instance methods too but not attributes or properties

Contruct - Destruct
function__construct() will initialize or perform things in class when there is instance for ex eg prepare connection
function __destruct() when
Cloning
Normally if we assign a instance $var2=$var it will make a reference like putting $var2 =&$var but if we want a copy or clone $var2 =clone $var1
So when we clone it does not go to construct method but instead we can use a clone method function __clone() so when clone a instance instantanly it will perform the clone method
to compare 2 object == or stricter ===
you can compare 2 instance clone or reference to true or false $var==(=)$var1
with stricter only reference is true, non strict unless property change it is true