Refactoring: The Long Game

I recently gave the talk “Refactoring: The Long Game” at MavenLink, a local software firm. MavenLink works by doing strict test-driven development and pair programming all the time. MavenLink has an office in Salt Lake City and an office in San Francisco. It’s a really interesting place to work. MavenLink provided me with a recording of their meeting which I have uploaded to YouTube.

For about the first 40 minutes, I discuss larger term architectural concerns and goals while refactoring. After that discussion, I show a live example of refactoring some crufty code with IntelliJ which shows just how quickly you can transform code with the right automated tools at your fingertips.

Give Your Old Code Some New Love

If you’re not careful, entropy creeps its way into your code base. You take a shortcut or code something in a way that you know is sloppy and you say to yourself “I’ll come back to that later”, but later you’re faced with new feature requests or some other Imminent Disaster(tm) and you don’t go back and clean up the mess you made earlier. This is only natural in a code base and when the messes are few and far between, it is tolerable.

However, at some point the messes accumulate and you need to do something about it because the mess is preventing you from making forward progress in a reasonable manner. Entire books have been written about this situation such as “Working Effectively With Legacy Code” by Michael Feathers (see my review), “Refactoring: Improving the Design of Existing Code” by Martin Fowler and “Refactoring to Patterns” by Joshua Kerievsky. One could even consider “Domain-Driven Design: Tackling Complexity in the Heart of Software” by Eric Evans to be a book full of advice about how to avoid the accumulation of entropy in your code base. Still, sometimes you find yourself with too much entropy in your code base and it’s time to do something about it.

In this post, we’ll take a look at an open source project with a code base that is over 30 years old and has accumulated some “cruft” along the way. We’ll discuss various strategies for coping with the cruft and how to get rid of it in as safe a manner as possible. After all, we don’t want to introduce bugs while we clean up cruft.

Read the rest of this entry »

Telemarketing spam is now a Turing test

Telemarketing spam has now become a Turing test and I predict it will only get moreso in the future.

(Phone rings.)
Me: Yes?
Robot: Hello, my name is Betty, I’d like to talk to you about blah blah blah.
Me: Are you a human being?
Robot: (Pause for voice recognition.) Yes! I’m just talking to you through a computer!
Me: What town were you born in?
Robot: (Pause for voice recognition.) I’m sorry, can you repeat that?
Me: You’re a robot. (Hang up.)

C++ Rename Shootout: Visual Studio 2017 vs. ReSharper for C++

In programming we have to come up with names for lots of things on a day-to-day basis. Naming things is hard. Lots of times we come up with names that we’re not particularly happy with, but it may be the best name we could think of at the time. Later we get a better idea for the name but now we have to update all the locations in the code that used the old name and change them to use the new name. Sometimes, responsibilities change and the names we originally chose no longer match the new responsibilities.

Getting help from your development environment for renaming identifiers can be a huge productivity boost. It lets you quickly and easily improve the names of things in your code. In this post, I’ll review two automatic renaming tools for C++ in Visual Studio: Visual Studio 2017 Community Edition 15.5.7 and ReSharper for C++ 2017.3.2.

Read the rest of this entry »

Two-Character Unix Commands

Here’s a fun survey question: name as many two-character Unix commands as you can and say what they do.

Let’s be precise about what we mean by a “command”:

  • Shell aliases like la are not commands.
  • Shell built-in commands count as commands; over time the shell incorporated directly things that were previously separate executables in Unix.
  • Commands not available in a wide variety of Unix distributions by default don’t count. In other words, if you have to install some optional package to get the command then it isn’t a “Unix” command.
  • Optional: Only allow commands included in a “classic” Unix from Bell Labs.

Ready? Let’s go.

Read the rest of this entry »

Embedded C++ Development for the Game Boy Advance at OpenWest 2017

OpenWest 2017 has accepted my proposed talk on Embedded C++ Development for the Game Boy Advance. I will be presenting this talk on Wednesday, July 12th from 4:00 pm to 4:50 pm. If you are interested in C++ for embedded development, I think you will enjoy this presentation. We’ll be showing how the “Zero Overhead Abstraction” of C++ lends itself to creating clearer code for embedded platforms without losing anything in efficiency. I’ll see you there!

Daz Studio 4.9.3 Released


Daz Studio 4.9.3 has been released, with an updated implementation of NVIDIA’s IRay. Daz Studio is the first to market with this new version of IRay bringing support for Pascal generation GPUs from NVIDIA. We’ve also added automatic login to make it more convenient to purchase and install content directly from the Daz store. We continue to improve the Smart Content experience for browsing large libraries of purchased and installed content and making it easier to compose scenes by finding the appropriate content at the appropriate time.

As usual there are the sprinkled bug fixes and usability improvements; you can read the full list in the release notes. Download now and enjoy! It’s free!

The Mystery of Ctrl+[

Tommy Bennett gave a great lightning talk at CppCon 2016 entitled “Algorithm Mnemonics: Increase Your Productivity With STL Algorithms”. This was really two lightning talks jammed into one. In the second half, Tommy talks about how to increase your productivity with the vim editor simply by learning to use Ctrl+[ instead of ESC because of the distance traveled by your fingers on the keyboard. In the talk, Tommy wonders why Ctrl+[ works for ESC. This short post will explain the mystery of Ctrl+[ along with other interesting characters you can type on your keyboard.

Read the rest of this entry »

Utah C++ Programmers July, 2016: SIMD Parallelism with CPU Intrinsics (MMX, SSE, AVX, etc.)

At this month’s Utah C++ Programmers meetup, I’ll be presenting the basics of invoking SIMD CPU instruction set extensions using compiler intrinsics functions.

SIMD Parallelism with CPU Intrinsics (MMX, SSE, AVX, etc.)
Wednesday, July 13, 2016
6:00 PM – 8:00 PM

Food will be provided, courtesy of our sponsor Apremis Technology Placement. Thanks, Apremis! Please RSVP through the above link so we have a proper head count for food.

Refactoring to Learn a New Code Base

When you join a team with a large existing code base, it can be intimidating. How long does it take to become familiar with a million lines of code? I don’t have the answer to that question, but based on my past experience it easily takes several years if not more. Meanwhile, the rest of the team is adding and changing code all the time. When I apply small, focused, systemic refactorings to a code base, I visit lots of code that may be unfamiliar to me. Visiting unfamiliar code and making the same kind of systematic change throughout can help me become more familiar with the code.

Read the rest of this entry »

Utah C++ Programmers: Concurrency and Parallelism with <thread>

This month, Greg Hodgson will give us a presentation on concurrency and parallelism with <thread>. Thanks for presenting, Greg!

Slides for Utah Code Camp Presentations

I have posted the slide decks for my Spring 2016, Utah Code Camp are available on

Thanks to everyone who attended Code Camp and a very special thanks to all the sponsors that make the event happen!

Proposed Utah Code Camp Spring 2016 Talks

It’s that time of year again and I’ve proposed the following talks for the 2016 Utah Code Camp. Please vote for those you’d like to see as I doubt I will be able to give all of them :-).

Vote here: Utah Code Camp Spring 2016 Sessions

Update: Two of my talks were accepted, thank you for your votes! That’s quite a bit of work for me in such a short time, but I will give it the old college try and do my best not to disappoint anyone. See you at Code Camp!

Proposed talks:

  • Software Practices and Principles
    • Why TDD is a Design Activity

      Do you think design is that thing you do at the beginning before you start implementation? Oh pshaw, waterfall thinker! Design is an activity. Designs evolve. Software is the most mutable substance known to mankind. TDD embraces that evolution and malleability and changes design from a phase into an activity we practice every day.

    • Accepted: Modern C++

      Has it been a while since you looked at C++? Do you have a “backwards looking” perspective on C++ based on poorly written old code? Come take a look at modern C++ and dispel your misconceptions about C++. Embrace lightweight abstraction mechanisms with efficient implementations that make your phone’s battery last longer! C++14 is stable and is implemented across all major platforms. C++17 standardization is underway. Compilers are implementing C++17 support in anticipation of the standard, instead of waiting until it is released. The library working group in the standards committee has additions to the C++ Standard Library coming your way.

  • Microsoft Technologies
    • Accepted: Developing iOS and Android Apps with Visual Studio

      In this presentation, we’ll take a look at the additions to Visual Studio 2015 that support the development of iOS and Android applications. We will emphasize cross-platform development of a single code base.

    • NodeJS for Visual Studio

      In this presentation, I’ll give a quick tour of the NodeJS integration for Visual Studio.

Slides for Consuming and Creating Libraries in C++

I have uploaded my slides for my presentation on Creating and Consuming Libraries in C++. Not every word of what I discussed is in the slides, but there should be enough there for you to follow the discussion.

Utah C++ Programmers: Consuming and Creating Libraries

In this month’s Utah C++ Programmers meetup, I’ll present the basics on consuming and creating libraries for C++ programs. ConsultNet is now a sponsor of Utah C++ Programmers and will be providing us with food for the meeting. Thanks, ConsultNet!

Read the rest of this entry »

Visual Studio 2015 Update 2 RC Released

Microsoft has released a release candidate of Update 2 for Visual Studio 2015. Of interest to C++ developers are the completion of C++11, C++14 and current C++17 library features as well as numerous performance and bug fix improvements to the IDE and the compiler. There are some breaking changes for existing code bases that were not written in conformance with the ISO C++ standard, but instead relied on the old non-conforming behavior of the Microsoft compiler.

SLC Software Craftsmanship: Rewrite or Refactor?

Tomorrow the Salt Lake City Software Craftsmanship group will be holding their 2nd meetup. The reading discussion topic for this month is Rewrite or Refactor?. Dinner will be served and there will be a programming exercise after the reading discussion. See you there!

Refactoring Test Suite Results for Visual Studio 2015

Last Friday I updated the test results for my C++ refactoring test suite to include results from Visual Studio 2015 Update 1. Visual Studio 2015 is the first release of Visual Studio to support refactoring for native C++ projects without any additional add-ons. Prior to Update 1, Visual Studio requried a free add-on for Extract Function and Extract Method, but this has since been folded into Update 1 and made available to all Visual Studio users. Extract Function and Change Signature are disabled by default and can be enabled in Tools / Options / Text Editor / C/C++ / Refactoring.

Read the rest of this entry »

Daz Studio 4.9 with In-App Purchase of Content


Daz Studio 4.9 has been released today. Daz Studio 4.9 features an integrated content store so you can directly manage your free and purchased Daz content. Downloading and installing content has never been easier! Daz Studio 4.9 offers improved workflows for using content with the Smart Content Pane. Daz Studio is free and includes the fully-posable base human figure content. NVidia’s IRay physically-based renderer is still included and has been updated for this release. IRay is a great way to explore physically-based rendering, all the way down to authoring NVidia material definition language files and directly consuming them with Shader Mixer in Daz Studio. For graphics programmers and graphics researchers this is a wonderful way to explore the power of MDL with a great rendering engine and great content.

Download today!

CppCast #17: and Refactoring

CppCast interviewed me for episode 17 of their C++ podcast last night. We had a great time talking about and refactoring in C++. Check it out!