📜 ⬆️ ⬇️

About programming style

Recently, more and more such opinions can be heard: "PHP is the language for housewives" or "PHP and web programming have nothing in common." Actually, the reason that prompted me to write this topic is the link to LJ, flashed on Habré, where Perl and PHP are compared. The comparison, of course, is not in favor of the latter.


I decided to figure out where the stereotype’s legs grow from: “PHP is a lack of language that cannot be taken seriously.” I believe that, firstly, PCP is obliged to this opinion for its syntax, which is very easy and easy to learn. This, in turn, encourages newbies studying it to write and publish their first scripts, barely knowing the basic constructs of the language and not penetrating the general philosophy of programming. Numerous articles that are abundantly present in the open spaces of the Russian Internet also dictate a non-cutting approach to programming. So, we have identified two major problems.

How to get rid of it? How to prove (at least to yourself) that PHP is an excellent programming language that allows you to create real, high-loaded, serious web applications?
')
Need to start with the basics. All articles such as “mastering PCP in 2 hours and write your first guest book” are evil. Evil that needs to be eradicated. The problem is that there are no really useful materials that will teach real programming methodology, but not stupid scripting in nature. Numerous textbooks (with rare exceptions) also do not provide this knowledge. Where does a novice who begins to learn a new language learn what is good and what is bad? How does he know what programming patterns are, what MVC is, frameworks, competent design and much more ...

Listening to articles published on PHP sites, he will learn the possibilities of the language, but he will not learn to write on it. I repeat that, probably, the syntax, which allows and forgives the writing of the so-called “bydlokod”, is largely to blame. What to do with it? Let's look towards other languages, for example, C ++. This, of course, is not a very appropriate comparison, but we will be able to adopt some tendencies present in this language.

C ++ will not allow us to write any complex program without preliminary design. Libraries, header files, namespaces - all this makes a disciplined and responsible approach to writing code.
And what about our favorite PHP? Everything is very simple here: there is a task that can be performed in different ways, and the simplest and most obvious one is often chosen - the problem is solved immediately. Those. the coder stupidly sits down and immediately starts writing code, “as God puts it to the soul.” No design. Nothing. Of course this is wrong.

So, I invite the community to think about the following topics:
  1. How to make PHP gain the reputation of a healthy, serious language, to be respected as well as Ruby or Python?
  2. How to prevent degradation of newbies who are starting to get familiar with PHP?

Source: https://habr.com/ru/post/41812/


All Articles