3 ms·
Every OO horror story I've ever been involved with has that same phrase in there somewhere: ...it does not allow us to select the algorithm we wish to use at r
by joezydeco 16y ago
Every OO horror story I've ever been involved with has that same phrase in there somewhere:
...it does not allow us to select the algorithm we wish to use at runtime
I'm an embedded programmer so this kind of thinking is alien to me. But really, everyone plans for runtime configurability but is it really needed that often?
- axod 16y agoOnly if you don't know what you're doing and need to write several algorithms that you can try out at runtime :/ It's an absurd use case IMHO
- kenjackson 16y agoThis simplification is just as wrong as the blog post. It's very common to invoke different algithms based on specific instances of the data. To give a baby example, its typical that one uses a different sorting algorithm as a function of size and data distribution and key type. Theres a popular fft package, FFTW, that is based on this as well.
- axod 16y agoI wasn't saying that you can't use different algorithms based on inputs/data/circumstances. The issue I have is articles like this always try to make things stupidly configurable and general - like "I want to be able to hot swap this algorithm at runtime".
- limmeau 16y agoIn Java, there is not much space between hard-coding dependencies and implementing patterns which (also) make algorithms exchangeable at runtime. The first makes unit testing difficult, the second makes you look like a StrategyFactoryFactory fetishist. Often, link-time configurability would suffice, but that is hard to achieve with Java.