SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Procedural to OOP in
PHP
Presented by
Barrett Avery, Data Systems Lead @ IDX, LLC
Antonio Ortega, Biz Dev @ IDX, LLC
Welcome Everybody
What is IDX?
We are a SaaS product that creates web tools
based on aggregate real estate data.
And More Data Provided by
a Multiple Listing Service:
<xml><stuffs>asihe234ouawyd7suh</stuffs></
xml>
And More Data Provided by a Multiple Listing Service:
<xml><stuffs>asihe234ouawyd7suh</stuffs></xml>
And More Data
Provided by a
Multiple Listing
Service:
<xml><stuffs>asihe234ouawyd7s
uh</stuffs></xml>
Objective
● Where we were and where we are going.
● Some differences between Procedural and OOP
● Give some insights from what we have learned along
the way.
● Quick dive into SOLID Principles
● Quick dive into the Laravel Framework
Procedural - Where we were
Definition: Procedural Programming is a list or set of instructions telling a
computer what to do step by step and how to perform from the first code to the
second code. Source: Wikipedia.
Procedural Pros and Cons
Pros:
● Quick to develop and implement.
● Easy to learn.
● Simple architecture and overall
structure.
● Good for quick and simple
applications.
Cons:
● Difficult to scale for future needs.
● Does not lend itself well to test
driven development (TDD).
● Usually is very flat in terms of
design and structure.
● Not good for larger applications
that will likely change over time.
● Maintaining can be very
challenging.
OOP - Where we are
Definition: Object Oriented Programming (OOP) is a programming language
model organized around objects rather than "actions" and data rather than
logic. Source: Wikipedia.
OOP Pros and Cons
Pros:
● Much easier to scale for future
needs and development.
● Good for larger more complex
applications.
● Lends itself well to Test Driven
Development (TDD).
● More dynamic and fluid in terms
of the architecture and overall
design.
● Maintainable.
Cons:
● Can easily become very
complicated in terms of design
and architecture.
● Takes much longer to develop
initially.
● More difficult to learn than
Procedural.
Why did we switch to OOP?
● Scalability
● Testable
● Maintainable
● Follows a more modern methodology of programming (SOLID)
● Laravel
SOLID and Laravel - Quick Dive
Covering a couple of key components we are
using in our applications at IDX, SOLID
principles and the Laravel framework.
SOLID OOP Principles
Single Responsibility
Open Closed
Liskov substitution
Interface segregation
Dependency inversion
Laravel Framework
● Why we chose a framework?
o Gives a base to build scalable applications
o Consistency between projects
o Training is much easier when you have a standard to base your
application on
● Why we chose Laravel?
o Open Source
o Fully featured
o Lends itself to TDD
o Provides built in tools for utilizing SOLID principles
o Good for front facing as well as backend applications.
o Good documentation and the framework is being actively developed.
Resources and Links
Wikipedia
Laravel.com
Laracasts.com
PHP.net
Stackoverflow
Thank you and happy
coding!

Weitere ähnliche Inhalte

Andere mochten auch

Object Oriented Terms
Object Oriented TermsObject Oriented Terms
Object Oriented Terms
guest3c69aefa
 
Solid and ioc principles
Solid and ioc principlesSolid and ioc principles
Solid and ioc principles
eleksdev
 
Product and service design
Product and service designProduct and service design
Product and service design
Grace Falcis
 

Andere mochten auch (13)

data Structure Lecture 1
data Structure Lecture 1data Structure Lecture 1
data Structure Lecture 1
 
Advanced PHP Concepts - Tutorial 2 of 3
Advanced PHP Concepts - Tutorial 2 of 3Advanced PHP Concepts - Tutorial 2 of 3
Advanced PHP Concepts - Tutorial 2 of 3
 
OOP & SOLID
OOP & SOLIDOOP & SOLID
OOP & SOLID
 
Object Oriented Terms
Object Oriented TermsObject Oriented Terms
Object Oriented Terms
 
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
 
