Skip to content

Instantly share code, notes, and snippets.

View adenhaus's full-sized avatar

Aden Haussmann adenhaus

View GitHub Profile
public class WithAbstractions {
int upClass = 500000;
int midClass = 100000;
int lowClass = 50000;
int taxMax = 0.45;
int taxMid = 0.30;
int taxMin = 0.15;
public class WithoutAbstractions {
int upClass = 500000;
int midClass = 100000;
int lowClass = 50000;
int taxMax = 0.45;
int taxMid = 0.30;
int taxMin = 0.15;
public class DuplicationRemoved {
String buildingType;
int HOUSE_NUM = 5;
int SHORT_NUM = 10;
int TALL_NUM = 20;
int V_TALL_NUM = 40;
public static void classifyBuilding(int floors) {
if (floors < HOUSE_NUM) {
@adenhaus
adenhaus / DuplicationExample.java
Created January 12, 2021 15:30
Example of how naming drives removing duplication (before refactoring)
public class DuplicationExample {
String buildingType;
public static void classifyBuilding(int floors) {
if (floors < 5) {
buildingType = "house";
} else if (floors < 10) {
buildingType = "short";
} else if (floors < 20) {