4 ms·
I'm not going to integrate LAPACK for a single line expression.
by BubRoss 7y ago
I'm not going to integrate LAPACK for a single line expression.
- jolux 7y agoLAPACK is the underlying library behind most linear algebra packages in other languages and furthermore it was just an example. My guess is that you probably don’t have just one line of matrix manipulation ever, in which case using a well established library is a good idea. If not, then sure. Do it yourself. But that’s still more code that you have to maintain now.
- username90 7y ago> But that’s still more code that you have to maintain now. 10 lines of code is easier to maintain than a whole dependency.
- jolux 7y agoThat's arguable, because 10 lines of code almost never just stays 10 lines of code, and my point in the first place was more contesting that the dependency is hard to choose, or that there aren't solid proven libraries for this.
- username90 7y ago> 10 lines of code almost never just stays 10 lines of code This is only true when you implement business logic, not when you implement algorithms.
- jolux 7y agoThe difference between those two things is often blurry from a distance. Business logic is algorithmic too, it's just a question of how specific and complex the algorithm is.
- username90 7y agoBusiness logic changes and grows more complex over time, how to invert a matrix doesn't. Trust me, I implement algorithms for a large library for a living, they very rarely change or grow.
- jolux 7y agoI’m aware that you have a definition of “algorithm” that only includes things that don’t change, and I think I know roughly what you mean, but also algorithms are pretty much unavoidable in line of business development. Whether or not they’re well defined, sufficiently general, and have a good name is another thing. In this case you’re right but in a codebase with no documentation where people are doing things like re-implementing JSON parsers from scratch, as I was stuck with at my last job, I’m very wary of “this algorithm is simple” because I don’t trust my coworkers in that case to actually know what they’re talking about. I’m completely sure you do, for what it’s worth.
- BubRoss 7y agoNot really, the individual STL algorithms haven't changed. Partition is still a one line loop. Some things can be left alone.
- jolux 7y agoIn this specific instance, sure. I'm talking about business logic in the general case.
- BubRoss 7y agoYou're the only one talking about business logic. By definition business logic is not the same as fundamental algorithms or mathematics. Inverting a matrix doesn't change. A business wants to be able to change its logic to evolve how they do things. You keep trying to conflate these things but they are polar opposites.
- 7y ago
- jlokier 7y agoA counterargument: 1 large, complex dependency (plus the 20 lines of wrapper code to transform your program's internal data to initialise and call the library) almost never just stays as 1 large, complex dependency (plus 20 lines of ...).
- jolux 7y agoIf you're truly just doing a 2x2 matrix manipulation once in the codebase, then I concede. I guess I'm blanking on situations where that would be the case though, or where more generalized capabilities wouldn't be useful.
- jlokier 7y agoThat's fair enough. But I was really just wanting to show, via irony, that the structure of the original argument is self-annihilating. That is, "X almost never stays as just X therefore X is bad" applies to both branches reasonably, and is therefore invalid as an argument in support of one branch.
- sagichmal 7y ago> If you're truly just doing a 2x2 matrix manipulation once in the codebase That is the precise premise of the hypothetical.
- jolux 7y agoIn fact it was not presented with that level of precision, it merely asked if one had to solve that particular problem and gave no indication about what other algorithms and manipulations the codebase might be using. And furthermore, I maintain that the original example is contrived until proven otherwise.
- kqr 7y agoThis is why it's important to add a comment to those 10 lines describing the choice, and urging future contributors to reevaluate the situation. (Of course, one should always reevaluate the situation when making changes to code, but we all need a nudge sometimes when we're afraid of doing the wrong thing.)
- jolux 7y agoNow that, I can wholeheartedly agree with :)