Hans Zaunere, Managing Member

Slides:



Advertisements
Similar presentations
OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Advertisements

Coding Standard: General Rules 1.Always be consistent with existing code. 2.Adopt naming conventions consistent with selected framework. 3.Use the same.
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
Inheritance Inheritance Reserved word protected Reserved word super
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 Chapter 12 More OOP, Interfaces, and Inner Classes.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 3 Object Oriented Programming in Java Language Basics Classes,
Advanced Object-Oriented Programming Features
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Design Patterns.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
Module 7: Object-Oriented Programming in Visual Basic .NET
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24.
Basic Semantics Associating meaning with language entities.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Object Oriented Software Development
 All calls to method toString and earnings are resolved at execution time, based on the type of the object to which currentEmployee refers.  Known as.
Inheritance Revisited Other Issues. Multiple Inheritance Also called combination--not permitted in Java, but is used in C++ Also called combination--not.
Object Oriented Programming
 Pearson Education, Inc. All rights reserved Object-Oriented Programming: Polymorphism.
STL CSSE 250 Susan Reeder. What is the STL? Standard Template Library Standard C++ Library is an extensible framework which contains components for Language.
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
Friday, March 8 Creating real Custom Controls Kelvin van Geene 12:15.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 3 is due Sunday, the 8 th at 7pm. Problems with assn 3? Discuss at your team meeting tonight.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Recap Introduction to Inheritance Inheritance in C++ IS-A Relationship Polymorphism in Inheritance Classes in Inheritance Visibility Rules Constructor.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
Generic Programming and Library Design Brian Bartman
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
Windows Communication Foundation and Web Services
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Design Patterns: MORE Examples
INF230 Basics in C# Programming
Jim Fawcett CSE681 – SW Modeling & Analysis Fall 2014
Advanced Object-Oriented Programming Features
Advance OOP in PHP.
What, Where and Why Swift
Multi-Methods in Cecil
Polymorphism.
Magento Technical Guidelines Eugene Shakhsuvarov, Software Magento
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Functional Programming with Java
Object Oriented Analysis and Design
Lecture 23 Polymorphism Richard Gesick.
Interfaces.
More Object-Oriented Programming
Polymorphism Polymorphism
Overriding Methods & Class Hierarchies
CISC/CMPE320 - Prof. McLeod
Polymorphism 2019/4/29.
CPS120: Introduction to Computer Science
Groovy.
Classes and Objects Imran Rashid CTO at ManiWeber Technologies.
Object Oriented Design & Analysis
Lecture 10 Concepts of Programming Languages
C++ Object Oriented 1.
Chapter 3 Discussion Pages
Lecture 6: Polymorphism
Blazor A new framework for browser-based .NET apps Ryan Nowak
SPL – PS3 C++ Classes.
Presentation transcript:

Hans Zaunere, Managing Member PHP 5.3 Feature Review and Discussion Late static binding, namespaces, and closures New York PHP User Group July 27th, 2010 Hans Zaunere, Managing Member 5/8/2019

Overview PHP 5.3 Overview It’s been a pretty nice release Shedding legacy – grounding for the future Extension and PECL cleanup Numerous bug fixes Performance improvements – internal API cleansing mysqlnd goes mainstream Improved Windows support And of course… 5/8/2019

Late static binding, namespaces, closures The Three Amigos Late static binding, namespaces, closures New language features May change some programming paradigms for PHP But how – and why? 5/8/2019

Late Static Binding Static “Inheritance” Provides "inheritance" for static properties/methods Not full inheritance self:: references static members in the class defined static:: references static members in the class called This is late static binding - resolves the reference “late” – during runtime 5/8/2019

Late Static Binding So... What? Provides flexible static class hierarchies Static in an object sort of way Singletons, factories, etc. Can add complexity and confusion Resolved at runtime – performance? forward_static_call() required for LSB behavior with static methods 5/8/2019

A File System In Your Code Namespaces A File System In Your Code PHP’s namespaces model file system paths namespace Some\Name\Space; Classes, constants, and functions of the same name can exist at different “paths”. 5/8/2019

Namespaces Applications? Encapsulate code libraries Override internal PHP functions and classes Minimize lengthy naming conventions use \my\framework; class Exception { } instead of class my_framework_Exception { } 5/8/2019

namespace Pitfalls\Caveats; Namespaces namespace Pitfalls\Caveats; Resolution rules can get complex Fully read resolution rules – and then keep things simple Avoid dynamic namespaces Different rules for classes vs. functions/constants or When a slash makes all the difference. 5/8/2019

namespace \Pitfalls\Caveats\More; Namespaces namespace \Pitfalls\Caveats\More; Porting – namespaces don’t drop-in Non-namespaced code probably won’t work Be prepared for porting effort Performance Fully qualified namespaces are resolved at compile time Runtime resolution showed signs of performance impact Although you likely won’t be instantiating 1 million classes KISS Don’t be too clever – avoid dynamic language features Easy to get un-maintainable code 5/8/2019

Thank You hans.zaunere@nyphp.com …oh right… 5/8/2019

Closures Traitor Functions Where the functions have no names Lambda or anonymous functions… …or inline – just-in-time – ad-hoc – hack? Functions that can be assigned to a variable Implemented in PHP 5.3 using the final class Closure 5/8/2019

$Function = function() { return ‘Why?’; }; Closures $Function = function() { return ‘Why?’; }; Just like other functions Pass variables as references Static variables And not really Inherit declared scope 5/8/2019

Getting Closure On You Know What Closures Getting Closure On You Know What Often used as callbacks Great for asynchronous languages PHP use cases Form/request validation Template data filtering and transformation The invisible man may have had fun at first… But no one knows you exist (code reuse) No one can see you (side-effects) Be aware of surroundings at all times (encapsulation) 5/8/2019

Late static binding, Namespaces, and Closures Oh My What does this mean for PHP development? Encapsulation – Complexity – Reusability? What about for frameworks? The quest to see the Wizard of Object Orientated Perfection? Or a new paradigm that’s perfect for web dev? WordPress Drupal noSQL Memcache 5/8/2019

Thank You hans.zaunere@nyphp.com …seriously. 5/8/2019