Live data from Hacker News

Hardest problem in computer science: centering things

tonsky.me

181–190 of 473 posts

Re: Hardest problem in computer science: centering things

#181
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

Tiles. There is a correct way to install them. I don’t know how you decide what’s correct, but sometimes it’s centred, sometimes a full one on the left, or the right.

Then you have the same scenario but top to bottom.

Re: Hardest problem in computer science: centering things

#182
post #73

If 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…

> Meanwhile, more than one web developer has communicated to me in private that they hate CSS and barely understand it after years of using it professionally to make money 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 wou…

JavaFX uses a dialect of CSS so that's not necessarily a great example. It's also somewhat simplified compared to normal CSS, for example, the way layout works is more normal for GUIs (containers that implement different constraint systems). For things like theming your UI it works pretty well.

I've done web CSS and JavaFX CSS and for app GUI I'd much rather use the latter. For nicely styled documents with good typography on the other hand, web CSS is going to be better.

JavaFX also scores points for having a binary form of CSS that can be loaded and parsed much faster.

CSS as a language is bloody awful of course. The prevalence of dialects that compile down to it is always a giveaway that the language didn't keep pace with people's needs.

Re: Hardest problem in computer science: centering things

#183
post #126

Earlier quoted context omitted.

I’m not entirely sure I agree with you on this. It’s hard for me to say because I really like the imperfections in things I build, for the most part. Like I’ll full spartle a wall (not entirely sure if this is the correct English description) and I’ll intentionally leave the finish less than “perfect” because I think it adds a little soul to it that will make me happy down the years. Then you have things like floorin…

> You’re not going to ever build a perfect floor if you build it all the way to the wall. So what you do is that you leave a gap between the wall and the floor and you cover that gap up with wooden “footlists” (again not sure if that’s the correct English description). This gives you a “perfect” floor which aligns with everything in the room. Here in the US, it's called “baseboard”: https://www.google.com/images?q=ba…

It’s ‘skirting’ here in NZ.

Re: Hardest problem in computer science: centering things

#184
post #156
post #109

Earlier quoted context omitted.

I don’t think it was that tables were bad. They were too formulaic and too strict and it was hard to do something that would stand out. With CSS it wasn’t dumping problem on the others, it was giving the freedom. Problem with freedom is that it is never free and you also have to fix additional problems that come with it.

The problem I see with using tables for layout is that it fucks up the semantic meaning of the html file. But that was an issue of philosophy that got trumped by practical needs. However, nowadays we have css grids with template areas. So we can just write our HTML semantically correct as if it was more or less just about the content (as it should be IMHO) and still move things around using CSS depending on the type…

> But that was an issue of philosophy that got trumped by practical needs

Also very real issues like accessibility.

Re: Hardest problem in computer science: centering things

#185

Earlier quoted context omitted.

> You’re not going to ever build a perfect floor if you build it all the way to the wall. So what you do is that you leave a gap between the wall and the floor and you cover that gap up with wooden “footlists” (again not sure if that’s the correct English description). This gives you a “perfect” floor which aligns with everything in the room. Here in the US, it's called “baseboard”: https://www.google.com/images?q=ba…

It’s ‘skirting’ here in NZ.

Ditto here in NZ's West Island (Australia).

Re: Hardest problem in computer science: centering things

#186
post #119

Earlier quoted context omitted.

Jup. Somw people like to think centering things is taking the bounding box of the visible pixel and centering the center of the bounding box. But some letters have more pixels in one half or the other, so that would leave you with more whitespace one one or the other side. That means despite being metrically centered it still doesn't look optically centered. I guess one could devise algorithms for that, but I haven't…

> Somw people like to think centering things is taking the bounding box of the visible pixel and centering the center of the bounding box. That was my naive understanding for probably my first year at the uni. It got cleared up fairly quickly. I imagine there can be typesetting/layout styles where this holds, but I would classify them as niche (maybe brutalism or something like that). Funnily enough, in the very firs…

This vertical centering of text in buttons is more noticeable when there is an icon next to it. But it drives me crazy that the default is not to center around the cap and baseline. This is what I usually see in figma designs and it looks the best, but it's not simple to apply in html & css.

Re: Hardest problem in computer science: centering things

#187

Earlier quoted context omitted.

Everyone realises that. They just understand that it is a big problem with CSS. People wanted app-like layouts since before CSS was a thing. The problem is the people who designed CSS had an ideological axe to grind. They believed that HTML should only be used for document layout.

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

Re: Hardest problem in computer science: centering things

#188

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!)

Obligatory Rick and Morty reference https://www.youtube.com/watch?v=fQoRfieZJxI

Re: Hardest problem in computer science: centering things

#190
post #28

Earlier quoted context omitted.

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.

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?
Post reply on HN