With Yireo, we build a lot of extensions on top of Magento and Joomla, and naturally all are written with PHP. But the PHP code we write now is not the same as the code of last year: Our coding improves and the code itself evolves. You can make that happen for yourself as well. Here are some ins and outs.
From Hello World to design patterns
One of the first things people learn when writing PHP code, is a simple Hello World program. After that, things like functions and classes are being picked up. And once the concept of OOP (Object Oriented Programming) really syncs in, the next level is to think about the relationships between classes.
A concept like MVC (Model-View-Controller) is nicely incorporated in applications like Joomla, WordPress and Magento, but does that mean that one Model should be used for every Controller? What about using multiple Views for one Controller? And what on earth are HMVC and MVVM? The more you think about your code the more spiritual it becomes.
Coding concepts
Design patterns are an abstract way of describing relationships between objects. By using design patterns, developers can talk about code constructs like factories and Chain-of-Commands without the need to explain the whole relationship over-and-over again. Design patterns are a way of living.
There are more concepts like these that help developers to get to a higher level: KISS, SOLID, DRY. When you dive into the world of these concepts, the universe simply keeps expanding.
Turning concepts into practicalities again
Many of these concepts are used to help you understand your code better. It does not say anything about how you code your own stuff. To make things practical again, editors like PhpStorm offer you a lot of tools to get things like renaming variables and methods easy. Refactoring is key. When you realize that your code is not just a static listing of mysterious lines, but it is a living entity, you will realize that you have to take care of it - you have to pet it.
May 11th 2016 - PHP Advanced Training
On Friday 11th of May 2016 we organize a PHP Advanced Training. The word advanced does not mean that the training is meant for higher PHP gods. Instead, the training is focused on starting developers, that want to get more out of their code. Are you struggling with interfaces? Have you concurred MVC but do you want to get to the next level? This training is for you!
About the author
Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.