Model View Controller Architecture-Driven Application Development – Book Review and Guidelines

In early summer 2021, the book “Pro PHP 8 MVC: Model View Controller Architecture-Driven Application Development” by Christopher Pitt was published. This is the second edition of his book on how to work with MVC in PHP.

In this review, I will briefly go through the contents of the book and give my opinion on the pros and cons of the book, as well as leave recommendations for whom this book is suitable.

so far only in English
so far only in English

About the author and technical reviewer

Although I have not come across work before Christopher Pitt (Christopher Pitt) as part of his activities for the PHP community, nevertheless, after conducting a research, I found that he once wrote quite interesting articles about PHP https://www.sitepoint.com/author/assertchris, some of which ended up on Habr in the form of translations (https://habr.com/ru/post/345024/) and deserved worthy attention. Let’s assume that the guy is even.

Much more in this book I was interested in the technical reviewer – Matthias Noback (Matthias Noback) is an absolutely legendary personality within the modern php community. If you work in the corporate segment and write complex systems in PHP, then most likely you do it in Symfony, which means that you have definitely read or at least heard about his book “One Year with Symfony”. And his articles on his personal site, although they talk about an ideal world with an ideal PHP that will never come, are still very instructive.

Briefly about the essence of the book

I would jokingly call this book: “How to pay $ 39 to have Christopher Pitt write a bad MVC framework and invent synthetic situations where to use innovations from PHP 8.0”

Review of the content of the book

This book describes the MVC pattern very briefly and provides a step-by-step implementation of a complete web framework in PHP 8.0.

We build the main components of the framework completely from scratch, assemble a ready-made web framework from them and push it to a github:

  • Router;

  • Form processor;

  • Form Validator;

  • Templat Engine (4 variants of implementation in php);

  • PDO harness for working with different bases;

  • ORM;

  • DI;

  • Test harness;

  • Config collector;

  • Management of cache, sessions;

  • Work on sending email;

  • Logging system;

Interestingly, the author also compares his implementation with the implementations in popular solutions, mainly from Laravel and Symfony.

This book is exclusively about: how to make a web framework using the MVC pattern, and not about why you need to do one way or another, there is practically no theory that would describe the reasons for certain decisions.

Pros of the book:

  • There is an explanation of new features from php 8.0

  • There is a good overview of tooling for working with PHP

  • Code is written exclusively in strong typing

  • The reader is led to the idea that it is better to start with a popular solution, and not fence your own

Cons of the book:

  • Although the book is positioned for beginners, the code is written in places difficult and incomprehensible (just the gears will hold together when reading it)

  • The code is written in a strange way (high nesting level, strange naming of variables, etc.)

  • Poor use of PHP 8.0 features

  • No theory, no explanation for why to do one way or another

Final opinion

This format of books is quite popular when some concept (in particular MVC) is taken and then step-by-step implementations of this concept follow. In particular, I read similar books about MVC using Python and Java as examples. And in my opinion, this book is not the best representative of this format.

The main disadvantage for me is the complete absence of a theory of what MVC is, why modern web frameworks have come to this pattern, what are the main advantages of such a pattern, and so on. In this book, just at the beginning there is a caveat that MVC is cool, and then immediately to the implementation. It’s somehow not pleasant here to take our word for it.

The second main disadvantage for me is the strange positioning of this book. If a person has already read several books on PHP and worked with any web framework, then he already understands the concept of MVC well enough and how it works on the example of other frameworks – this book will not say anything new for him. And for beginners, it is too heavy and tedious in terms of code and lack of explanation.

I would recommend reading something like “PHP in the original”, and then go to the documentation of some popular PHP web framework instead of this book. Many books on learning PHP include a couple of chapters on building a web framework, which should be enough to get you started.

There are no doubt about the pros in this book, but whether they are worth the money is a question.

Interesting note

More and more PHP books talk exclusively about Symfony and Laravel. It is already obvious that the market for custom development in PHP is shrinking and such frameworks as zend and yii are losing the attention of the php community.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *