📜 ⬆️ ⬇️

We become professional PHP developers. Part 1: Missing Link

I bring to your attention the translation of the article “Becoming PHP professional. Missing link.

Introduction


When I read various PHP-related blogs, Quora questions, Google+ communities, newspapers and magazines, I often notice extreme polarization of programming skills. There are questions either at the level of “How can I connect to the MySQL database”, or something from the “How do I better allocate the resources of my mail system in order to send more than one million emails per hour without using a new server?”

Personally, I distinguish 4 distinct levels of “fame” in PHP (applicable also for any other language or profession): beginner, middle, professional and elite .

Short about all levels


In PHP, beginners will learn about variables, inclusions, and working with html forms . They study simple logical constructs ; they send e-mail using tutorial lessons, and sometimes even touch upon examples of using object-oriented programming , but they even have no idea what this is all about. Newbies work with WordPress (WP) and change several CSS classes. With this knowledge they get to work, but, unfortunately, can not cope with it.
')
Professionals are people who have devoted a large part of their lives to various projects. They developed commercial applications on most, if not all, frameworks (the “framework” of your application or project), they effectively combined PHP and various databases, they attended conferences and even spoke to them. They know the design patterns and can easily design the whole project alone - from plotting to launching a project, and they don’t write procedural code for a long time.

Elite programmers are the same professionals who have spent more than 10,000 hours raising their level. They use extensions in their development, written by them, can find a bug just by viewing your code with a cursory glance, and they are also extremely scrupulous about the appearance of their code. The elite only take on the most complex projects and find alternative ways to solve problems that people do not even realize. They wrote a couple of well-selling books on PHP, spoke at dozens of conferences, maybe even created their own direction in PHP or even a very successful framework, or even two.

But who are the "average"?

Missing link


So how can a newcomer become a professional? If a person does not know anything other than the basics, then how can he improve his level and start practicing more difficult tasks? This is the question that a lot of newbies asked me. The first step in order to become a professional is to become something average, the so-called. "Average".

Next, we look at what everyone should do in the way of his smooth transition from novice to middle managers.

Forget "spaghetti code"


Most people think that using classes means that you are writing object-oriented code, whereas using functions means that the code is procedural. Let's put together common opinions: a procedural code is one in which you do not use either classes or objects, and object-oriented code is using classes and objects to the maximum.

My advice is to completely forget about the procedural code. Use OOP as often as possible - write classes, use encapsulation, think with real entities. Winning a procedural code in performance over code based on classes looks negligible compared to the subsequent use of your project by other developers. Often I meet the phrase "But after all, WordPress is procedural!". Honestly, and no matter how harsh it may sound, but the “developers” of WP are the same PHP developers as the people with Instargam are the photographers. But do not take it as something that WP is useless - it is ideal for blogs, simple web sites and one-day projects for which you do not want to spend a lot of time. It is ideal for quick money or for people who are not so technical, but using WP will never make you a professional in PHP - because WP is, in fact, a long “spaghetti code” that is unlikely to teach you the right design principles.

Start small. Think about the concept of the real world and try to reproduce it using the PLO. Learn various basic tutorials and gradually become more experienced and advanced. Work with OOP until you understand classes in general, before moving on to working with frameworks and looking at concepts like “Model”, “View” and “Controler” in perplexity - it's all too vague without understanding the PLO.

Analyze existing projects


Disassemble the already existing source code from wherever it can be found. For example, find projects on Github, install them on your computer and experiment with the code. From file to file, from line to line, and until you understand what each line in each file does.

Look for projects that are well uncommented and / or documented, with good structure and still relevant. Projects that were last updated in 2008 are unlikely to help you deal with PHP version 5.5 - you can lose sight of the latest and greatest features that will help you stand out among others in this area.

Learn how to customize your development environment.


Being able to establish your own development environment is an invaluable skill. This not only allows you to fine tune your environment, but also introduces you to the process of developing extensions from source code.

Forget Windows for development. If you have a Windows operating system, install a virtual machine with Linux OS on it. The reason for this decision is the end of the lines, as well as other strange contradictions on most Windows servers, so it’s best to develop on the OS that most closely resembles the one on which you will run your project.

