Settings

Theme

Write Less JavaScript

avandamiri.com

5 points by avand 11 years ago · 5 comments

Reader

jay_kyburz 11 years ago

    Defer view logic to CSS whenever possible.
    Keep data in the HTML.
Ugg, hate the idea of having logic in my CSS. CSS is for style information. How things should look, not what should be shown. "whenever possible" also rings alarm bells for me. There should be one place for logic.

HTML is also View if you ask me and I like to keep my Model separate from my View.

I dont know what people have against JavaScript. I say write more javaScript and less HTML and CSS.

  • na85 11 years ago

    This made me angry. Why does this page need any JavaScript whatsoever? Why doesn't it just use a plain ol' HTML form and some CSS?

    I've been trying to come up with a benefit to the user for having javascript on the page and am drawing a blank.

    >I dont know what people have against JavaScript

    It's the PHP of this generation of web developers. A bunch of guys with inflated egos cramming tens of kilobytes of js into pages that need zero, all for a worse UX.

    • breakingcups 11 years ago

      Not having to refresh the page with each click?

      It's disruptive, slower and more expensive to submit the form through HTML, the rest of the page (you can see a snippet in the video) needs to be built again, which means more database queries which are not needed. Furthermore, the rest of the form does not depend on the first answer. There's really no reason to completely rebuild the page again. That's the benefit.

      I do agree with you that Javascript is fundamentally just as flawed a language as PHP and it attracts the same kind of developers. Some really talented ones, mostly mediocre ones.

      When I have to use Javascript I feel like I'm working against the language instead of with it.

    • markuz 11 years ago

      > A bunch of guys with inflated egos cramming tens of kilobytes of js into pages that need zero, all for a worse UX.

      LOL

      Yeah because that 14.4K modem is a huge problem. In a time of retina display, 500K is not an issue at all. Lets talk about micro optimization ...

      > Why doesn't it just use a plain ol' HTML form and some CSS?

      Have you heard the performance of using React and famo.us ?

markuz 11 years ago

This is wrong in so many levels. Have you ever heard about React and the advantage of the virtual DOM. And about famo.us

For toy projects like this, I guess this is fine. But lets get real....

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection