Surely we all know at this point that the two hardest things in programming are: naming things, threading, and off-by-one errors.
What happened to cache invalidation?
Hardest problem in computer science: centering things
71–80 of 473 posts
Re: Hardest problem in computer science: centering things
#722D and 3D tools get this right. CAD programs, game engines, and animation programs are all far better at positioning things. They have far better layout engines and constraint systems. This is really a constraint problem. Autodesk Inventor and Fusion 360 have good 2D constraint solvers, ones that can put something on a centerline, or parallel, or whatever, including curve tools. Webland never got that far.
Re: Hardest problem in computer science: centering things
#73If you Google “Why is CSS terrible?” you will get dozens of questions on SO or Reddit about noobs complaining about CSS and how it is outrageously hard to understand and use. Nearly every one of those threads has at least one comment that reads like, “Well I’m a senior web developer and if you don’t like CSS it’s probably because you’re a fucking idiot!” Some will go so far as to say if you don’t like CSS and you’re…
They barely even understand it?? I think the biggest problem with CSS is the same problem plaguing C++ and other older languages. Cruft. If there was proper versioning and pieces of the language were deprecated in favor of modern techniques, it would remove a lot of ambiguity. Heck, if there was a built-in linter that warned you about common errors that would be a massive upgrade!
The only bad part about CSS is that there’s a dozen ways to do everything.
With that said, any developer telling you they hate it probably hasn’t worked with the “state of the art” in other UI development. Go work with WPF, UWP, QT, ImGui, JavaFX, Swing, or any of the dozens of other desktop UI frameworks. Then, try to make a moderately complex style and apply it to several elements. It’s a PITA. I too hated CSS… but then I worked with WPF and JavaFX and lots of those other frameworks: and they gave me a fresh dose of perspective.
I’ll gladly take the ability to do everything a dozen different ways over the inability to do anything that strays from the happy path in the framework I’m using.
Re: Hardest problem in computer science: centering things
#74A designer once advised me to align an icon with the "typographical center of gravity" - as in, of the "ink". This would make the location of an icon next to text depend on the text itself, not just the font. Obviously, we compromised in practice :)
That’s actually arguably the source of the problem in a lot of these examples. In some of them, the bad alignment would look good if the text next to it contained more descenders. This could be compensated for, of course. For e.g. a single checkbox and text, move the text a bit lower if there are no descenders in it. But that doesn’t work if the text is user input, or if there are multiple text boxes in a list: it’s…
I actually kinda want to see this just once. I think it would be terrible but I’m not convinced enough to write it off entirely.
Re: Hardest problem in computer science: centering things
#75Is the author here? Can you give us a toggle so we can turn off the moving cursors? It's a little distracting. Reader mode isn't working so well, so I deleted the element in developer tools in the mean time.
||tonsky.me^$websocket,1p
Re: Hardest problem in computer science: centering things
#76Earlier quoted context omitted.
That’s actually arguably the source of the problem in a lot of these examples. In some of them, the bad alignment would look good if the text next to it contained more descenders. This could be compensated for, of course. For e.g. a single checkbox and text, move the text a bit lower if there are no descenders in it. But that doesn’t work if the text is user input, or if there are multiple text boxes in a list: it’s…
Text based layouts should come back. Search "TextOS" on twitter for examples. If someone finds it, post a link below (responding on a Kindle Paperwhite, twitter won't run)
Re: Hardest problem in computer science: centering things
#77> That’s exactly why people love web programming so much. There’s always a challenge. LOL, these examples are exactly why I got out of web programming. Thankfully I never had to deal with any of the modern frameworks. I was getting hot flashes just scrolling through this page.
There is challenging for the wrong reasons then there is challenging for the right reasons. You will want to make sure you work on things that are challenging for the right reasons.
Inherent complexity (due to difficult real-world constraints) is fine. Accidental complexity, like that caused by overcomplicated tools or architectural decisions, just feels bad.
Re: Hardest problem in computer science: centering things
#78(It is a good article!)
Re: Hardest problem in computer science: centering things
#79It's just as hard in the real world: https://ftw.usatoday.com/lists/nc-state-texas-ncaa-portland-...
Re: Hardest problem in computer science: centering things
#80That's because CSS layout was designed by people who thought "float" and "clear" were a good idea, tables were bad, and, when in doubt, make it Turing-complete and dump the problem on someone else. 2D and 3D tools get this right. CAD programs, game engines, and animation programs are all far better at positioning things. They have far better layout engines and constraint systems. This is really a constraint problem.…
I guess it's way more complex than HTML rendering already is