Answer the question
In order to leave comments, you need to log in
What book to take for a complete understanding of OOP in php?
I have programming experience in a procedural style, but the need to learn OOP began to arise. In theory, everything seems to be clear. There is an abstract animal class that has properties, methods common to all, and then you inherit this class for objects and implement it separately with the necessary functionality. But I don't understand how to attribute this to website building. What of all is an abstract class that implies general properties and methods, and what will be a special case. In general, advise books that will help you understand and put your brains in place
Answer the question
In order to leave comments, you need to log in
From books I advise you to start with these:
OOP design principles are weakly dependent on the language, so I advise you to still read the book "Object-oriented design techniques. Design patterns"
www.ozon.ru/context/detail/id/2457392
size, it reads well.
For a complete understanding of OOP, it is worth starting to study with a more rigorous PL. For example C++. In the book "How to Program in C++" by H.M. Deitel, OOP is chewed up a little more than completely.
Dude, can you breed people on the 1st of April?
Sites himself programmed at least a little? I mean, I didn’t “make” it with a mouse, but to add something of my own there, not to use someone else’s work? I have nothing against programming with a mouse in principle, just understanding php in general and OOP in particular will not naturally add such an acquaintance.
Search drupal api and get the first example $storage = \Drupal::entityManager()->getStorage('your_entity_type');
But the request is not really indicative, because all sorts of tips on creating a mold, downloading Drupal from offsite + installation, etc. are confused. You have to make a couple of clicks on the site on the links. In short, we clarify something like this, for example, drupal api orm is mixed here, of course, "7 reasons to switch from Drupal to Yii" but in general it is already closer to the topic and there are such articles https://drupalfly.ru/lesson/create-form- in-drupal-8and now let's think about the question, why do we need to inherit FormBase, isn't it better to just copy-post the code from FormBase in each form? Let's find this class, for example, in Drupal and admire it, by the way. How can an ide or a request in Yandex help with drupal github class FormBase. But it won't help me, I already drive in joomla api orm and get something not obvious
https://api.joomla.org/cms-3/classes/JForm.html
This is the JForm class. Well, we put JForm::addFieldPath into the search, we find a lesson on creating a component, we don’t look at the details, there is also oops. We take any class and argue, as Drupal said "why don't we copy-post everything, why do we need a class, let there be a bunch of variables in the global scope and all that."
inet-reklama.com/blog/joomla/uroki-po-sozdaniyu-ko...
In fact, some kind of big article, I didn’t master it, I didn’t even flip through it, but I would be surprised if there is no oop. I didn’t make websites either on Joomla or on Drupal at all, but for some reason I speak with confidence. And try to disprove me.
But what I know is this modx
Well, I generally keep quiet about frameworks, there it will begin with the creation of mvc classes. And if you ask "why don't they do everything functionally, why the hell is oops everywhere?", then use a little oops, and then try to return to functions. You won't like it. "there is an abstract animal class that has properties, methods common to all" - well, that's enough, there are more patterns, they should be mastered. Then, when you get used to the oop. https://ershov.pw/blog/modx-revolution/api
In js, by the way, inheritance is prototypal and objects are not exactly objects. not exactly that. Well, the use of the module pattern has become the standard there, which means that in a language that is not adapted in principle to OOP, people find a way out to use OOP-like practices. It's not masochism.
OOP in any environment, not just PHP, allows you to model processes. To model something, you need to own the subject area, i.e. have considerable experience behind them in solving a specific problem in any way, in this case optimally on bare PHP.
Again, smart people have long collected all conceivable and unthinkable rakes and formulated them in the form of patterns, anti-patterns, etc.
In general, in order to start good programming in OOP, it is best to get into a team where it is practiced, for example, as a junior or even a trainee, and just endure , inject, sob, but continue to eat the cactus until the brain is completely reformatted. And yes, there is no going back...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question