Some OOP paradigms & SOLID
Some OOP paradigms & SOLIDSome OOP paradigms & SOLID
Some OOP paradigms & SOLID
 
Solid and ioc principles
Solid and ioc principlesSolid and ioc principles
Solid and ioc principles
 
Forest Resources
Forest ResourcesForest Resources
Forest Resources
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Forest Resources
Forest  ResourcesForest  Resources
Forest Resources
 
Forest Resources
Forest ResourcesForest Resources
Forest Resources
 
Clinical Anatomy Circle Of Willis & Cavernous Sinus
Clinical Anatomy Circle Of Willis & Cavernous SinusClinical Anatomy Circle Of Willis & Cavernous Sinus
Clinical Anatomy Circle Of Willis & Cavernous Sinus
 
Product and service design
Product and service designProduct and service design
Product and service design
 

Ähnlich wie Procedural to oop in php

Coding for desktop and mobile with HTML5 and Java EE 7 - Geertjan Wielenga
Coding for desktop and mobile with HTML5 and Java EE 7 - Geertjan WielengaCoding for desktop and mobile with HTML5 and Java EE 7 - Geertjan Wielenga
Coding for desktop and mobile with HTML5 and Java EE 7 - Geertjan Wielenga
JAXLondon_Conference
 

Ähnlich wie Procedural to oop in php (20)

Understanding the DevOps Tooling Landscape
Understanding the DevOps Tooling LandscapeUnderstanding the DevOps Tooling Landscape
Understanding the DevOps Tooling Landscape
 
Dev ops tutorial for beginners what is devops &amp; devops tools
Dev ops tutorial for beginners what is devops &amp; devops toolsDev ops tutorial for beginners what is devops &amp; devops tools
Dev ops tutorial for beginners what is devops &amp; devops tools
 
How open source is driving DevOps innovation: CloudOpen NA 2015
How open source is driving DevOps innovation: CloudOpen NA 2015How open source is driving DevOps innovation: CloudOpen NA 2015
How open source is driving DevOps innovation: CloudOpen NA 2015
 
Microsoft Flow session : tips, pitfalls, warnings to be known before starting...
Microsoft Flow session : tips, pitfalls, warnings to be known before starting...Microsoft Flow session : tips, pitfalls, warnings to be known before starting...
Microsoft Flow session : tips, pitfalls, warnings to be known before starting...
 
DevOps
DevOpsDevOps
DevOps
 
Dev ops
Dev opsDev ops
Dev ops
 
TechRadarCon 2022 | Have you built your platform yet ?
TechRadarCon 2022 | Have you built your platform yet ?TechRadarCon 2022 | Have you built your platform yet ?
TechRadarCon 2022 | Have you built your platform yet ?
 
IT for HR professionals
IT for HR professionalsIT for HR professionals
IT for HR professionals
 
About DevOps in simple steps
About DevOps in simple stepsAbout DevOps in simple steps
About DevOps in simple steps
 
Understanding DevOps in simpler way with Continuous Delivery
Understanding DevOps in simpler way with Continuous DeliveryUnderstanding DevOps in simpler way with Continuous Delivery
Understanding DevOps in simpler way with Continuous Delivery
 
Geoscience and Microservices
Geoscience and Microservices Geoscience and Microservices
Geoscience and Microservices
 
What is DevOps?
What is DevOps?What is DevOps?
What is DevOps?
 
Coding for desktop and mobile with HTML5 and Java EE 7 - Geertjan Wielenga
Coding for desktop and mobile with HTML5 and Java EE 7 - Geertjan WielengaCoding for desktop and mobile with HTML5 and Java EE 7 - Geertjan Wielenga
Coding for desktop and mobile with HTML5 and Java EE 7 - Geertjan Wielenga
 
1st Riga DevOps meetup
1st Riga DevOps meetup1st Riga DevOps meetup
1st Riga DevOps meetup
 
Node.js vs PHP, What should SMBs prefer for web development.pdf
Node.js vs PHP, What should SMBs prefer for web development.pdfNode.js vs PHP, What should SMBs prefer for web development.pdf
Node.js vs PHP, What should SMBs prefer for web development.pdf
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
 
