News for hackers. Stuff that matters.
Re:Why I often implement things from scratch (2006) by username90 on Sunday March 08, 2020 @12:57PM (#22519060)
> But that’s still more code that you have to maintain now.

10 lines of code is easier to maintain than a whole dependency.

Re:Why I often implement things from scratch (2006) by jolux on Sunday March 08, 2020 @01:18PM (#22519194)
That'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.
Re:Why I often implement things from scratch (2006) by jlokier on Sunday March 08, 2020 @02:35PM (#22519675)
A 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 ...).

Re:Why I often implement things from scratch (2006) by jolux on Sunday March 08, 2020 @05:54PM (#22520875)
If 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.
Re:Why I often implement things from scratch (2006) by jlokier on Sunday March 08, 2020 @10:50PM (#22522532)
That'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.

Re:Why I often implement things from scratch (2006) by sagichmal on Monday March 09, 2020 @05:54AM (#22524178)
> If you're truly just doing a 2x2 matrix manipulation once in the codebase

That is the precise premise of the hypothetical.

Re:Why I often implement things from scratch (2006) by jolux on Monday March 09, 2020 @09:04AM (#22525008)
In 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.
Re:Why I often implement things from scratch (2006) by kqr on Sunday March 08, 2020 @04:57PM (#22520569)
This 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.)

Re:Why I often implement things from scratch (2006) by jolux on Sunday March 08, 2020 @06:55PM (#22521232)
Now that, I can wholeheartedly agree with :)
Re:Why I often implement things from scratch (2006) by username90 on Sunday March 08, 2020 @01:37PM (#22519305)
> 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.

Re:Why I often implement things from scratch (2006) by jolux on Sunday March 08, 2020 @02:02PM (#22519483)
The 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.
Re:Why I often implement things from scratch (2006) by username90 on Sunday March 08, 2020 @02:10PM (#22519521)
Business 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.
Re:Why I often implement things from scratch (2006) by jolux on Sunday March 08, 2020 @05:43PM (#22520816)
I’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.
Re:Why I often implement things from scratch (2006) by BubRoss on Sunday March 08, 2020 @02:54PM (#22519784)
Not really, the individual STL algorithms haven't changed. Partition is still a one line loop. Some things can be left alone.
Re:Why I often implement things from scratch (2006) by jolux on Sunday March 08, 2020 @05:50PM (#22520862)
In this specific instance, sure. I'm talking about business logic in the general case.
Re:Why I often implement things from scratch (2006) by BubRoss on Monday March 09, 2020 @12:29PM (#22526695)
You'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.

Re:Why I often implement things from scratch (2006) by jolux on Monday March 09, 2020 @06:22PM (#22530544)
What definition are you going on exactly? Nobody has said the phrase “fundamental algorithms” before you in the thread. Yes, I would agree that those are distinct from business logic. Nonetheless the actual definition of the word “algorithm” is not formally or universally agreed upon at all. I’m curious what definition you’re using and where it came from, if only because I now feel confused.
Re:Why I often implement things from scratch (2006) by BubRoss on Tuesday March 10, 2020 @12:46AM (#22532796)
When something doesn't need to change, that's at least an established algorithm. Algorithms like sorting, partitioning, hashing, reduce, map, swap etc. are common and don't change. Mathematics like linear algebra don't change. They are fundamental elements of most nontrivial programs.
Re:Why I often implement things from scratch (2006) by jolux on Tuesday March 10, 2020 @07:39AM (#22534560)
Sure, that part I agree with. But the stuff around it, i.e. how those fundamentals are used and composed, also qualify as algorithmic to me. It’s probably a lower-level definition than you’re using, because to me all programs are an algorithm of some kind.
Re:Why I often implement things from scratch (2006) by BubRoss on Tuesday March 10, 2020 @09:07AM (#22535073)
I don't know what you are trying to say at this point. You were arguing that every part of a program changes and expands. It should be pretty clear that that is not true.