Hacker News new | past | comments | ask | show | jobs | submit login

Well, JS is turing-complete and that's both a blessing and a curse. It's a blessing because you can do "anything", but it's a curse because unconstrained code is opaque. It's very hard to do stuff like extracting the semantics (what you meant to express when you wrote the code) out of JS and doing things like transformations without an unreasonable amount of work.

I think it's better to express as much as you can in a more "constrained" language like HTML or CSS because it's more like data than code, so it offers less opportunities to make a big mess of spaghetti code and having obscure interactions in the code. It's easier to reason about. HTML and CSS, being declarative, are much easier and cleaner to deal with than JS (it's more WYSIWYG).

So I guess what I'm saying is, coding in a style that avoids JS as much as possible is beneficial, and that style facilitates graceful degradation. Conversely, keeping an eye on graceful degradation will facilitate a better style.




Thanks for explaining. Now I'm sure I disagree. :)

I'm partly kidding. I might use that design style under some circumstances. I disagree that it's the right way to do things. There are many ways to do things. I think people want a "right" way because they want to feel like they've got stuff figured out. (This is especially common in our world because software is complex and there's a lot of uncertainty around how to do it well.)

As it happens, the app I'm currently working on is as far away from this design style as you can get. We do almost everything in JS, even things that could easily be done in HTML and CSS. Our way of carving things up relies heavily on expressing everything in a single language, and the Turing-completeness of said language is an advantage not a disadvantage. It's a solution I'm fond of because it neatly combines high-level abstraction at the source level with some stringent performance requirements in the browser. It will also be fun to watch the purists turn green when they see it.

Edit: we do almost everything in generated JS. Might be relevant.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: