Skip to content

Instantly share code, notes, and snippets.

@jeremy-w
jeremy-w / Working Effectively with Legacy Code.md
Last active April 16, 2024 19:58
Notes on Michael Feathers' *Working Effectively with Legacy Code*.

Working Effectively with Legacy Code

Notes by Jeremy W. Sherman, October 2013, based on:

Feathers, Michael. Working Effectively with Legacy Code. Sixth printing, July 2007.

Foreword:

  • Software systems degrade into a mess.
  • Requirements ALWAYS change.
  • Your goal as a software developer: Create designs that tolerate change.
@jeremy-w
jeremy-w / Robert Annett - Modern Legacy Systems.md
Created October 14, 2013 03:42
Notes taken while listening to Robert Annett's talk on Modern Legacy Systems at QCon London 2012.
@jeremy-w
jeremy-w / Working Effectively with Legacy Code, Block 2.md
Created October 15, 2013 04:55
Notes on chapters 11, 15, 17, and 20 of Michael Feathers' *Working Effectively with Legacy Code.* Read as part of the BNR Book Club, October 2013.

Working Effectively with Legacy Code

Michael C. Feathers

Notes by Jeremy W. Sherman, 14 Oct 2013.

Chapter 11: I need to make a change. What methods should I test?

Use effect sketches to figure out where to target your characterization tests prior to making changes. Big fan-in means a big bang for your test-writing buck.

  • Prior to changing, write characterization tests to pin down existing behavior.
  • Characterization test: A test that characterizes the actual behavior of a piece of code (186).
@jeremy-w
jeremy-w / jira-prepare-commit-msg
Last active August 23, 2023 17:44
A git hook to tag your commits with the JIRA issue ID. Requires a git client that runs the hook like Git Fork, Git Kraken, or anything TUI/CLI.
#!/bin/bash
#
# jira-prepare-commit-msg: Easy commit tagging for Jira
#
# https://gist.github.com/jeremy-w/818b2980f0d9768da83249458aa67678
#
# If you name your branch to include the Jira issue key,
# this hook will automatically add the issue key to your commit messages.
# This makes it easy to trace work back to Jira, and it also means
# your commits show up in the Activity tab for that issue.
@jeremy-w
jeremy-w / nsarray.mm
Created September 24, 2012 19:08
Converting a std::vector into an NSArray
//clang++ -std=c++11 -stdlib=libc++ -framework Foundation nsarray.mm -o nsarray
/* Note:
* - libstdc++ has been frozen by Apple at a pre-C++11 version, so you must opt
for the newer, BSD-licensed libc++
* - Apple clang 4.0 (based on LLVM 3.1svn) does not default to C++11 yet, so
you must explicitly specify this language standard. */
/* @file nsarray.mm
* @author Jeremy W. Sherman
*
* Demonstrates three different approaches to converting a std::vector
//cc -Wextra -o build/dump-header-map dump-header-map.c
// see: https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMapTypes.h
// https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMap.h// https://github.com/llvm-mirror/clang/blob/release_40/lib/Lex/HeaderMap.cpp
// This is basically dump() from there.
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <err.h>
{
"swagger": "2.0",
"info": {
"title": "Test swagger",
"version": "0.1.0"
},
"definitions": {
"File": {
"title": "File",
"type": "object",
@jeremy-w
jeremy-w / named-match-repro.kts
Created November 16, 2018 16:13
How do you access a named group in Kotlin?
#!/usr/bin/env kotlinc -script --
/**
@file named-match-repro.kts
@author Jeremy W. Sherman (GitHub: @jeremy-w)
Demo of some perplexing behavior.
Questions:
- Main question: How do I access a named capture group in a Kotlin script?
class Parent: Error {
var localizedDescription: String { "p" }
}
class Child: Parent {
override var localizedDescription: String { "c" }
}
print("Given two error classes, Parent, and Child a kind of Parent\n")
let e: Result<Int, Child> = .failure(Child())
let e2: Result<Int, Parent>
@jeremy-w
jeremy-w / tt-ifmud
Created January 28, 2012 05:29
tintin++ script for ifMUD
#! /usr/local/bin/tt++
/* Who wants to write out "inventory" in full? */
#alias {i} {inventory}
#alias {inv} {inventory}
/* Simpler AFK handling.
* ifMUD has a 2-step AFK process.
* This turns it into a one-step "afk MSG" process. */
#alias {afk} {@away me=%0}