3 ms·
There's talk here about the over-abstraction of what should be a simple problem. Usually when this happens, people are dismissing a toy example, (and they can
by mrkeen 2y ago
There's talk here about the over-abstraction of what should be a simple problem.
Usually when this happens, people are dismissing a toy example, (and they can make the toy even simpler.) I think that is the case here.
String-concatenation in a word game is not worth this abstraction overhead. But I think it's supposed to teach people not to be afraid of usingLongFunctionNamesToTellAStory().
It would probably work better on code like:
..
// Otherwise we gotta make a sibling now
if ( newNode (&siblingId, a) == NEWNODE_FAIL ) {
return ADD_FAIL;
}
Node *sibling = getNode (a, siblingId);
// And a new place for it to point
NodeIdx destId = 0U;
if ( newNode (&destId, a) == NEWNODE_FAIL ) {
return ADD_FAIL;
}
..
could take on more of a style like:
if (needSiblingNode()) {
return ADD_FAIL;
}
..
pointToNewAddress()
- EnergyAmy 2y agoThat's also kind of a bad example, because it's using a language with dogshit error handling. In a language like Rust, you'd just do e.g. `let sibling = new_node(...)?;`, and you wouldn't need the extra functions. I'd dislike having to go off and find both `needSiblingNode` and `pointToNewAddress` just to figure out what a few lines of code mean.