📜 ⬆️ ⬇️

The dark side of programming for beginners, including php

After six years of programming you see your mistakes. Of course the errors are purely their own, but they are made out of non-knowledge. And unfortunately ignorance is taken along with knowledge.

The easiest way to check this is to read about any paradigms, patterns, and so on. When you learn something, there will be two or more camps: “for”, “against”, “not for this and that” and so on.
Let's take this particular as the Hungarian notation :
The essence of the Hungarian notation is reduced to the fact that identifier names are preceded by pre-specified prefixes consisting of one or more characters.

In the books on programming, I read that it is necessary to use the Hungarian notation and to form prefixes by data type: int iData; .
But there is a minus: when changing the type, you will need to change the variable name.

It is these minuses that ultimately can be those fundamental errors in the formation of a future programmer.

Dark side


The Last Habratopic Jedi Path: Act 2 gave an impetus to publish his thoughts on what the dark side of programming and the programmer is.
The author of that topic says:
Dark side. The point is not that you should consider yourself stupid or not smart, the fact is that you should not be of high opinion of yourself.
')
To be confident in yourself, to believe in yourself is necessary and necessary. Do not be afraid of problems and go to the head with a solution - also necessary. But when you consider yourself smarter than someone (I think there is a comparison with a fairly intelligent person), then from this moment everything will stop, including self-development, the desire to learn, etts.


Well let's go.

Procrastination


When there is no result

Programming for me began with a craving to write my game. At school I was very keen on GameDev, but I could not get the result. In general, while reading the GameDev literature at the time, I came across many code samples for MS Visual Studio. That's when I started reading books on Visual Studio, which was in vain . As it turned out later, there was nothing in the books and the thick bibles about programming.
According to Visual C ++, I read a couple of bibles, a bunch of websites and everything I could do - MFC, and since I didn’t actually know C ++, I was very quickly developing development.

In the desire to get the result, I even tried to master the Visual basic. Excerpt from one book:
The difference between visual development environments and earlier programming tools is that instead of a programmer, they “write” the most frequently encountered and boring parts of the program, thus freeing it up for interesting and creative work. Sometimes, if the task is simple, it happens that the computer creates the entire program. Another feature is that a programmer working in Visual Basic and other similar environments cannot escape from the so-called object programming that has won the programming world in recent years.

Turbo Pascal, like all of us studied in school, but the development of games failed due to the lack of an engine. There were few examples on Delphi, so a couple of books were read for this IDE. About two years I read everything that relates to the development and operation of game engines, but I didn’t do mine.

Probably not one year passed before I realized that it was not my understanding of the book, but the information in these books and the sequence of its study. I simply thought that I needed books on Visual Studio, whereas I needed to study books on language .
I methodically read about high-sounding statements about the correct syntax, and in the code of the examples going with the book there were errors, omissions, omissions, or it was not compiled.

As a result, after 4 years of trying to write my game, I had absolutely nothing.
Now I can say that the more I failed, the more procrastination progressed. In fact, the periods of time between when the code was written or when attempts were made to launch it were constantly increasing. And I, in search of a result, began to jump from language to language and trying to find "truth", periodically scoring my head with a theory that did not help me figure it out.

IMHO: In programming (at first) it is important to initially choose something one and at least achieve a little, otherwise you can jump from language to language, from IDE to IDE, or from framework to framework for a long time.

Rewrite the World

After failures and respite, I became interested in programming for the web. I read a book on php4 and somehow began to write "sites". Of course, I mostly rules and append scripts and merged it into “sites”.

After a while I began to read the code, see my mistakes and learn php5 with its buns in the form of "OOP". The first thing I wrote for the new puff-puff: a class for working with a database, then another “classes”.
As a result, it took me a very long time to develop one site or another, to “think over” how the simplest site would work. I rewrote / supplemented / improved classes almost every time.

In principle, I knew that there were certain libraries, both in the form of classes (php5) and for outdated php4. But then I was just obsessed with the idea to write everything I needed.

When for the smallest project you end up having to “rewrite” your classes once again, how can you avoid procrastination here?

Fighting loads

One of the reasons why I was thirsty to write everything myself was the struggle with the loads.
Ardent supporters of compiled languages ​​watered php and pointed out its inferiority and "slowness".

And ardent supporters of writing their own compilers, CMS, frameworks, libraries, classes - everywhere and always to each public project poured a ton of dirt and examples of brakes.

To be honest, for 6 years I once faced a server overload with my application. And just because I did this for mysql:
SELECT ...,... FROM ... WHERE in ( SELECT ...,... FROM ... WHERE in ( SELECT ...,... FROM ... WHERE in ) )
Performing one SELECT separately allowed the load to be removed.

But I listened to my older comrades and followed their advice: “learn the language, and then use the framework already”, “write your own framework, because someone else will limit your development” and so on ...

The rescue


The best tool is one that can be used, but not the one that does not exist. In other words - write the program as you can now, and not “as needed”.

Over time, I began to concentrate on a particular language, and if something did not work, I methodically asked. For example, when I became interested in qt, I started reading about ++ and OOP, and only then about the library.

I nevertheless found for myself the “strength” of various libraries and frameworks. Began to use large projects and read their code, which allows you to learn.

I started writing and using code under circumstances. If it was a simple site, then you could write it in php without mysql, or use a CMS on the / sqlite files. For business cards using mysql may be redundant.

A large site trying to cram into the “no SQL” work paradigm, on the contrary, can negatively affect the results. From laziness and short-sightedness in the first couple of years I was rewriting projects (first without SQL, then with SQL).

Let's be honest: hacking a little-known software is unlikely, especially a site with a traffic of <1000 uniq / day.

I can trust to write for a large project to write myself only if I am a professional in this and can achieve a result. In general, you need to understand that writing a serious project and doing it for yourself / in your spare time / alone is many times more difficult than putting up a technical task and getting results from another person / team. And this is about many things.

We are all at different levels of development and someone most often ahead of us. I do not see anything shameful in the fact that the programmer would order the development of another programmer. Although someone considers it beneath his dignity to pay another, but for days on the forum to hang out - please (procrastination) .

Do not be afraid to use other people's classes, libraries, frameworks, and so on. If the project is experiencing problems for their reason, then you need to include the head. I paraphrase: Doing pre-optimization is evil .

It helps a lot in “not inventing” bicycles reading pro design patterns (patterns) .

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


All Articles