On Dec 22, 2010, at 6:05 PM, Marnen Laibow-Koser wrote: > Please quote when replying. > > Matteo Latini wrote in post #969994: >> On Dec 21, 2010, at 10:03 PM, Marnen Laibow-Koser wrote: >> >>> >> What do you exactly mean by dynamic... > > By "dynamic JavaScript", I mean JavaScript generated on the fly with RJS > or ERb rather than an unchanging static .js file. > >> Can you provide some examples >> in which having dynamic JS can lead to design/development issues? > > I think the use of dynamic JS complicates things needlessly. It also > prevents the client from caching the JS file. In general, source code > (behavior) should be static and data should be dynamic. This is true on > the server side and I believe it's also true on the client side. > > Dynamic code is also harder to test and debug. > >> >> Would you classify JSON as dynamic? In some way, json is just >> like javascript variables. > > I would classify JSON as data. Since data can be dynamic, I think it is > entirely appropriate for an Ajax request (or whatever) to return dynamic > JSON, HTML, XML, CSV, or whatever. Usually this would then be processed > by a static JavaScript file. > > Again, my principle is: dynamic data, static source code/behavior. > Rails' dynamic JS crams the data in with the source code, where it > really doesn't belong. You wouldn't do that in Ruby; don't do it in JS.
Ruby is actually NOT like that... Actually everything we love about rails is thanks to dynamic code... >> >> Also, what do you mean by hidden div? > > A div with display: none in its style. > >> Do you mean you just jam >> the data in it or use it for html templating? > > I don't understand what you're asking. Do you use html/js templating, or the hidden div is filled with data? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > mar...@marnen.org > > Sent from my iPhone > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.