Method Swizzling in Objective-C

I was recently introduced to method swizzling in Objective-C, and I thought I’d dig into it a bit and write about what I learned.

Objective-C handles method dispatch at runtime. This allows the implementation for a selector (i.e., method) to be changed as a program executes. Method swizzling is the act of swapping the implementations of two selectors as a program runs. Read more on Method Swizzling in Objective-C…

Stow Your Dotfiles – GNU Stow for Managing Symlinks

If you’ve done much work with command line tools, you’ve undoubtedly wrestled with dotfiles, those pesky configuration files in your home directory that are hidden from view by having a dot at the beginning of their name. Bash uses a .bashrc configuration file. Vim uses a .vimrc file and a .vim directory for additional scripts. Tmux uses a .tmux.conf file. Git uses a global .gitconfig. Untold other tools follow the pattern.

Read more on Stow Your Dotfiles – GNU Stow for Managing Symlinks…

Understanding Macros and Code as Data

The other day, while having a conversation in the office about Clojure macros, I was reminded that not everyone fully understands the phrase “code as data” or its useful repercussions. This isn’t surprising, as there are still very few mainstream languages that feature this, and most of the ones that do are lisp dialects. I think that’s unfortunate, as it’s a conceptually simple tool that you can get a lot of leverage out of. Read more on Understanding Macros and Code as Data…

Empowering Our Customers to Deploy Their Own Apps

This was me at a recent sprint review meeting with the Local Orbit team:

What really got me excited during this sprint was our success in implementing continuous delivery. For each feature we delivered, Anna was able to test and approve it before promoting the code, pushing to staging, and deploying to production. We went through this cycle several times this week, and Anna is now completely in control of what features roll into production, and when. Read more on Empowering Our Customers to Deploy Their Own Apps…

Read more on Empowering Our Customers to Deploy Their Own Apps…

Five Steps to Finding Performance Bottlenecks

I recently had the opportunity to do some performance optimization work, and I enjoyed it maybe a little more than a reasonable person should. It reminded me of one of my favorite projects from years ago — tuning a Java 2D graphics library that had to beat a competitor’s implementation on industry benchmarks. Read more on Five Steps to Finding Performance Bottlenecks…

Optimizing Tail Call Recursion

I have been familiar with the concept of tail recursion for some time, though I had never explored it in depth. In this post I’ll look at an example of what happens when a tail recursive function is optimized on x86 targeting OS X.

Recursion Limitations

Recursion is common in software, especially in functional programming languages. Unlike iteration (e.g., while or for loops), recursion has the unfortunate side effect of growing the execution stack (a finite region of memory that a program uses during its execution). This can cause problems when many repeated recursive calls are made, as the stack may run out of space. It’s also slower than iteration due to the extra stack frame creation and tear down. Read more on Optimizing Tail Call Recursion…

Breaking Things Is the Best Way to Fix Them

Whenever I’m debugging an issue, I try to model it mentally, hypothesize what could be wrong, and then conduct controlled experiments to narrow down the issue. I trace execution carefully and inspect values.

That usually works well. When it doesn’t work or when I just don’t have many ideas, I often simply smash everything with a hammer (metaphorically speaking). Read more on Breaking Things Is the Best Way to Fix Them…