Answer the question
In order to leave comments, you need to log in
What to read on OOP and web development patterns in PHP?
Originally title of a question was: advise the book. But the toaster asks to ask exactly the question...
I have been writing for the web in php for almost 15 years, but all this time I have adhered to the functional style, because I worked alone and did not see the benefit of switching to oop. And then I had to go to work in the office. I have enough brains and experience to complete current tasks, but ... I swim a lot in theory, I delve into the code for a long time, I get stupid on all these constant inheritances, interfaces, one-line methods, and so on. I can't really feel the benefit of OOP, except for the obvious one - code decomposition for ease of collaboration through git.
Advise me to read something intelligible with practical examples from the field of web development - about OOP, design patterns, and that's it. Better is a book that exists in Russian translation, and not articles / lectures and so on.
PS I started reading Fowler's Refactoring and felt the lack of theoretical knowledge even more.
Answer the question
In order to leave comments, you need to log in
1. Design Patterns PHP (and in Russian!)
2. What's new in PHP 7.2 (briefly) - here
After you understand the patterns, I advise you to look at the implementation:
1. https://nette.org (the most convenient and easiest , with a clear code structure)
2. https://fatfreeframework.com (micro-framework, almost similar to nette)
3. https://phalconphp.com (one of the leaders in performance, C-extension)
4. https:// www.iceframework.org (one of the performance leaders, C-extension)
Here, first you need to figure out what you need, to understand the patterns or the essence of OOP in general.
In php, in practice, in most cases it is used through one place, in most cases everything rolls into files with a bunch of functions or methods, in short, proceduralism. As I understand it, this style is close to you, but on a large project, supporting, scaling and doing anything with it is a living hell, this is an unstructured mess. PHP allows you to write this mess, and that is why it is so loved at the beginning, and then hated at the end. It is better to consider OOP separately, and then look at how it is used in PHP in a pure form of the Symfony type and adapted to the realities of PHP of the Laravel type. The combination of functional and oop approach in PHP is the perfect balance, but to keep it, you need to see the pros and cons of both approaches.
Laravel is a good framework, but they don’t know how to use it, it doesn’t force you to write correctly, as a result, you get another mess, the same procedure, but now spread over models, controllers and folders without any hint of a good structure.
Symfony is cruel to beginners, breaks the brain and does not allow you to adapt and write as before, but now call it oops.
In your case, you just need to start with the basics of what OOP is. On examples like the vehicle is an abstract class, and the car and the plane are descendants, and the interface to move differently is implemented in them, but we must remember that this seemingly childish nonsense works fine in software entities, in particular for the web, for example, you write a trading platform parser , you have an abstract class of the marketplace and specific implementations (amazon, ebay) that store some attributes, and you also want these objects to be stored in storage, but you don’t want to write the storage yourself, but take it ready, from it has a storable method, and you implement this method in these sites, and now you can already save sites. In short, as you can see, I didn't really try to make a good answer, but the point of oop is, that the code becomes similar to the details of the designer, which begin to dock with each other. No performance gain, just structure, versatility, scalability.
Sorry for the typos, it's hard to write on a phone.
Start working with someone else's code and you will immediately understand everything.
For a beginner, it will be easier to start with Laravel (a huge amount of training materials), but I do not advise you to dwell on it for a long time.
I myself am now trying to switch to web development after Visual FoxPro. I'm poring over textbooks. In my humble opinion:
1. Matt Zandstra's book "PHP Objects, Patterns and Programming Techniques". A very specific and compelling book.
2. A course on creating your own framework. 29 lessons from scratch. https://www.youtube.com/watch?v=nGHfiWjIDr8&list=P...
They help me a lot. Only the book should be read ahead of the course ...
It is with examples in php - this is a book by Matt Zandstra. Good, written in easy to understand language. Examples of patterns in php, which speeds up understanding.
Classic Gang of Four. Examples in java, understanding problems should not arise.
In general, about OOP and architecture, I will advise 2 well-known books - Martin "Clean Code" and McConnell "Perfect Code".
The last 3 books are the industry standard, generally recognized works, written in an understandable and intelligible language, there is a Russian translation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question