Good Kaizen – Refactoring
A blog about doing good and getting better at life, code, design, and business. We do our best to write in a way that clients will find valuable.
Kaizen is the practice of continuous improvement.
As a Junior Engineer at Zaengle, I’ve learned that writing good clean code is one of the most important aspects of being a developer. There are many places in code where logic can get out of hand quickly. One such place is in the controllers. We sometimes think that the controller is simply a place to dump any logic we don’t quite know what to do with.
The Extract Method is probably a technique you use on a daily basis; if not, it should be. It really isn’t any more complicated than the title would suggest. It’s looking through a method and determining what lines of code could easily be grouped together into another function.
If you've ever done any research into refactoring, or programming in general, you've most likely heard the term "polymorphism". When I first came across it, I have to admit, I was intimidated. Now that I've become more familiar with the concept, I can assure you, the word itself is more complicated than the underlying principle!
As I’ve been reading through Refactoring by Martin Fowler, I’ve found it helpful to rewrite some of the examples from the book in PHP in order to cement the concepts into my mind. While Martin’s examples are primarily in Java, I’ve found an overwhelming majority of the concepts apply to PHP, which is where I spend most of my programming time.