Coder Social home page Coder Social logo

php-design-patterns-real-life-code-review-1's Introduction

Applicable Programming logo

PHP Design Patterns in real life - Student code review #1

This project is part of the PHP Design Patterns course from ApplicableProgramming.com showing usage of
Design patterns and other OOP principles in real life - by commenting on one student project.

Reviewed project uses MVC architectural pattern that separates logic into Models - which deal with data manipulation, Views - which present information to the users, and Controllers - which control behaviour of entire application.

It also uses Front Controller design pattern, which basically routes entire application trough one index.php file using mod_rewrite on apache, and by doing that it provides for more control over the access to the application. Allowing us easy and centralized access control, easy way of taking down the entire website during maintainance and big errors, easy performance measuring etc.

Singleton pattern is used for Database and Config because it enforces a single instance of each object, preventing multiple database connections by accid. With a note that Config could be refactored into regular object if singleton is not beneficial. Config is also made with more robust/standardized data storage in mind (.env files or similar).

Router is injected as a dependency into other classes that use it (Controller Factory in current version), which allows for easy use of multiple different Router strategies, by simply making another way of parsing the route.

Controller Factory uses simple factory design pattern, which returns proper, and already configured controller, which is then executed in main index.php file.

Controllers extend main controller, using advantages of inheritance in OOP, so that children controllers can reuse code that is common for all controllers in general.

Every model mostly follows Single Responsibility Principle, and is tested independently by using separated file.

login details: [email protected] test

Source by: (anonymized by author request)
Video review Code Review Youtube: ApplicableProgramming

php-design-patterns-real-life-code-review-1's People

Contributors

applicableprogramming avatar dakipro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.