Live data from Hacker News

Hardest problem in computer science: centering things

tonsky.me

241–250 of 473 posts

Re: Hardest problem in computer science: centering things

#242

Earlier quoted context omitted.

Yes, and let’s not forget fallback fonts. So rules for each browser and OS and each font class and each layout (desktop, tablet, mobile). Probably on the order of 100 rules for a single style. Yeah, we’re just being lazy. We need sane font rendering in browsers that treat things like alignment in a way that we’d expect for the 99% case. If I say “center” it should just fucking center.

Fallback fonts are a legacy of the past though, in an era where everybody ships at least hundred of kilobytes of JS and images (when it's not tens of megabytes, but this is another topic…) there's no good reason to specify a font and hope it will be found on the customer's OS: ship the font you're using.

Depends on who you want to be able to access your site. Not everyone had 10Mbps+

Re: Hardest problem in computer science: centering things

#243

Earlier quoted context omitted.

I've heard this described as inherent complexity versus accidental complexity. Inherent complexity (due to difficult real-world constraints) is fine. Accidental complexity, like that caused by overcomplicated tools or architectural decisions, just feels bad.

Why do I enjoy writing shell scripts then?

That is another axis around quick feedback loops. A shell script comes with a repl you don’t even need to invoke!

Re: Hardest problem in computer science: centering things

#244
post #72

That'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.…

Man... whole generations just straight up either do not realize, or have forgotten that early CSS revolved around creating documents, not apps, and that all of those design paradigms originated from typesetting. In the same way that one would float a figure to the left or right of lines of a paragraph, `float: left;` and `float: right;` allowed you to do the same. Open a textbook and look at lines of a paragraph flow…

Honestly, that itself sounds bad too. The concept of floating sounds like something invented back during manual typesetting or earlier.

I think anyone ever trying to write a paper or book with images in it using tools like LaTeX knows how bad it is to let the tool position images for you. It's always wrong, and one of the first things you learn is how to pin the image in between the text lines/paragraphs you wanted it to be between.

Text-to-diagram tools like PlantUML (and arguably even Graphviz) make this mistake too. The moment you put more than a couple things in your diagram, you discover that auto-layout can't ever make the result readable, and you look for ways to pin parts of the diagram relative to other parts; something these tools don't let you do either.

And then all three classes of tools here - HTML, typesetting, diagramming - violate the principle of least surprise in the nastiest of way: make one little change, add a letter or word somewhere, suddenly the result looks nothing like it was before, as the auto-layouting flips everything around.

Re: Hardest problem in computer science: centering things

#245

I agree partially, but I also noticed on some projects that not everything looks better when absolutely centered. Sometimes something is centered but looks weird. You nudge it a bit off center and looks perfect.

That's called optical alignment. He somewhat mentions that with the Apple logo example.

Re: Hardest problem in computer science: centering things

#248
post #98

Don't read this article, if you are not in web dev. Once you start seeing it, you can't stop seeing it, and it will drive you crazy forever. It is the same for noticing misalignment, recognizing color oversaturation, high quality speakers/headphones, etc. (It is a good article!)

The same happens when you: - Install flooring - Install trim in your own home - Build / install cabinets You will now see: - Odd flooring patterns and uneven floors - Know what it looks like when trim isn't coped - Uneven gaps between doors

I haven't built/done any of these and yet notice misalignments and it drives me nuts. Hundreds of thousands of dollars (equivalent in INR) spent to on buildings and they don't bother to align bricks; it's as if there's no value in aesthetics, visual beauty, symmetry etc.,

/rant

Re: Hardest problem in computer science: centering things

#249
post #106

Earlier quoted context omitted.

When people say not to use tables they mean for layout of the entire page

> they mean They shouldn't had mean , they should had said that. Because 99% of time we have a bunch of in assortments of representing a tabular data. Dozens of "web" "front-end" "frameworks" doesn't help it in any way, too.

Yes, table for layout and table for tabular data is different things. This was usually very clear in advices. Don't use for layout. DO use for tables.

Re: Hardest problem in computer science: centering things

#250
post #187

Earlier quoted context omitted.

But that is the fundamental problem behind all of web nowadays: It was initially designed for documents ; there are precursors for this entire HTML stuff (hypercards and similar things). Funnily enough, there existed tech even back then that was much much better at dealing with actual applications and their requirements. Unfortunately, many stupid idiots decided to use the "web" for that instead and mangle something…

You reference HyperCard as if it was only a document creation system; it was not. People have been building applications in HyperCard from the start. https://hypercard.org

Yes, that was not intended as such. Thanks!
Post reply on HN