Why Nostr? What is Njump?
2024-06-14 14:47:28

Coding with Jesse on Nostr: Why does so much "refactoring" essentially boil down to changing this: function a() { ...

Why does so much "refactoring" essentially boil down to changing this:

function a() {
doOneThing()
}
function b() {
doAnotherThing()
}

into this:

function a() {
doThing('one')
}
function b() {
doThing('another')
}
function doThing(type) {
if (type === 'one') {
doOneThing()
} else if (type === 'another') {
doAnotherThing()
}
}

If your "code reuse" is increasing the amount of code, you're probably doing it wrong.
Author Public Key
npub1tj3xx2sts6ywx59j3mzdhgrt92f0m6z7kj04q0efkjezjksjr0ms0drgt3