Virtual machines also help you experiment - if something goes wrong, you can restart it from scratch or just roll back the system. In a literal sense, you can experiment as much as you want without fear of spoiling anything. Development tools are important, as is the workplace.

Different experiments with your preferences can introduce you to different servers - whether you use Apache or Nginx, or neither one nor the other, and prefer AppServer.

Be accustomed to good tone


When you write your code, make sure that you have commented out well with the help of documentation blocks, and your code is well structured and looks good. After you have created a class, project, or library, use the well-known documentation tools (PHPDocumentor, ApiGen) to highlight blocks of documentation and improve them.

A good development environment is worth its space in gold - using one cross-platform editor will help you quickly deal with the new development environment, and you can immediately immerse yourself in the code without wasting time setting up hot keys and themes. Make sure that you have a backup of the configuration files of your development environment on the cloud storage, for example, Google Drive, Dropbox, so that you can use it at any time. One of the good development environments is PHPStorm, or if you can't afford it or you don't have open source projects for which you can ask for a free license, Netbeans is a free alternative. Both environments are cross-platform.

The sooner you get used to a good tone, the sooner other developers will be able to read your code “without straining”. Find your style and stick to it - it will help you and others. Try to adhere to the standards PSR (PSR-0, PSR-1, PSR-2, PSR-3) as far as you can - for that they are standards. Most of us use them and love them, and they, in turn, make the code readable and allow us to use it for our needs.

Also, a resource such as PHP The Right Way - fresh tips for beginners and not only - is well suited for a novice - use them to better understand the basics of OOP, security, launch projects, write code in accordance with the standards that were mentioned earlier and much more.

Try different frameworks, choose one


For a long time, PHP was the language with the largest number of frameworks for it (JavaScript bypassed PHP only recently). Either way, it speaks of the inconsistency of our community or of the popularity of the language, but the fact remains: the choice of framework is a difficult task, especially for beginners.

Having tried many of them, I can sincerely advise you Phalcon for exploring the frameworks, because it is reliable and of high quality, in fact, written in C and installed as a PHP extension (therefore, it is faster than all the existing frameworks at the moment). Nevertheless, try different frameworks - it really is necessary.

After you work with them, you will learn about new approaches to common problems every time. Each framework has its own quirks that you like, as well as its own drawbacks, which you will hate. But the most important thing is that you will understand how other developers (in particular, the developers of this framework) think. You will see how many new features and approaches have appeared, and a very good exercise will be to transfer one of your projects to as many frameworks as you can find. This will help you to objectively evaluate the effectiveness of a single framework: the speed of development on it and its performance.

Read the literature


Do not neglect the tips and tricks of others. Read as much as you can - if you do it, it will not take you as much time as you think. Find good blogs, read tutorials on sitepoint.com, discuss questions and answers at StackOverflow, go to sitepoint.com forums, subscribe to newspapers, follow good sources on Google+. You shouldn’t read standard PHP tutorials — they were outdated when they came out — instead, focus on personal notes and lessons, where there is useful and modern code that you can find everywhere on the web. Even if you stumble upon a topic with which you are already familiar, try to read it again - often you will be able to find new food for thought and different approaches to the same things.

No work? Come up with!


There is always something to do. Never say the phrase “I have no project for work” or, even worse, “I'm bored, I'm tired.” If you do not have a project for work - create it. Do you have to use something every day and it upsets you with insufficient functionality? Create an alternative, but better! No ideas for a new project? Create an existing one - try to rewrite, for example, Facebook, recreate what you have already seen.

The most important thing is never to stop. You can not save 10,000 hours, if you do not spend them on the job! Keep working, be interested in new things, constantly engage yourself in something. Create a simple address book. Then do it on another framework. Then try another database (go from MariaDB to Mongo, for example). Take care of yourself than that!

Find a friend / mentor


The easiest thing to learn is when you have someone to do it with. Find a person who shares your passion. Perhaps you are lucky and you are one of those who share the interests of your partner. You may be studying at a school or university and you have peers who want to start this amazing adventure, but they need company. You can also find a mentor and get tips from an expert.

Conclusion


When you focus on these aspects as much as you can, when you realize that you want to move on - you are on your way to becoming a professional PHP developer. Remember about discipline, never give up (even if others surrender) and practice.

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


All Articles