"Is it better?" is a question I ask myself on a daily basis. It's not such an easy question to answer, when it comes to code. No, it turns out that our brains have a unique way of tricking us at every turn. Still, despite the difficulty, it's vital that you force this question into your internal dialogue. "Is the code now better?" Sure, I extracted files. Sure, it better follows the single responsibility principle. Sure, it's more open to extension. But is it better?
Over the last few weeks, at the time of this writing, I've been working on a component refactor for the Laravel Mix codebase. Now that I've mostly completed this refactor, let's review the before and after, while once again asking ourselves the important question, "Is this better?"
In real life, you won't always have time to go over each line of code with a fine tooth comb. No, the truth is that, too often, the business needs it done now. Not in three weeks. Now. You can complain on Reddit when you're done. Sorry, it's a simple reality of the workplace. In this episode, let's review a "gift certificate" section of Laracasts that, late last year, I needed to build and deploy all in the same day. We'll review the compromises I made, what I might have done differently with more time, and how I view the code, today, with fresh eyes.
*Series still in development. Check back often for updates.