6 ms·
The first approach (the 'It’s "obviously" the only way to go' one) is called an adjacency list. The second (the 'vastly simpler method') i don't recall seeing
by twic 3y ago
The first approach (the 'It’s "obviously" the only way to go' one) is called an adjacency list.
The second (the 'vastly simpler method') i don't recall seeing before. It has some fairly obvious deficiencies, but it is clearly enough in some cases.
The third ('namespacing') is called a materialized path.
And there is at least another way to represent trees - nested sets: https://www.ibase.ru/files/articles/programming/dbmstrees/sqltrees.html https://www.ibase.ru/files/articles/programming/dbmstrees/sq...
All of these were well-trodden back in the days when people took relational databases seriously. For example, see: http://www.dbazine.com/oracle/or-articles/tropashko4/ http://www.dbazine.com/oracle/or-articles/tropashko4/
It seems this is lost knowledge now.
- strontian 3y agoThank you, this type of info is rare to come across and much appreciated
- crgk 3y agoI love this comment. One of the worst feelings at my old job was putting a ton of effort into describing a problem, only for somebody else to recognize it as a known, studied thing that already has a name. It’s really hard, in my experience, to come across the existing name for something while you’re still figuring out all the angles of a problem for yourself.
- auselen 3y agoI’m opposite about the feeling. When I work on a problem that’s new to me, I ask around, explaining the problem, checking if someone recognizes the domain, if it is known. When someone explains to me what I’m working on is a solved problem, I take great joy from it since I already understand the issue some, I can criticize or take great energy from learning something for sure. I believe how to feel about it is a choice btw. As movie says “Always Look on the Bright Side of Life”.
- ClimaxGravely 3y agoThat's generally how I do it as well. One of the positives about remote work is I can go on my general programming slack channel at my work and write out my problem and get better visibility than going around my local area in my office. Also I end up getting to meet programmers from different projects/departments that I would have never met if I was only working in office.
- ShadowBanThis01 3y agoI don't know why you should feel bad about that. If anything, you should feel good that you independently recognized a problem so significant that it was given a name. I assume most problems I face are solved, and that I just don't know shit. So I scramble to research the solutions, and I'm shocked when what seem to be widely-encountered problems are NOT, in fact solved. One recent example I encountered was API definition. I was tasked to define a new API for my company's products, and celebrated when I discovered OpenAPI. I was a bit surprised to find that only the very latest version of the standard (3.1) was competent enough to be useful. And despite 3.1 being ratified for years, today there are still no usable code-generation tools that support it. I wasted weeks studying and trying to fix various tools, after studying reams of redundant and conflicting documentation in different repositories... thinking it was my problem. No. It's just a hideously broken mess. Today I'm dealing with the same thing in SwiftUI... and again have reached the conclusion that the programming paradigm it pushes has not been thought through. Its rushed and immature state shows in its kitchen sink full of overlapping and rapidly-deprecated approaches to problems that were solved in traditional application structures a decade and a half ago. Just typing that out, I wonder if I failed to learn from my first example and wasted too much time on the second. But if you're a thorough person, you have to satisfy yourself that you've been diligent in trying to inform yourself of best practices.
- thanksgiving 3y agoI think we’ve all had that one friend/classmate in c plus plus 101 who always “cried wolf” saying there’s a problem with the compiler making the instructor proclaim that 99.9999% of the time if your code fails to run it is not a bug in the compiler. We’ve been taught/trained to find the fault in our own work.
- ShadowBanThis01 3y agoWhich, to be fair, is really the correct thing to teach since in the vast majority of cases that's where the fault is! On the other hand, I find a lot of bugs. Not in things as refined as compilers, usually, but if I had a dollar for every time I've heard, "Well, nobody else has reported this before," I could probably buy a tank of gas. And that's saying something today. Latest example: Amazon's Web site rejects all phone numbers entered on an Apple Silicon Mac. I was setting up a new address, and it said "remove invalid characters from phone number field:" https://i.imgur.com/mjwiCqc.png https://i.imgur.com/mjwiCqc.png This happened in both Safari and Firefox. Amazon support couldn't figure it out in 1.5 hours of chat. I went to an Intel Mac and entered the exact same number, no problem.
- twic 3y ago> It’s really hard, in my experience, to come across the existing name for something while you’re still figuring out all the angles of a problem for yourself. Absolutely! Discoverability is a huge challenge. There is so much amazing work that's been done in the past that is virtually impossible to find out about. I only know this stuff because I was working with databases fifteen years ago and an older colleague encouraged to me to learn more about it.
- Shorn 3y agoChatGPT is pretty useful for this. Of course, you still have to do all the work of describing the problem. But if you iterate through your problem and solutions within a conversation you can get to what you need (a conventionally understood term) faster than writing a fully-fledged blog post. I copied the context of the article into ChatGPT (v4) and asked it "What are the names of these methods that are conventionally understood in the wider industry?" It suggested terminology like: "adjacency list", "materialized path" and "nested set". https://chat.openai.com/share/3677c2f9-f844-469b-84a1-90584085abdb https://chat.openai.com/share/3677c2f9-f844-469b-84a1-905840...
- keyle 3y agoEvery generation wants to reinvent the wheel, because otherwise they'd feel helpless and it's way more fun. Further than that I think that every generation wants to make their own mistakes, regardless of how well documented they were. Overall this is healthy, a new set of eyes to an old problem can yield new solutions. In some cases though, it's a facepalm situation. Like the whole Javascript world of today.
- ClimaxGravely 3y agoThat's certainly the reason I wrote my own static site generator for my website. I knew I was reinventing the wheel but I also knew the learning results would be immense. I usually work in real-time systems and it was great to have a project to learn how to do offline data-in data-out types of problems. The two types of problems can be very different. Also it gave me a good excuse to finally actually do something with a functional language. I'd never recommend my static site generator to the general public though.
- Terr_ 3y agoOn that note, the Online Encyclopedia of Integer Sequences [0] is a fantastic resource for certain algorithm-stuff where you want to figure out if mathematicians have already named something. [0] https://oeis.org/ https://oeis.org/
- ted_bunny 3y agoWhy do people not take RDBs seriously anymore?
- michaelteter 3y agoPrevalence of abstraction layers (ORMs), document stores, key-value stores, etc.? Someone somewhere decided they didn't like SQL and engineered a way to postpone having to know SQL until their ORM performance dragged their systems to a halt.
- chadcmulligan 3y agoI'm thinking performance - it used to be a big deal to optimise database performance. Now most databases can live in memory so even if you're doing full table scans all the time it won't be that noticeable, and by the time the database has enough data in it that performance becomes an issue every one who built it has left. The focus on micro services to, probably has an impact - the back end can be changed if your database is having issues and the services stay the same. Also databases are hard and a large chunk of developers only know javascript and html. You don't see many DBA jobs any more, a lot of that is moving to the cloud so they just pay more money and throw CPU's at the problem rather than optimise the database. Also agile/scrum (as its practiced anyway) doesn't really allow for a database design up front as it used to be done.
- twic 3y agoI think it was: 1. The whole noSQL thing 2. A move away from databases as store of all knowledge to databases as implementation detail of applications, which IMHO was a good thing, but tended to make them smaller, simpler and more hidden away
- osigurdson 3y agoIf only those PhDs in the 70s would have though about scale out.
- eikenberry 3y agoIMO it is because SQL isn't a well liked/popular language (eg. the nosql movement) and it is a lot easier to avoid these days with all the various DBs. Personally I wish Prolog had gained more traction back in the day, it would have made a great alternative.
- _a_a_a_ 3y agoHardly lost knowledge, have a book on it "Joe Celko's Trees and Hierarchies in SQL" https://www.oreilly.com/library/view/joe-celkos-trees/9781558609204/ https://www.oreilly.com/library/view/joe-celkos-trees/978155...
- victor106 3y ago> It seems this is lost knowledge now. You nailed it. We hire younger grads who just want to cram everything into a nosql document and not give any thought to data modeling. Of course, they do all the logic of displaying the tree in code, which is sad as modern relational databases along with some CTE’s can handle so many use cases for free and in an elegant fashion.
- Pamar 3y ago100% agree - I suggest people interested in these topics to go look for books by https://en.m.wikipedia.org/wiki/Joe_Celko https://en.m.wikipedia.org/wiki/Joe_Celko for a start.