December 1, 2017
Expert advice: tips for becoming a good PHP developer
PHP is a language particularly suitable for someone at the start of a career. Due to the low entry threshold and specifics of the language, many developers begin their professional path there, but then get lost and do not learn to code properly.
Like all languages, PHP encompasses both strong and weak points. While there are many discussions of PHP’s weak sides, such as memory leaks, scalability and speed, the bigger issue I can identify from my experience is an implicit one.
General programming recommendations
My advice for newbie developers is that learning to code properly is more important than learning the syntax. You should concentrate on general programming practice as much, if not more, than learning PHP itself. Here are some of these important practical elements that you will not understand in the beginning, but should nonetheless learn to master:
- Data structures – Similar to design patterns, data structures help you solve certain problems. Much too often, developers do not know the available data structures, nor when to use them. This causes poor performance, and ugly code.
- Algorithms – You will want to minimize your algorithm complexity to improve performance. In many cases developers use algorithms provided by 3rd party libraries without understanding how they work. While studying at university, I spent time doing what is called algorithmic programming and taking part in ACM ICPC competitions, which helped me to achieve better understanding. (By the way, it isn’t necessary to win. Learning how to solve just a subset of those challenges will help you a lot.)
- SQL – In large projects, there is usually a specific person handling database queries, especially complicated ones. Until you are fortunate enough to benefit from that type of staffing, you will need to do this yourself. As you become more experienced, you should understand how the ORM transforms requests into queries. Sometimes it is better to write your own.
- Patterns – Concentrate on when to use patterns and when not to use. You want to reach the level where you can automatically recognize when certain patterns should be used. (Re-read each time you think you’ve reached a new level).
- Web Functionality – You should direct attention to “How the web works” that is on a comfortable level for you. You should start with basics and get deeper into each subject with time.
- How requests travel from your browser to the server and data is returned.
- Other Principles – Here are some principles that are recommended to follow:
- OOP principles.
- English – Whether for reading manuals, understanding requirements, or for talking with the clients, you will need it.
PHP specific advice
When developing, it is extremely rare that one will code using pure PHP. Generally, you would be using one of the following approaches:
- Frameworks (such as Symfony, Laravel, ZF, Yii)
- CMS (such as WordPress, Drupal, Typo3)
- Platforms (such as Magento)
By understanding how to develop in PHP, one should be able to develop in either of the above-mentioned options. Nevertheless, there is a certain learning curve for each of these approaches, meaning efficiency in one technology stack does not automatically mean efficiency in another. Take your time. Do not rush to learn them all at once. Choose one that fits the way you think. Usually developers would specialize in only 1 or 2 of them.
In terms of literature, there is a lot of reading out there for general programming, algorithms, patterns, etc., and much has been recommended in a previous series of DOU articles for other technologies. I can recommend the following PHP specific sites for starters.
Incidentally, I just needed the documentation from the official php.net to pass the PHP Certification.