33 Things I Wish Somebody Would Have Told Me
I’ve migrated the website 33thingsbook.com to this blog post.
A programmer’s guide to quality code, great work relationships and respect.
I’ve migrated the website 33thingsbook.com to this blog post.
A programmer’s guide to quality code, great work relationships and respect.
It’s hard to come up with a title for this - but - basically I found some rogue code the other day that I thought was pretty interesting. I was fixing a “hacked” website when I came across the source of the symptoms of the hack. One file had the following code in it:
There’s a reason why we want to build high-quality code - actually there are man. But in the end, it boils down to this one point. Good Quality Code Reduces Costs.
In Laravel, the Support\Str class has a lot of useful methods for switching formats of strings between each other. I needed to take a hyphenated slug and change it to title case words. In Laravel land, I think this is referred to as “Studly” - because I found something very similar called Str::studly(). This converts underline or hyphenated words into a single string with capital letters. I wanted to not concatenate all of these.
I think around 2015, there was a big splash of good training online for PHP. Frameworks upgraded/changed, helped programmers write better code faster earlier than that. Before that, it was a lot of RTFM. So, before, in the earlier days (maybe somewhat still today), I think PHP developers did this:
Often times, I find myself targeting a single file with PHPUnit by specifying the file after the binary in the command line:
The other day, an acquaintance of mine was complaining about never getting ahead in their career. I didn’t really feel like I knew enough about their area of expertise to give any advice - until I heard what they did when they got home. During our conversation, they described their favorite TV shows, how involved they were with the outcomes; basically once they got home, 4 to 5 hours were spent on the couch watching TV.
Answer this question real quick: What was the most impressive thing you did 2 years ago at work? Did you get the proper accolades for it? Or, possibly more important, did you get a performance-based wage increase or some other reward?
It’s important to unit test your application code - even your console commands. So many times, I’ve seen people using the Artisan facade inside of console commands to either queue up new commands or call a different command. This makes it more difficult to unit test the application - you have to rely more on fakery (requiring you to reset your application each time then) and/or integration tests.
I’ve been in the position to hire a lot of programmers over the last few years. This is a great responsibility; one that doesn’t come without a bunch of unique situations, especially when it deals with colleagues and friends.