News for hackers. Stuff that matters.
Re:Green Lumber Fallacy in Software Engineering by WalterBright on Thursday January 13, 2022 @11:23PM (#29930571)
Over and over, I see code written by star professionals that you've heard of, reinventing the bubble sort.

I'm guilty of it myself.

> It's a bit like saying it's silly for pilots to have to know what to do in the case of engine failure or stall from memory and regularly practice in a simulator, because that stuff rarely happens and most of the time they're just using autopilot. That's true, it usually doesn't matter, but when it does... it matters a lot.

Well, we now know what happens when pilots forget the runaway stabilizer trim procedure (turn off the stab trim).

Re:Green Lumber Fallacy in Software Engineering by XorNot on Thursday January 13, 2022 @11:31PM (#29930614)
I mean this is also what happens when pilots aren't following their checklists though.
Re:Green Lumber Fallacy in Software Engineering by WalterBright on Thursday January 13, 2022 @11:43PM (#29930660)
Checklists in an emergency are the same idea as Dealer's Strategy in blackjack. If you've got nothing better, or are under so much stress you can't think, or don't have time to think, do Dealer's Strategy. But sometimes, pilots are needed to recognize when the checklist isn't going to work, and can innovate on the job. That's why we still have pilots on airplanes, as a computer can follow a checklist.
Re:Green Lumber Fallacy in Software Engineering by tubby12345 on Thursday January 13, 2022 @11:34PM (#29930625)
if i need a toposort in my proprietary task scheduling system, or fisher–yates shuffle in my proprietary ranking system, what do you recommend? this isn't hypothetical - i've had these things come up in the last half at work.
Re:Green Lumber Fallacy in Software Engineering by YZF on Thursday January 13, 2022 @11:46PM (#29930671)
[dead]
Re:Green Lumber Fallacy in Software Engineering by sol_invictus on Friday January 14, 2022 @01:39AM (#29931277)
Hi! Please refer to the HN guidelines, especially the following section:

> Be kind. Don't be snarky. Have curious conversation; don't cross-examine. Please don't fulminate. Please don't sneer, including at the rest of the community.

You can find the guidelines here: https://news.ycombinator.com/newsguidelines.html

[dead]
Re:Green Lumber Fallacy in Software Engineering by sol_invictus on Friday January 14, 2022 @02:09AM (#29931436)
Hi! Please refer to my previous comment.
Re:Green Lumber Fallacy in Software Engineering by YZF on Friday January 14, 2022 @12:02AM (#29930759)
I don't think anyone is saying never implement an algorithm. There's a time and place. I've seen code bases where these algorithms had ten different implementations, some of the with subtle bugs, some of them with some performance issues. Your code will also need to be maintained down the line. There's more to software engineering than writing toposort.

Obviously(?) my Boost proposal was made in jest. Anyways, maybe I'm a little bit jealous that you get to do this all the time ;) I just hope I'm not the one that has to maintain it down the road...

Re:Green Lumber Fallacy in Software Engineering by tubby12345 on Friday January 14, 2022 @12:04AM (#29930776)
>I just hope I'm not the one that has to maintain it down the road...

i'm good at what i do - my implementations are clean. they got that way (surprise surprise) as a side-effect of me implementing many times.

Re:Green Lumber Fallacy in Software Engineering by trollytroll69 on Friday January 14, 2022 @08:24AM (#29934136)
every one says this, yet I've had on multiple occasions debug terrible implementations of lists/stacks. someone's lying
Re:Green Lumber Fallacy in Software Engineering by eternityforest on Friday January 14, 2022 @02:31AM (#29931572)
If you're doing things in C++ you're already doing very specialized stuff, nobody can advise without actually knowing the app well. Especially if you have an app that rubs in all those different situations.

But... boost seems pretty common. Everyone seems to complain about it, but if it replaces a whole pile of hand written things, it looks like it could really bring some consistency to a project. I've never done serious C++ outside of embedded though, so I don't have Boost experience.

In a dynamic language like JS, you'd search for "Graph theory algorithms library" and probably find one with ten million downloads, investigate the maintainer a bit, and use it.

Re:Green Lumber Fallacy in Software Engineering by mehrdada on Friday January 14, 2022 @03:15AM (#29931792)
> In a dynamic language like JS, you'd search for "Graph theory algorithms library" and probably find one with ten million downloads, investigate the maintainer a bit, and use it.

Mmm... `leftpad`

Re:Green Lumber Fallacy in Software Engineering by eternityforest on Friday January 14, 2022 @03:26AM (#29931874)
Left-pad was as far as I know written by one person. Had they used underscore or lodash or any of those bazillions of utility libraries out there, that have real code review, and are actually making money, this would be way less likely.

That's why I'd look for a graph algorithms library first, not a topo sort specifically, I'd be looking for larger one size fits all libs likely to be maintained by a larger group and have more eyeballs on them.

Re:Green Lumber Fallacy in Software Engineering by WalterBright on Thursday January 13, 2022 @11:37PM (#29930636)
Bubble sort is really bottom of the barrel.
Re:Green Lumber Fallacy in Software Engineering by tubby12345 on Thursday January 13, 2022 @11:41PM (#29930652)
what was your point? that it's silly to reinvent the wheel over and over. so i gave you an example of a wheel (two) that often needs to be reinvented.