Posts

  • Refactoring 2nd Edition: Chapter 8: Moving Features

    Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

    Overview

    This chapter explains several refactoring methods for moving code around and making it easier to clean them up.

    My One Takeaway

    Two this time:

    1. I love how much easier to read the “Replace Loop with Pipeline” refactoring makes the example. I think I’ll definitely be spending some time looking into how to do this with PHP.
    2. “Remove Dead Code” is my favorite refactor ever. In an earlier job, we had a functions.php that was included in every file and it had an if statement that could never resolve to true. Everyone was afraid of removing it for fear that it would break something. I wasn’t. :-)
  • Refactoring 2nd Edition: Chapter 7: Encapsulation

    Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

    I fell off of this process really bad due to some family reasons but I’m going to start back on this process.

    Overview

    This chapter explains several refactoring methods that involve moving items into classes, out of classes, and into new classes.

    My One Takeaway

    I think these are all valuable refactorings to learn but I’m still not sure on how I’ll know to use them when I’m working. I guess I’ll just need to keep reviewing these. :-)

  • Mass Deleting Remote Git Branches

    Git Logo Git Logo from https://git-scm.com/downloads/logos

    The other day at work I realized how many open branches we had in our Git repo that had been merged into the master branch but weren’t deleted from our BitBucket repo. I started looking for ways to quickly cleanup the branches without automating the process so I didn’t accidentally delete something that was still needed.

    My initial search found that you can delete a remote branch using the following command:

    git push origin --delete name-of-branch
    

    My issue was that I needed to delete hundreds of of branches. Luckily you can specify multiple branches for this command like so:

    git push origin --delete name-of-branch1 name-of-branch2 name-of-branch3 name-of-branch4
    

    I was able to use git branch --merged to get a quick list of all the branches that had been merged into master and then I ran the command above on them once I verified they were all “old”.

  • Link Post and Podcast Roundup: August 2019 Edition

    Link Post Logo

    August’s links.

    Read More
  • Link Post and Podcast Roundup: July 2019 Edition

    Link Post Logo

    July’s links.

    Read More
  • Link Post and Podcast Roundup: April 2019 Edition

    Link Post Logo

    April’s links.

    Read More
  • Finding Domains Name From Email Addresses in MySQL

    Header

    The other day I wanted to know how many unique domain names existed in the emails addresses of one of our databases. I started looking for an easily way to find them and how common each domain was. The query below will give you those details.

    Read More
  • Link Post and Podcast Roundup: March 2019 Edition

    Link Post Logo

    March’s link.

    Somehow I scheduled all my social media posts for March and not February so the Twitter feed is going to be FULL this month. :-)

    Read More
  • Using array_search to Delete a Value From an Array

    Header PHP has a distressingly large number of functions that allow you to manipulate an array. In this post, we’ll show you how to use array_search() to delete a specific value from an array.

    Read More
  • Refactoring 2nd Edition: Chapter 6: A First Set of Refactorings

    Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

    Overview

    This chapter introduces the first set of refactorings we’re going over in this book. Each section explains why you would want to do the refactoring and then walks through an example.

    My One Takeaway

    I’m going to deviate from my normal structure in order to post two takeaways:

    1. Extract Function and Extract Variable are now part of my normal day to day work. I’m amazed at how much cleaner this makes my code.
    2. It’s interesting how some refactorings are just combinations of other refactorings.

subscribe via RSS