DEV Community

Discussion on: So, how many of you respect CSS as a programming language?

Collapse
 
iamschulz profile image
Daniel Schulz

This is such a tired discussion.

CSS is a programming in every sense of the word. You can write programs in CSS.

  • Going for Turing completeness? Here you go: eli.fox-epste.in/rule110-full.html
  • Algorithms? You have things like Grid, Flex, Float, etc.
  • Logical operators? That's media queries and pseudo selectors for you.
  • Loops? Try :nth-of-type(2n)
  • Variables? --try: nice;
  • CSS only Games? Sure
  • Trying to tell me that CSS isn't a programming language, because it relies on HTML? That's a moot point. Javascript relies on a browser or node in exactly the same way.

CSS is a declarative programming language. Keith Grant wrote about that in 2018. It's a different paradigm than the likes of Javascript, PHP and co, thus often misunderstood. It's a programming language nonetheless. CSS developers are programmers and deserve to be acknowledged as such.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

What I find so annoying about this debate is that one side desperately wants to call CSS a "programming" language so people who only do CSS can still be "programmers", while the other side wants it to not be programming, so they can keep the club more exclusive.

Both positions are extremely stupid because, at the end of the day, whether or not the label applies won't change the language, nor the skill you need to master it.

I think the debate should be "Can we compare CSS with Programming?". And I'd say yes; being really good at CSS isn't worth less than being really good at programming. For both you need to be smart, to have a good mental model of the internal logic of the language, to put in the effort to learn the tools and best practices, etc. etc. etc.

Collapse
 
ajxn profile image
Anders Jackson

Amen.

This is why the will to define CSS as a programming language or not is moot in this context.

People that code in CSS should be respected for the work they do solving problems. That isn't more or less important for the final sollution.

People should be respected as Long as they are good with what they do.

So yes, if CSS or HTML is programming languages should not matter if you and your work should be respected.

I do have much more respect of a good CSS coder then a bad Java programmer.

Collapse
 
sshine profile image
Simon Shine

There is actually a reasonable angle to "CSS is not programming":

  • It is a declarative, domain-specific language
  • It is Turing-complete
  • That technically makes it a programming language, much like Minecraft then becomes a programming language because Redstone is Turing-complete.
  • The intent of CSS can be discussed, but uncontroversially: It is a styling language, like HTML is a markup language. Those are domains with supposed, intended limitations that got fuzzy over time.

The idea that a language isn't a programming language is not intended as degrading towards those who know it. It is intended to scope off the intent and purpose. A limited purpose makes a language more powerful for specificaly that purpose. Being general-purpose is not the holy grail of all languages. Most of my favorite languages have extremely limited scope: jq, regex, sql.

If you can write a 3D game in CSS, or an infinite loop in PCRE in spite of real regular expressions always being representable as finite automata, power to you. I hope it never reaches production. ;-)