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

Jesse Skinner :javascript: 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
npub1aj2sj6thre0tdc2ad0qh49c3rt4wkyygsgahgklzyg6y7xp97ccqcw2k4y