NodeJS vs Laravel.pptx
NodeJS vs Laravel.pptxNodeJS vs Laravel.pptx
NodeJS vs Laravel.pptx
 
Agile Gurugram Conference 2020 | Value of DevOps - Journey from Automation to...
Agile Gurugram Conference 2020 | Value of DevOps - Journey from Automation to...Agile Gurugram Conference 2020 | Value of DevOps - Journey from Automation to...
Agile Gurugram Conference 2020 | Value of DevOps - Journey from Automation to...
 
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
 
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Procedural to oop in php

  • 1. Procedural to OOP in PHP Presented by Barrett Avery, Data Systems Lead @ IDX, LLC Antonio Ortega, Biz Dev @ IDX, LLC
  • 3. What is IDX? We are a SaaS product that creates web tools based on aggregate real estate data.
  • 4. And More Data Provided by a Multiple Listing Service: <xml><stuffs>asihe234ouawyd7suh</stuffs></ xml> And More Data Provided by a Multiple Listing Service: <xml><stuffs>asihe234ouawyd7suh</stuffs></xml> And More Data Provided by a Multiple Listing Service: <xml><stuffs>asihe234ouawyd7s uh</stuffs></xml>
  • 5. Objective ● Where we were and where we are going. ● Some differences between Procedural and OOP ● Give some insights from what we have learned along the way. ● Quick dive into SOLID Principles ● Quick dive into the Laravel Framework
  • 6. Procedural - Where we were Definition: Procedural Programming is a list or set of instructions telling a computer what to do step by step and how to perform from the first code to the second code. Source: Wikipedia.
  • 7. Procedural Pros and Cons Pros: ● Quick to develop and implement. ● Easy to learn. ● Simple architecture and overall structure. ● Good for quick and simple applications. Cons: ● Difficult to scale for future needs. ● Does not lend itself well to test driven development (TDD). ● Usually is very flat in terms of design and structure. ● Not good for larger applications that will likely change over time. ● Maintaining can be very challenging.
  • 8. OOP - Where we are Definition: Object Oriented Programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Source: Wikipedia.
  • 9. OOP Pros and Cons Pros: ● Much easier to scale for future needs and development. ● Good for larger more complex applications. ● Lends itself well to Test Driven Development (TDD). ● More dynamic and fluid in terms of the architecture and overall design. ● Maintainable. Cons: ● Can easily become very complicated in terms of design and architecture. ● Takes much longer to develop initially. ● More difficult to learn than Procedural.
  • 10. Why did we switch to OOP? ● Scalability ● Testable ● Maintainable ● Follows a more modern methodology of programming (SOLID) ● Laravel
  • 11. SOLID and Laravel - Quick Dive Covering a couple of key components we are using in our applications at IDX, SOLID principles and the Laravel framework.
  • 12. SOLID OOP Principles Single Responsibility Open Closed Liskov substitution Interface segregation Dependency inversion
  • 13. Laravel Framework ● Why we chose a framework? o Gives a base to build scalable applications o Consistency between projects o Training is much easier when you have a standard to base your application on ● Why we chose Laravel? o Open Source o Fully featured o Lends itself to TDD o Provides built in tools for utilizing SOLID principles o Good for front facing as well as backend applications. o Good documentation and the framework is being actively developed.
  • 15. Thank you and happy coding!

