あなたは単独のコメントのスレッドを見ています。

残りのコメントをみる →

[–]bkv 44 ポイント45 ポイント  (32子コメント)

You either have expressions in your markup, or markup in your code. I'll take the former as it's a far better separation of concerns. If your expressions become too complicated, it's an indication that the logic needs into its own method in the controller, and then your complex expression becomes a simple method call.

stop trying to crowbar non-standard binding expressions into it.

What's non-standard about putting arbitrary expressions into data-* attribute? HTML5 introduced data attributes specifically for this kind of extensibility.

[–]serpent 10 ポイント11 ポイント  (31子コメント)

You either have expressions in your markup, or markup in your code.

False dichotomy. You can have logic that generates a data structure, and a simple translation from that data structure to markup, separating concerns even better than putting expressions in your markup.

[–]sphinx80 26 ポイント27 ポイント  (8子コメント)

A.K.A markup in your code.

[–]danredux 0 ポイント1 ポイント  (3子コメント)

But full separation of concerns. HTML for pre-generated content, a JS middle-man for converting data to dynamically generated HTML, and JS for logic. That's 3 clear sections, each with their own space. IMO, this beats mixing dynamic and static HTML together.

[–]Rezistik 2 ポイント3 ポイント  (2子コメント)

Isn't that what these templating libraries do? Create a JS middleman for the dynamic and static html?

[–]danredux 1 ポイント2 ポイント  (1子コメント)

Yes, a middleman that forces you to mix your static and dynamic HTML. It would be better if they remained separate.

[–]Rezistik -1 ポイント0 ポイント  (0子コメント)

Are we talking about working with documents, or programs? Because when working with programs I think Angular/Ember MVVM system works amazingly.

I guess my question is, what is your alternative?

We have the templating system used by Angular/Ember/Backbone, the progmatic approach seen in ReactJS, then plain old JS or jQuery spaghetti.

Or are you looking for something more similar to programming GUI's for native clients?

Because looking into that...the options seem far far worse. I've only ever done Web Dev so I haven't used any native GUI toolkits but a quick look for the most popular isn't promising.

qT and ruby Shoes for instance both mix the appearance and the logic significantly more.

[–]serpent 0 ポイント1 ポイント  (0子コメント)

Nope, not at all.

[–]makis 0 ポイント1 ポイント  (2子コメント)

nope.
a representation of your markup, or better, a tree representing the data you want to render
when you have a data structure and a renderer that can understand it, you can easily generate HTML5, HTML4, XHTML, XML, Haml, Json, PDF, binary, whatever you want

[–]zoomzoom83 1 ポイント2 ポイント  (1子コメント)

a tree representing the data you want to render

So.... a view-model then?

[–]makis 0 ポイント1 ポイント  (0子コメント)

I'm gonna say something incredible, but you can do it without views and models
model is not data, is that area of the MVC graph that deals with data.
views are only one of the many way of rendering data.

EDIT: I expand a little bit:
when we have a language independent representation of the data, we don't need to embed HTML in the rendering code.
We can generate it through code, using the DOM API, or we could use of the many languages that compile down to javascript, and build a beautiful DSL to actually just translate the data into code that generates HTML.
Looks better to me than abusing of html attributes.