News for hackers. Stuff that matters.
Re:Fake Trees: Using Indents for Simpler UIs by twic on Saturday December 30, 2023 @03:02PM (#38818514)
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/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/

It seems this is lost knowledge now.

Re:Fake Trees: Using Indents for Simpler UIs by crgk on Saturday December 30, 2023 @04:24PM (#38819313)
I 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.

Re:Fake Trees: Using Indents for Simpler UIs by Shorn on Saturday December 30, 2023 @07:52PM (#38820799)
ChatGPT 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-905840...

Re:Fake Trees: Using Indents for Simpler UIs by auselen on Saturday December 30, 2023 @04:33PM (#38819400)
I’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”.

Re:Fake Trees: Using Indents for Simpler UIs by ClimaxGravely on Sunday December 31, 2023 @10:44PM (#38829593)
That'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.

Re:Fake Trees: Using Indents for Simpler UIs by twic on Saturday December 30, 2023 @07:12PM (#38820568)
> 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.

Re:Fake Trees: Using Indents for Simpler UIs by keyle on Saturday December 30, 2023 @08:22PM (#38820964)
Every 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.

Re:Fake Trees: Using Indents for Simpler UIs by ClimaxGravely on Sunday December 31, 2023 @10:47PM (#38829604)
That'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.

Re:Fake Trees: Using Indents for Simpler UIs by ShadowBanThis01 on Saturday December 30, 2023 @05:35PM (#38819969)
I 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.

Re:Fake Trees: Using Indents for Simpler UIs by thanksgiving on Saturday December 30, 2023 @09:57PM (#38821354)
I 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.
Re:Fake Trees: Using Indents for Simpler UIs by ShadowBanThis01 on Saturday December 30, 2023 @10:08PM (#38821394)
Which, 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

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.

Re:Fake Trees: Using Indents for Simpler UIs by thanksgiving on Sunday December 31, 2023 @08:08AM (#38823796)
That’s concerning. I’d understand iPhone or iPad or such sandboxed devices but not this. If you are so inclined, can you see if you can reproduce this on a simple html page? Do you think the problem is client side or on their servers?

I like neocities.org for small experiments like this but you can use anything you’d like.

Re:Fake Trees: Using Indents for Simpler UIs by ShadowBanThis01 on Sunday December 31, 2023 @02:05PM (#38826548)
Thinking it through, I assume it's on the client side. Maybe something is wrong with the JavaScript that's doing the validation... but do Safari and Firefox use the same engine?

I don't know what else could vary based on platform. One thing I can't control for is browser and OS versions, because the older Mac I have (the one that works in this case) can't be updated to the latest.

It must be sending garbage characters. But the vast, vast majority of sites work. It's really mystifying.

As far as other sites are concerned... I just remembered one that's not quite as clear-cut. Zoro.com complains that my credentials are wrong, but if I reset my password it complains that I'm trying to use my current password... so it's obviously not wrong. As usual, they just threw up their hands... and sent me a 10% coupon... which of course I can't use because their site is broken. Just tried it again, and it's still unusable. Didn't try the older computer yet.

Re:Fake Trees: Using Indents for Simpler UIs by Terr_ on Monday January 01, 2024 @02:21PM (#38834527)
On 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/

Re:Fake Trees: Using Indents for Simpler UIs by strontian on Saturday December 30, 2023 @03:11PM (#38818625)
Thank you, this type of info is rare to come across and much appreciated
Re:Fake Trees: Using Indents for Simpler UIs by ted_bunny on Saturday December 30, 2023 @05:01PM (#38819668)
Why do people not take RDBs seriously anymore?
Re:Fake Trees: Using Indents for Simpler UIs by eikenberry on Saturday December 30, 2023 @08:24PM (#38820971)
IMO 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.
Re:Fake Trees: Using Indents for Simpler UIs by chadcmulligan on Saturday December 30, 2023 @05:24PM (#38819878)
I'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.

Re:Fake Trees: Using Indents for Simpler UIs by twic on Saturday December 30, 2023 @07:16PM (#38820592)
I 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

Re:Fake Trees: Using Indents for Simpler UIs by osigurdson on Saturday December 30, 2023 @08:06PM (#38820878)
If only those PhDs in the 70s would have though about scale out.
Re:Fake Trees: Using Indents for Simpler UIs by michaelteter on Saturday December 30, 2023 @05:16PM (#38819817)
Prevalence 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.

Re:Fake Trees: Using Indents for Simpler UIs by _a_a_a_ on Saturday December 30, 2023 @06:47PM (#38820429)
Hardly lost knowledge, have a book on it "Joe Celko's Trees and Hierarchies in SQL"

https://www.oreilly.com/library/view/joe-celkos-trees/978155...

Re:Fake Trees: Using Indents for Simpler UIs by twic on Saturday December 30, 2023 @07:14PM (#38820577)
But how many people here have any idea that book exists? That's what I mean by lost.
Re:Fake Trees: Using Indents for Simpler UIs by _a_a_a_ on Sunday December 31, 2023 @07:49AM (#38823724)
We differ in our definitions of that word :)
Re:Fake Trees: Using Indents for Simpler UIs by victor106 on Saturday December 30, 2023 @07:11PM (#38820564)
> 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.

Re:Fake Trees: Using Indents for Simpler UIs by Pamar on Sunday December 31, 2023 @06:19AM (#38823273)
100% agree - I suggest people interested in these topics to go look for books by https://en.m.wikipedia.org/wiki/Joe_Celko for a start.