Skip to content

Instantly share code, notes, and snippets.

@trikitrok
trikitrok / Working Effectively with Legacy Code.md
Created April 16, 2024 19:58 — forked from jeremy-w/Working Effectively with Legacy Code.md
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.
@trikitrok
trikitrok / Robert Annett - Modern Legacy Systems.md
Created April 16, 2024 19:58 — forked from jeremy-w/Robert Annett - Modern Legacy Systems.md
Notes taken while listening to Robert Annett's talk on Modern Legacy Systems at QCon London 2012.
@trikitrok
trikitrok / Working Effectively with Legacy Code, Block 2.md
Created April 16, 2024 19:55 — forked from jeremy-w/Working Effectively with Legacy Code, Block 2.md
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).
@trikitrok
trikitrok / working_effectively_with_legacy_code.md
Created November 28, 2022 17:07 — forked from jonnyjava/working_effectively_with_legacy_code.md
Working effectively with legacy code summary

WORKING EFFECTIVELY WITH LEGACY CODE

To me, legacy code is simply code without tests. I’ve gotten some grief for this definition. What do tests have to do with whether code is bad? To me, the answer is straightforward, and it is a point that I elaborate throughout the book: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.

Chapter 1 Changing Software

Four Reasons to Change Software: For simplicity’s sake, let’s look at four primary reasons to change software.

<?php
namespace Trovit\B2B\Redirect\Tests\integration\Controller;
class QueryStringBuilder
{
const CONNECTOR = '&';
const START = '/?';
private $brand;
<?php
namespace Trovit\B2B\Redirect\Tests\integration\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
private $client;
(ns sunshine.disk-read
(:require [clojure.core.async :as async :refer [>! <! go-loop chan close! <!!]]])
(:import (java.io BufferedReader FileReader FileInputStream BufferedInputStream InputStreamReader)))
(def ten-gb-filename "ten.json")
(def one-meg (* 1024 1024))
(defn ^FileInputStream input-stream [^String fname]
(FileInputStream. fname))
@trikitrok
trikitrok / double-video-speed
Created May 30, 2016 14:41 — forked from searls/double-video-speed
double video speed with this
#!/usr/bin/env bash
# Just 'brew install ffmpeg' first
set -e
INPUT=$1
OUTPUT=$2
ffmpeg -i "$INPUT" -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2[a]" -map "[v]" -map "[a]" "$OUTPUT"
@trikitrok
trikitrok / 0_reuse_code.js
Created June 17, 2014 18:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console