DEV Community

Discussion on: Is CSS objectively bad?

Collapse
 
ymiyugy profile image
YmiYugy

My biggest gripe with CSS is that it’s designed as a Markup and not a programming language.
This works good for static webpages, but not the dynamic web applications we have today.
The lack of programmability means that’s some concepts are incredibly awkward to express.
I also don’t lock CSS lack of types. Everything being a box is to simplistic in my opinion.
My last big problem with CSS is the cascading nature. Sure it makes CSS easy to parse but other than that it’s just awful.
As for alternatives I really like Flutters widget approach.
It seems much less complicated and delivers more predictable results.

Collapse
 
stereobooster profile image
stereobooster • Edited

Side note: CSS is a programming language. It is declarative programming language, which makes it out stand from other PLs. I guess you meant to say lack of imperativeness, instead of "the lack of programmability".

Everything being a box is to simplistic in my opinion.

But this what Flutter layout engine does as well, isn't it? Everything is a box with min, max width and heights, but without position.

Collapse
 
ymiyugy profile image
YmiYugy

It’s not about imperativeness.
As far as I know CSS isn’t even Turing complete nor is it isomorphic to a lambda calculus.
But technicalities aside, CSS is incredibly bad at being a declarative language.
Look at the expressiveness functional languages like Elm or Haskell provide and compare that to how incredibly awkward it is to express even simple things in CSS.
In short it’s designed as a markup language not a PL.

Yes internally Flutter uses a box model that is very similar to CSS, but you rarely interact with it directly.
Instead you usually use typed widgets, e.g. a Padding widgets applies padding and an Alignment widget aligns it’s child.
In CSS on the other hand every property can be set on every selector.
For me that’s quite overwhelming.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

As far as I know CSS isn’t even Turing complete nor is it isomorphic to a lambda calculus.

You make it sound as if Turing completeness has something to do with language being programming or not. I don't think this is the case. Typed lambda calculus is not Turing complete. Brainfuck is Turing complete, yet I don't think this is example of good programming language. Actor model can go beyond of what Turing machine can do. There is nothing specific in Turing completeness in terms of modern development (yet this is very important discovery for computer science and logic systems, the same way as Godel incompleteness)

But technicalities aside, CSS is incredibly bad at being a declarative language

The problem here is that term declarative is overloaded and not clearly defined. Where is I mean declarative is when you describe what you want, rather how to achieve it. You refer to pure functional languages as declarative, because in pure declarative languages order of evaluation doesn't matter. Which is fair point, there is no clear definition of this term.

I meant "Descriptive declarative programming" according to this classification.

Thread Thread
 
ymiyugy profile image
YmiYugy

I feel like our discussion has drifted a bit too much into discussing definitions.

Set aside by what definition CSS is a PL or isn't I want to get back to strengthen my argument that CSS is a bad language in a different way.
Rather than looking at the language in isolation I want to look at how it's used and what that tells use about flaws in its design.
In recent years CSS in JavaScript has gained lots of traction despite its obvious drawbacks.
I think the fact that many people choose to rather write CSS generators than CSS is a strong indication that the language is not expressive enough.