Posts

Refactoring 2nd Edition: Chapter 3: Bad Smells in Code

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

Overview

This chapter covers various “bad” practices that are a good indicator that you should refactor your code.

My One Takeaway

It’s a good thing the back cover has a list of these and what to do because it’s hard to know what to do with this list. It almost seems like there should be some kind of tool that looks for these. I’m not going to make it but it would be a good check.

A Weird Email

A Weird Email Header Image

The other day I received an interesting spam scam email:

Read More

Refactoring 2nd Edition: Chapter 2: Principals in Refactoring

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

Overview

This chapter: 1. What refactoring is 2. Why you should refactor 3. When you should refactor 4. Problems with refactoring

My One Takeaway

Under the section “What Do I Tell My Manager” there’s this quote:

Of course, many managers and customers don’t have the technical awareness to know how code base health impacts productivity. In this cases I give my most controversial advise: Don’t tell! Page 55.

I’ve worked for places where this is absolutely the case and think “Don’t Tell!” is good advice but you might have to hide the refactoring inside a deliverable.

Refactoring 2nd Edition: Chapter 1: Refactoring: A First Example

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

Overview

This chapter works through refactoring a piece of JavaScript code. It outlines both a process (working on a private branch and committing after each successful refactoring) and a series of refactoring methods.

My One Takeaway

This concept of working on a private branch and then making small commits that are later squashed down into a larger significant commits interests me. Firstly, it makes me wonder how hard it would be to swap so quickly between code and commit because I usually only commit once something large has been done. Secondly, it makes me wonder if this could just be as simple as git commit -a -m "Refactoring" or if more thought needs to be put into the commit messages. I wish this part had been shown as well (maybe the 3rd Edition can cover that :-)).

Random Thought

For those of you who are following along, when he references a refactoring method it always has the a number in parenthesis after the name. This is the page where the method is explained. Took me way longer to figure this out than I would have liked. :-)

Working With PHP's Output Buffering Functions

Header PHP provides a series of functions that allow you to capture any output that should be sent to the browser so you can do something else with it (or ignore it). In this article, we’ll go over a couple use cases for how you can use PHP’s output buffering.

Read More

Asynchronous Book Group: "Refactoring 2nd Edition" by Martin Fowler

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

Why an Asynchronous Book Group?

As a team bonding and educational process I try to get the programming teams I’m part of to read a book together every quarter. As I’m currently a team of one, this process has been more difficult. I thought I would take this process to the Internet so at the very least I would have to think critically about the book and write up my thoughts and the things I found most interesting.

Why This Book?

I’m a follower of Martin Fowler and his work and if you’re not already a follower of his blog (https://martinfowler.com/) you should be. I’ve been slowly working my way through his books but a couple months ago he posted that the 2nd Edition of Refactoring: Improving the Design of Existing Code (Amazon Link) had been finalized and would be available soon. I immediately ordered the book and was happy to see it arrive just before Christmas. I’ve been slowly working my way through the book (the holidays and small children make it a slow process sometimes :-)) and it’s been enjoyable and full of helpful information so far.

How is This Going to Work?

The book contains 12 chapter so for the next twelve weeks I’m going to post a new post on Friday. I will write down the one thing I found most interesting/helpful and then anyone who wants to can add a comment with something they’ve found interesting. The plan is to complete the following chapters on the following dates.

  1. January 11th - Chapter 1: Refactoring: A First Example
  2. January 18th - Chapter 2: Principals in Refactoring
  3. January 25th - Chapter 3: Bad Smells in Code
  4. February 1st - Chapter 4: Building Tests
  5. February 8th - Chapter 5: Introducing the Catalog
  6. February 15th - Chapter 6: A First Set of Refactorings
  7. February 22nd - Chapter 7: Encapsulation
  8. March 1st - Chapter 8: Moving Features
  9. March 8th - Chapter 9: Organizing Data
  10. March 15th - Chapter 10: Simplifying Conditional Logic
  11. March 22nd - Chapter 11: Refactoring APIs
  12. March 29th - Chapter 12: Dealing with Inheritance

I hope you’ll join me in this process.

Link Post and Podcast Roundup: January 2019 Edition

Link Post Logo

January’s links.

Read More

Looking Back at 2018 and Looking Forward to 2019

Looking Back at 2018 and Looking Forward to 2019 Header Image

Happy 2019 everyone! As I normally try to do this time of year it’s time take a little retrospective on what’s been done over the last year and what I want to accomplish in the coming year.

Read More

Working With PHP's Date and Time Classes

Header Ever since version 5.2, PHP has provided the amazing DateTime class that makes it a lot easier to work with dates and times. This article will provide an overview of the class and how it can be used and show some of the other classes that are related to the DateTime class.

Read More

Maximizing Your Efficiency in Sublime Text - Copy/Paste

Header

Sublime text provides two helpful features that will make pasting text a lot easier.

Read More
RSS

Join Our Mailing List!

View previous campaigns.

Top Posts

  1. Working With Soft Deletes in Laravel (By Example)
  2. Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
  3. Upgrading to Laravel 8.x
  4. Get The Count of the Number of Users in an AD Group
  5. Multiple Vagrant VMs in One Vagrantfile
  6. Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
  7. Changing the Directory Vagrant Stores the VMs In
  8. Accepting Android SDK Licenses From The OSX Command Line
  9. Fixing the 'Target class [config] does not exist' Error
  10. Using Rectangle to Manage MacOS Windows

subscribe via RSS

All content copyright This Programming Thing 2012 - 2021
Blogging about PHP, MySQL, Zend Framework, MySQL, Server Administration and Programming in general