Good Kaizen – PHP
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.
Earlier today I was working on coding up a design that displays a varying number of cards, each with a unique title and description think masonry/pinterest-esque. I’ve been using Faker to stub out a bunch of cards, each with different content. Once I’d hooked up the dummy data to the cards, I realized that the design didn’t work as well with titles that had more than 20 or so characters.
Unless you have an insane memory, you may not remember your reasoning for every line of code. If you're like me, you may occasionally come across something and ask yourself "what on earth?!". I've come up with my list of six ways to better prepare your future-self.
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.