MVC for advanced PHP developers

22,967

Solution 1

Links, that contain PHP-only materials, are marked with php for easier identification.

You cannot even begin to delve into MVC before you have comprehensive understanding of OOP. That include OOP practices (dependency injection, unit testing, refactoring) principles (SOLID, SoC, CQS, LoD) and common patterns (and no, singleton is not an object-oriented pattern).

MVC is an advanced architectural design pattern, which requires solid understanding. It is not meant for beginners or for tiny "hello world" applications. One uses MVC to add additional constraints to the codebase, when simple adherence to OOP practices becomes too loose to control the codebase.

The best I can suggest for you would be to begin by expanding you knowledge regarding object oriented code:

The two lectures above should cover the basics. And then move on to:

When you understand all that was explain in this series, you can expand on:

Also, I would strongly recommend for you to read (in this order):

P.S.: you might also take a look at this book (cautiously, because it has issues): Guide to PHP Design Patterns php

Solution 2

What I recommend to you is a book about design patterns. Most of these books also cover the MVC pattern and the other patterns are worth to know if you building a complete framework.

One good book is PHP Design Patterns. I don't know if it exists in english but I would search for other books and compare the contents.

Share:
22,967
Ivan
Author by

Ivan

PHP Developer

Updated on February 07, 2022

Comments

  • Ivan
    Ivan over 2 years

    I need some help from more experienced programmers. I want to improve my MVC skills. But I could not find a good tutorial on Google for MVC. Google always gives "MVC for beginners".

    I understand what MVC is and I can make it, but I'm not experienced enough to do something practical in OOP.

    If anyone knows a good object-oriented tutorial for MVC, please direct me to the right place — I'm looking for good links, books etc.

  • tereško
    tereško about 11 years
    Kapitel 4, Erzeugungsmuster, behandelt Entwurfsmuster, die eingesetzt werden, um Objekte zu erzeugen. Vorgestellt werden in diesem Kapitel das "Singleton-Pattern", das "Factory-Method-Pattern", "Abstract-Factory-Pattern" und das "Prototype-Pattern". .. and in final chapter it covers PEAR. This does not seem all that promising.
  • bitWorking
    bitWorking about 11 years
    @tereško so what? you think the book sucks because it covers the singleton pattern?
  • tereško
    tereško about 11 years
    It's hard to tell (notice how I neither said that it "sucks" nor downvoted). I'm just saying that one should be careful reading it. Especially if take in a count the overall amount of crap in "php books".
  • whereismydipp
    whereismydipp over 10 years
    Like the google talk ones because in the context of testing. Thanks for the list.
  • Aravind.HU
    Aravind.HU over 10 years
    @tereško this is one of the Best set of links which I have never read before Thank you very much for links . Is it possible to provide an explanation on actual reason for unit testing in php. I just wanted to know the importance of unit testing in frameworks by using tools such as phpUnit or Jenkins etc . Can we ignore this ? . I am asking this question because when I am writing code I often get a feeling that I am writing code to make sure I could use php unit easily to test its functionality . So it takes more of development effort when using phpunit .
  • tereško
    tereško over 10 years
    First of all, Jenkins is a continuous integration tool. Different subject. As for unit testing - no, you do not need to use it. It shouldn't take more time for you to write code, that can be tested. If you write good OOP code (no global state, dependency injection where necessary) then the ability to test it will be just a side effect. And, if you were to write tests, it would require additional time. This lecture might explain what are the benefits and how to write those tests.
  • tereško
    tereško over 10 years
    Thing is, when you develop without tests, the workflow goes like this: you write some code, you upload it, then you fill in some data in different forms or click around and see if it work .. then you repeat. It takes time to each time fill in the data. Unittests let you have predefine list of input and expected output so that you do not have to fill in that 50-field insurance form for the 100th time, just to test, if validation on 32nd field works correctly. And every time you find a bug, you just add a test with data that replicates that bug and the output that actually should be.
  • tereško
    tereško over 10 years
    Another thing that unit tests do is - prevent you (or some overeager co-worker) from removing bugfixes in the name of "optimization", just because somebody does not know or cannot remember "why there is this strange 3rd condition in IF statement?". If you remove something that breaks the code, unit tests will probably pick it up.