5 ms·
Don't be afraid to delete code
- gills 18y agotypedef std::list<std::string> StrList;
- silentbicycle 18y agoAs the previous version of the Suck Less philosophy said, "Deleted code is debugged code." http://www.suckless.org/common/index.html http://www.suckless.org/common/index.html
- stcredzero 18y agoHow about using garbage collection?
- qwph 18y agoHow about it?
- stcredzero 18y agoProvided performance demands allow it, you can use a conservative garbage collector with a C program, or you could identify pointers, 'objects,' and roots. Then all of this would disappear. You'd delete even more code.
- qwph 18y agoFor the specific example given, yes, that is true. But I think the general principle still holds.
- stcredzero 18y agoIt's a good general principle. But I suspect that many people often don't take it as far as it could go. Memory management is a great example. It's orthogonal enough to business logic, it can be made to largely disappear from application code. There's a lot more of this that could be accomplished, but our expectations are still a bit too low. One fascinating thing about the Smalltalk environment is how it has managed to make lots of plumbing disappear. The "workspace," which is an app used for dynamically executing code, is so straightforward to write, a commercial Smalltalk environment (ObjectStudio) had a workspace that was written by a bored developer in an intro class! (The final version was more polished, but the thing was functioning as a workspace after only 10 minutes of coding.) Similarly, I can start coding a debugger capable of displaying the equivalent of a core dump in 10 minutes and have something that's usable. Things that are esoterica in other systems are just ordinary applications. There's relatively little to a Smalltalk "IDE" because there is just less to do to build one. Most of the meta level is ordinary objects manipulated mostly ordinary programs.
- swombat 18y agoPerhaps it is because I use a pretty, elegant language like Ruby, but this article's point seems incredibly basic. I spend a large part of my rails coding time figuring out ways to remove code. In fact, I feel best about a coding session when I've significantly reduced the size and complexity of a part of the code.