Hacker News new | ask | show | jobs
by username90 2298 days 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.

1 comments

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.
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.
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.
Not really, the individual STL algorithms haven't changed. Partition is still a one line loop. Some things can be left alone.
In this specific instance, sure. I'm talking about business logic in the general case.
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.

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.
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.