Most recently, I realized why many programmers using PHP are different from programmers “in general”. The basis for my understanding was the words of Ruslan Kosolapov: “This is PHP. It is impossible to understand, just to remember. ” But indeed, it is. I will explain why.
Practically everyone who works closely with PHP agrees that the language is not at all easy to learn: if in most languages you need to understand the principles inherent in the language, and then refer to the documentation as needed, then you don’t have to look at the documentation all the time - because logic does not work. The fact is that PHP has a huge, incredible number of functions spread in the global scope. These functions were written at different times, by different people, without clear agreements on how to call them, how to organize the reception of parameters, how to return the results. Very, very much happened spontaneously, historically, and if it happened so, it is no longer subject to alteration. Within each expansion - its own style and its own logic. The scope in which functions from extensions are imported is global, and there was no global standard, and it is already obvious that there will not be: the amount of work required for this is too large.
PHP is a language with history, it has layers like an ancient city. It began with a set of Perl scripts to create a homepage, then was rewritten to C (several times). The engine corresponded, and the spontaneously added functions remained, for reasons of backward compatibility, almost unchanged, except that they increased the number of parameters. But in such a way that the list of parameters is reduced, or, say, the function is gone - this was not in my memory (this is since 1998). By the way, the order of the function arguments must be memorized. A simple example: if the search functions preg_match () and ereg () need to be passed first “what are we looking for”, then “what”, and the third optional parameter can be passed a variable to save the found, then the function strpos () is vice versa; Estimate, by the way, the heterogeneity and irrationality of the names of the functions as such). What the function returns, and in what situation - also need to remember. The same strpos () will return false if nothing is found, and the documentation emphasizes that the function can return 0, that is, it is necessary to compare the return value and false taking into account the type, because when checking without types, the integer zero will be converted to false.
It was all a saying for those who are not too in the subject. Now fasten your seat belts: a fairy tale begins.
All the above requires from the programmer, along with other skills, the presence of another paradoxical ability: not to try to generalize the accumulated knowledge. Personally, it has always been easier for me to understand or come up with a rule than to remember the great variety of cases to which it fits. In this case, there will be more exceptions to the rule than cases in which it will work.
You can start working with PHP very quickly (just at the expense of simple and sometimes convenient syntax). That is why novices begin to learn it, and, as a rule, in parallel with the study of a project. And the absurdity begins: people initially get used to working with a low-grade code inherited; and the volume of the project code is often such that it is possible to rewrite correctly, but ... only with a lot of experience, free time, and so on, that is unrealistic. And they produce, making their first steps towards a little bit of mastery, the next tons of code that will terrify all those who follow.
This is the setup of Windows - there is also a lot to remember. There are few rules, each menu is a special case. Although everything seems to be simple and clear, but personally I find it easier to read sensible documentation without pictures and set up the necessary functionality in one place than with a smart look to stick into a coloring book for the smallest ones. Although you can start quickly and easily, yes.
')
Recently, I read a post in LiveJournal, where the idea of comparing Windows enikeyschikov and priests from D & D was in the comments. I will quote: “In the D & D gaming system, such an interesting division was invented to characterize the character’s mental abilities: INT (intellect) and WIS (wisdom). INT is more significant for a mage, WIS is more important for a priest, although the essence of the game is about the same - the use of magic (which is, if not a projection of the work of a “programmer” from the point of view of the average man in the street). However, the game mechanics are insignificant to us here, but the classification itself of the ways to comprehend the world is interesting - through the independent construction of logical structures (INT) or through the accumulation of knowledge (WIS). ”
This is what I mean: in general, developed for the programmer is more developed, "pumped" mechanisms of thinking, than memorization of heterogeneous, unrelated facts. But for a PHP programmer, the situation changes exactly the opposite: it is important to remember the facts, not trying to understand. And I think everything, why a holy war in a project between programmers can flare up due to the fact that one remembers that quotes of different types are processed at different speeds (the difference is insignificant, but on huge cycles impossible in real life, it becomes noticeable) , and the second indicates that in fact such a cycle does not need to be done almost anywhere and never. For the first, this is a fact, and this should be constantly considered. However, he does not understand that checking an undefined variable in the same cycle is a multiple waste of resources; that the error can be shielded, but the error will not disappear; does not understand why transaction independence is needed. The point is not that one of them is smarter, and the other is more stupid, no. It's just a different type of thinking, focused on memorization, and not on the desire to collect data and analyze the situation from different angles. And PHP itself - as a tool, as a tool, as a topic of communication - attracts people first of all to the “memorable”, and not the analytical type.
Priests programming.