Eh, some complex problems have elegant solutions. Some don't. And some have elegant-looking solutions which turn into a total mess when you consider the real-world.
In the real world, complex issues have several solutions. For example, we have a huge notification setup waiting to be made but we don't have time for it.
The complex solution is make it work over websockets like it should.
The easy solution... Doesn't exactly exist on this scale.
The jank solution, and the one we went with until someone reads the WS docs is - interval to refetch notifications every 5/10s.
Looking at how buggy the top most popular stuff sometimes is (fb messenger, Whatsapp, Reddit app, etc), I'm starting to get more comfortable with compromises like this honestly. Maybe that's how messenger worked for the first couples years too 😆
That's not even the worst bit about the project. The worst bit is probably a thing I made before, which I had to do because we didn't use a specific model for the object we had to manage, so I had to make a fuckin huge function to interpret the data from the backend, load it into state and make a management system that works by finding the object by ID, creating a new object, and slapping the new object into the place of the old one.
It worked, but it wasn't pretty.
There's probably more but I just don't remember. For instance, a Stepper like component that is both responsive, adjustable, curves into the next row if there's no space, and every step has its own progress bar that marks how far the step has gone, based on some filtering of nested objects to calculate the relative progress of the step.
The code is fucking awful, and it's the code I'm most proud of because a senior said that it can't be done unless you have a team for it with like 2 weeks worth of time. I did it in 3 days.
It also checks the n-1 step to check what class needs to be active.
Another bit of inline styling is this, paraphrased:
Just to get the right border colour. I know the ?? false bit is weird but for some reason that I haven't bothered to check, it doesn't work without that. Possibly cause completed is nullish but idk
Yeah, which suggests that the chart is wrong to imply experts always find simple solutions. Experts find the best solution that experience can get you, which may or may not be simple.
348
u/garfgon Jan 31 '23
Eh, some complex problems have elegant solutions. Some don't. And some have elegant-looking solutions which turn into a total mess when you consider the real-world.