just saw this comment in a "what JS lib do you use" poll
"@Xanti - yes, yes, modularization and abstraction in programming is a terrible practice. Functions that call other functions? Wasteful."
And that left me curious because I am using Kohana framework for PHP and Jquery library for javascript.
Why do some people consider abstraction and modularization bad practices? Are not frameworks and libraries made to ease and speed up development?
here's a link to the poll
I have found that too much abstraction can be hazardous to your productivity:
A poorly chosen abstraction can be worse then no abstraction at all.
If you need to read four or five different modules in order to understand how a simple algorithm works, then the abstraction barriers are probably not in the right places. Maybe there's a good way to refactor the code, or maybe it would be easier just to remove the barriers.
If the abstraction does not correspond to a relatively familiar idea, it may be difficult for new team members to learn.
Abstraction is not a "mindless good"; it exists to serve specific purposes. Among the most common purposes are
To protect the invariants of a data structure
To encapsulate design decisions that are likely to change
My biggest experience with abstraction getting in the way was with our research compiler for C-- (archival snapshot from 2008 at https://www.cs.tufts.edu/~nr/c--/). There was a great deal more abstraction than students were used to seeing in compiler class:
Each of these abstractions served an important purpose for our research, but the total effect was that it was very difficult for new students to learn the compiler. So, even if the original comment was in jest, there are places where abstraction can cause problems.
When working on limited resources, it can easily add overhead.
Sure there are things compiler will optimize away, but if you create four neat objects in four neat .c files, compile them to four neat .so files and then link them with a dumb linker, cross-module function calls that could be easily inlined are still made with full state dump, pieces that could be optimized away entirely are still executed, and so on.
I assure you if you start programming an 8-bit PIC microcontroller with 4K RAM and 16K Flash using best practices of object oriented languages, using advanced design patterns and creating more than one abstraction layer, your program will never run. "Premature optimization is a root of all evil" was said by a guy who never programmed for a platform that has 128 bytes of RAM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With