Hacker News new | ask | show | jobs
by jmvoodoo 898 days ago
I started a company that dealt with a lot of tree like data. It is possible to transform your tree structure into an indented list in O(n) time. This used to be one of our interview questions at the time. There are a number of ways to store your data in various SQL databases that allow you to quickly get and render segments of the tree as well without recursive queries.

Once you understand those concepts, then storing your data correctly as trees has a ton of benefits over indenting like this.

1 comments

If you don't need those benefits it doesn't really matter.
What people are saying in this comment section is that you're probably going to need it. You might not need it now, but the PM of today is a short-sighted person and the future always gets here.
Sure, but if your current solution is 20 lines of code it's trivial to refactor it later if you need it.

Of course the average dev won't do that, they'll just add a hacky workaround as they always do and end up with a buggy horrible mess but thats irrelevant. They'll do that anyway if they're that type of dev.

And honestly I despise this "managers are short sighted" excuse. We're the developers, we do the work. If I open a repo and see a horrible buggy mess with your name on it I'm judging you, I don't give a crap who your manager was.