Skip to content
DevMeme
4381 of 7590
Frontend Post #4794 · source on Telegram

Proving CSS is OOP: encapsulation, inheritance, abstraction and polymorphism, fight me

Description

Vertical eight-panel comic on cyan background. Panel 1 shows an expressionless NPC head saying, “CSS is not a programming language.” Panel 2’s round, enthusiastic character replies, “Of course it is! What are the main concepts of OOP?” Subsequent pairs of panels show code snippets beside the excited character explaining each OOP concept with CSS: 1) encapsulation - “.myClass { /* encapsulated! */ color: red; font-weight: bold; margin: 3rem; }”; 2) inheritance - “.red { /* color is inherited! */ color: red; } <div class="red"> this is red <div>…this too!</div></div>”; 3) abstraction - “<button class="btn"> styled button </button> .btn { ?????? }”; 4) polymorphism - “<article class="awesome"> awesome article </article> <section class="awesome"> awesome section </section> .awesome { … }”. In the sixth frame the cheerful character triumphantly states, “CSS is not only a programming language, it is an object-oriented programming language.” The final two frames show the NPC staring blankly, speechless. The meme humorously reframes front-end styling rules using classical OOP terminology, sparking the perennial debate about whether CSS counts as a real language

Comments

34
Anonymous ★ Top Pick CSS nails OOP: encapsulate hacks in .legacy, inherit 15 years of !important, abstract layout sins behind .btn, then watch each browser polymorph it into its own pixel math - front-end’s take on eventual consistency
  1. Anonymous ★ Top Pick

    CSS nails OOP: encapsulate hacks in .legacy, inherit 15 years of !important, abstract layout sins behind .btn, then watch each browser polymorph it into its own pixel math - front-end’s take on eventual consistency

  2. Anonymous

    After 15 years of arguing whether CSS is Turing-complete, we've finally achieved something more impressive: making senior engineers question if their entire mental model of programming paradigms needs a !important override

  3. Anonymous

    Ah yes, the classic 'CSS isn't a programming language' debate - until someone maps OOP principles onto it and suddenly your `.btn` class is exhibiting polymorphic behavior across semantic HTML elements. Next thing you know, you're explaining to stakeholders why refactoring the cascade is actually technical debt mitigation, and your CSS architecture document references SOLID principles. The real abstraction here? Convincing yourself that `!important` isn't just a global variable in disguise

  4. Anonymous

    CSS is OOP: cascade as multiple inheritance, specificity as the diamond-resolution algorithm, and !important as the global mutable state we rebrand as a pattern

  5. Anonymous

    If CSS is OOP, specificity is multiple inheritance and !important is the global variable your architect warned you about

  6. Anonymous

    C++ lifers spotting Python: 'Managed memory? That's not programming, that's delegation to the GC mafia.'

  7. @tohir_ahmad 4y

    Already uploaded

  8. @mnik01 4y

    бред

    1. @sylfn 4y

      please use English in this chat

    2. @mnik01 4y

      complete nonsense

  9. @mnik01 4y

    why

    1. @sylfn 4y

      https://t.me/dev_meme/3667 rules

      1. dev_meme 4y

        *documentation*

        1. @sylfn 4y

          should be read at lest once before coding

    2. @feedable 4y

      that's what the rules are

  10. @dmitry_polshakov 4y

    Closing as a duplicate of the previous post

  11. @ygerlach 4y

    Also, i disagree with the post. being a progrming langue is more than how properties propagate through objects.

  12. @poniraq 4y

    nope

  13. @nohat01 4y

    Okay lmao

  14. @sashakity 4y

    they proved its object oriented but not that its a programming language

    1. @azizhakberdiev 4y

      What does define whether it is programming language?

      1. @sashakity 4y

        if its a list of instructions for a computer to sequentially execute

        1. @sashakity 4y

          css is merely a configuration format like json or yaml

        2. Deleted Account 4y

          haskell?

  15. @nohat01 4y

    Bullshit, a programming language is a language that is able to satisfy any algorithmic form, I studied this last year in cs engineering program, css can't satisfy any algorithmic form, except, :not

  16. @amadare42 4y

    css IS programming language. Not general-purpose one though. You don't actually need language to be Turing-complete to be considered programming language. It very well fit to "declarative programming language" definition. Another example is xml. It is just data structure and cannot be considered programming language. But then you can use XSLT on top of that that not only Turing-complete but also debuggable with breakpoits and all. CSS is object-oriented programming language. That doesn't mean that you want/can implement algorithms in it.

    1. dev_meme 4y

      You can implement algorithms with it, though

    2. @azizhakberdiev 4y

      CSS even has timeouts, global and local scope variables

      1. @RiedleroD 4y

        what? it hasn't got timeouts. And scoping is cascading, just like the styles.

        1. @azizhakberdiev 4y

          transition property is that timeout

          1. @RiedleroD 4y

            it's an asynchronous timeout, yes, but you can't use it for control flow since you can't react to anything set in CSS from CSS besides variables, which can't use values from outside CSS

            1. @azizhakberdiev 4y

              js also has not syncronous timeout, but there are ways to imitate syncronous timeout using special syntax. It could be done in css, but I dont know how

    3. @lab0rat 4y

      But I fully support that message

    4. Deleted Account 4y

      I think CSS is a domain-specific language.

Use J and K for navigation