Tim,

On Wed, Jan 7, 2009 at 11:07 PM, timshawn <tim.sh...@gmail.com> wrote:

>
> Hi there,
>
> I'm currently playing with Lift, and one of the things that surprised
> me was how much Javascript code is in Scala for snippets and bind.


Hmmm... bind() doesn't generate any JavaScript and snippets are typically
ways to insert server-generated code.

Lift does have a lot of helper methods, mostly in SHtml, that do attach
JavaScript to the HTML elements the generate.


>
> I'm not saying this is bad, because I haven't done an app this way
> yet, but I'm more used to writing the JS myself using jQuery or some
> other library.


Except for Lift's Comet support (when you include a CometActor), Lift only
inserts JavaScript into the elements that you explicitly ask it to.  Some
people


>
> I'm wondering if anyone has had more experience working with Lift and
> maintaining an app in it, to say when in their opinion is a good time
> to put things in JS or in Scala snippets, and the advantages and
> disadvantages of putting most of the JS in snippets. (would you mostly
> use it for Ajax callbacks and comet-related stuff, or would you do a
> lot more stuff like hide/unhiding elements, etc. in scala?)


I put any business logic in my Scala code.  If the JavaScript helps express
the business logic, then it it belongs in the Scala or bound very tightly to
the Scala code.  In general, I think of JavaScript as assembly language and
I try to abstract it as much as possible.


>
>
> The one thing I can think of is Scala's type safety, but when for
> example, I accidentally change an HTML node's id and there is a JSCmd
> to trigger behaviour on that, there won't be JS errors, but the
> "right"/expected behaviour won't happen either.


That's why Lift's helpers are useful as they assign the id and tie the
behavior to the generated id.

A number of Lift users (Charles Munat comes to mind) have cloned the Lift
libraries and modified them to suit particular coding styles.  I love
looking at their code (especially Charles') because it helps me find the
best ideas to roll back into Lift.  In this way, the community becomes
involved in the whole Lift growth process. So, please learn some Lift and
add your style into the mix.

Thanks,

David


>
>
> Thanks,
> Tim
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to