4 ms·
You probably won't get someone posting an example, because they're often in closed enterprise type source code. One example is spaghetti type code that you hav
by LouisSayers 9y ago
You probably won't get someone posting an example, because they're often in closed enterprise type source code.
One example is spaghetti type code that you have to untangle and see if you can simplify (or simply understand). Imagine that you have a Rails controller where there are several modules being pulled into it. There is a before filter that calls a private method. The private methods makes a call to another method, but it's not clear where that method is. It turns out that it's in one of the modules. The module method makes calls to other methods in other modules - of which you have to hunt down and figure out where they are. One of the methods in such modules has some dynamic code where it calls a class based on a value that comes from the DB...
There's some funky stuff that goes on in production apps sometimes - add in a bit of tricky logic to trace, and maybe you can see how it could take a bit to get your head around what's going on.
Hopefully this is the exception to the rule, but if you're a consultant who's job it is to clean up other's messes then I guess it wouldn't be so surprising to see some pretty gnarly code.
- archagon 9y agoThanks! That's kind of what I figured, which makes me a little glad I haven't had to do that kind of work yet.