Hinweis der Redaktion

  1. Antonio’s Intro might go here?
  2. Antonio slide.
  3. We used to have a relatively flat structure that involved a few global classes that were huge (7 - 8K lines long) along with several other smaller classes that made up our core system. Class inheritance and “require” statements were as OOP as we were. This made for a lot of challenges in terms of maintaining the code base as well as growing the application for new features as well as bug fixes, etc. Most of our classes were top-down structure, with a few classes that could be overloaded by other classes, but still pretty flat all and all.
  4. Whereas Procedural can be great for your simple 10 - 30 page websites, it starts becoming very difficult to scale beyond that point. Maintaining the codebase is one of the biggest challenges, mainly because if you house most of your methods in a single file - that file becomes cumbersome and difficult to find where anything is in all that code. Especially if the coding style is different between developers, which it usually is. Procedural does not impose good coding practices that help keep your code clean and easy to read. In fact PHP allows for some pretty bad habits in this regard. Without good coding standards, Procedural code can quickly become a nightmare to look at when you have multiple different ways of coding the same thing put into a single application.
  5. After PHP 5.3 we have been able to leverage namespaces, which have really brought PHP into the OOP realm. And it’s only getting better with 5.5, 5.6 and seeing what the future holds with PHP 7. We initially started looking into pre-done frameworks to help standardize our codebase, one thing led to another and Laravel became the one we chose. During the learning of Laravel we started looking into design patterns as well as other OOP mythologies to help us developer our applications better, more scalable and easier for future developers to come on board and catch on quickly. In order to beat our competition, we had to rethink a lot of things. Our Acquisition system was one of them. And so while learning these new methodologies and technologies we began designing and building. We are currently nearing the end of Phase 1 in a complete rebuild from scratch of our data acquisition system. Using SOLID principles, true OOP and using the Laravel Framework as it’s base. We are also employing Test Driven Development (TDD) via a couple different testing suites (PHPSpec and Codeception). This allows us to build a robust system that is much easier to maintain, is scalable and allows for easy development and implementation of new features as they are needed. The project has been a great learning experience for us as developers and has forced us to shift our thinking away from the traditional way of coding, to a more SOLID way of coding. ON top of this we will be moving away from MySQL as our main-stay DBMS to Couchbase, as NoSQL DBMS. We are also using ElasticSearch for our search intensive tasks of the millions of real estate listings we pull from the 600+ Multiple Listing Services (MLS’s) throughout the US and Canada. This project also allowed us to implement good coding practices that make the code understandable and consistent across the application. Clean code helps maintainability after the project is complete.
  6. Expand on the need for our application to be scalable, so we can more rapidly add new features to our already feature rich platform.
  7. Give some numbers on the amount of data we are getting, normalizing and whatnot.
  8. Intro slide to SOLID and Laravel
  9. Single Responsibility: Each class should have a single responsibility or focus, this is very different from the several thousand lined classes or helper scripts we used to write in Procedural code. - Allowing for many smaller classes to do what a mammoth classes would have done. This makes for much more maintainable code. - Open Closed: Software entities (class, methods, functions) should be Open for extending but Closed for modification - Allowing the behavior of the class to be extended to other classes without modifying the source code of the class. - Uncle Bob: Separate extensible behavior behind an Interface, and flip the dependencies. Liskov substitution: Liskov's notion of a behavioral subtype defines a notion of substitutability for mutable objects; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program. - Derived classes must be substitutable for their base classes. Any implementation of an abstraction or interface should be substitutable anywhere the abstr - action is accepted. The gotcha here is when you implement a class from an interface that you are adhereing to the contract of the interface. Meaning if it expects the return value to be an array, all classes that implement the interface, need to return an array. Type-hinting in the doc blocks help remind us about this rule. Interface segregation: Meaning no client should be forced to depend on methods it does not use. So rather than having one massive interface in which many classes are dependant on, create many smaller interfaces so the classes can only know, or be concerned about, the methods in which they will use, rather than all of them. - It all comes down to the responsibility a given class has in regards to its dependencies. Many smaller interfaces rather than fewer larger interfaces. Dependency inversion: High-level modules should not depend on low-level modules, both should depend on abstractions. And abstractions should not depend on details, but details should depend on abstractions. This is where decoupling of modules comes into play. A good example would be decoupling of database tasks, as to easily switch from one DBMS to another. - Interfaces and their implementation classes.
  10. Laravel Framework – going over the framework, some of the features it has such as artisan, blade templates, eloquent ORM, etc.
  11. Thank you and now for Q & A and overall discussion of the materials covered.