3 ms·
Multiple levels of abstraction kills me, at least without adequate documentation. Conceptually, it's veey easy to grasp, but in code it becomes a mess making ju
by giantg2 4y ago
Multiple levels of abstraction kills me, at least without adequate documentation. Conceptually, it's veey easy to grasp, but in code it becomes a mess making jumps through multiple unfamiliar files in a large code base. Essentially, you end up having to hold all the pertinent information on that code in your head, which largely defeats some of the purposes of breaking them into multiple files.
- baby 4y agoYou’d probably say the same if no abstractions were there. It’s a trade off. Don’t necessarily abstract something, but do it if it makes everything else better and more maintainable and more secure. Probably a good philosophy is to never start with abstraction and leave that to refactors.
- giantg2 4y agoYeah, we seem to have gotten better at this by using noSQL databases with one big JSON object for each item instead of relational based on OOP objects.
- BigJono 4y agoOne problem that's usually missed with these kinds of "black!", "no, white!" comment chains is that people are working in different environments with completely different points of reference to work from. Front-end developers hear "no abstractions is bad!", and they don't take into account that something like React already provides an abstraction more powerful than all the abstractions put together in some other programming environments. Having a localised section of UI bundled with everything driving it in a single 20 line file is absolute light years ahead of the dumpster fire of the 2010 web, which in turn was probably light years ahead of whatever people were doing with IE and Netscape in the 90s. So they do crap like separate into "logic" and "display" components, or they import 6 heavily abstracted libraries on top that give virtually no additional benefit and just add 8,000 lines of third party documentation to the already heavy cognitive burden other developers on the project have to understand the code. Likewise even though I've never worked on one, I'm sure there's projects in more 'low level' environments where a single good functional abstraction could wipe out 200 lines of code in a flash, and the 3rd party libraries available are actual huge upgrades. If that's all you've ever worked on and you hear an (actual good) front end dev completely shithouse 3rd party libraries you'll likewise be as terrified of their advice as I am when I hear people talk about something being underabstracted.
- rileymat2 4y agoI find that this type of code is much easier to debug in a debugger, while harder to debug looking at source code. When in a debugger, I can throw a breakpoint in, inspect inputs and outputs, if they are what I expect, there is (generally[1]) no reason to dive into those other files. When reading the code from source outside of a debugger, as a new person to the code base, I agree with you and the exact problem you are describing. [1] Reasonably written code without a bunch of hidden global state.
- Gigachad 4y agoThe real problems come when you need to make the code do something else that no longer fit the abstraction and now it's either rebuild the thing or tack on some extra bit which doesn't make sense with the original design.