Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OOP in Web Development with PHP

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

OOP in Web Development with PHP

This slide covers simple concepts such as classes, objects, methods, properties, MVC, MySQL, Data Abstraction, Data Binding, etc in object-oriented programming using PHP.

Oliver Mensah

March 02, 2019

Transcript

21 slides
  1. Oliver Mensah Software Developer, Technical Writer, Developer Community Enthusiast •

    Currently a National Service Personnel at AgroInnova • Guest Author at Auth0 • Co-Organizer at Facebook Developer Circle: Accra LinkedIn: @OliverMensahDev Twitter: @OliverMensahDev GitHub: @OliverMensahDev
  2. Overview of Web Development ❖ Creating dynamic web applications ➢

    Access via browser ❖ Broad Divisions ➢ Frontend ▪ JavaScript, HTML, CSS ➢ Backend ▪ PHP, NodeJs, etc. ➢ Database Technologies ▪ MySQL, MongoDB, etc.
  3. Overview of PHP ❖ Open source general-purpose scripting language, usually

    used for web development ❖ Code executed on the server ❖ Can be embedded in HTML ❖ Compatible with many databases ❖ Cross platform ❖ Large community ❖ Popular ➢ Simple ➢ Efficient ➢ Secure ➢ Flexible ❖ PHP Standard Recommendations(PSRs)
  4. PHP Fundamentals ❖ Variables, Arrays, Loops ❖ Functions and Conditionals

    ❖ working with databases ❖ using third party libraries Example: https://github.com/OMENSAH/AshMa rt/blob/master/shoes_Search.php
  5. I think we can do better In terms of ❖

    Code design and organization ❖ Which means ➢ ability to reuse & recycle code ➢ encapsulate ➢ easier to maintain and test
  6. Overview of OOP ❖ Program in terms of objects ❖

    OOP concepts ➢ Classes ➢ Objects ➢ Methods & properties ➢ Encapsulation and Access Modifiers ➢ Data abstraction ➢ Inheritance and composition ➢ Polymorphism ❖ Autoloading ❖ Dependency Injection ❖ Code organizational patterns ➢ MVC ➢ MVC Repository pattern
  7. Classes, Objects, Methods & properties ❖ Basic building blocks of

    OOP ➢ classes ➢ objects ➢ methods ➢ properties
  8. Encapsulation ❖ Mechanism to restrict access to data and methods

    of class ❖ Achieved with access modifiers ➢ public ➢ protected ➢ private
  9. Inheritance and composition ❖ Code Reuse ➢ Use Composition when

    one class cannot exist without the other ➢ If a class wants to use a class functionality https://www.thepolyglotdeveloper.com/2018/09/inherita nce-composition-php-application/
  10. Polymorphism ❖ Polymorphism says that methods in different classes that

    do similar things should have the same name. ❖ Achieved through ➢ Interface ➢ abstract class
  11. Code Organizational Patterns ❖ MVC ➢ Model ➢ View ➢

    Controller ❖ MVC- Repository Pattern ➢ Outsource data source operations from the controller http://bit.ly/MVCRepository http://bit.ly/mvc-pattern
  12. Proper MVC ❖ Friendly URL ➢ /farmers ➢ /farmers/7 ❖

    Structure ➢ URL Rewriting ➢ Bootstrap ➢ Service Locators ❖ Many more

More Decks by Oliver Mensah

Other Decks in Programming