You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@esme.apache.org by Richard Hirsch <hi...@gmail.com> on 2009/10/11 11:05:06 UTC
Code Harmonization
I've just created a few JIRA items dealing with harmonization for our
main objects (users, tags/words, etc). We already have one set for
messages (comet-based with the display_mesages.js) but it isn't yet
used overall (like conversations). The idea is that we have a few
common code blocks for this stuff - which eases up bug-hunting, etc.
It also means that we can have better re-use. I don't know scala /
lift well-enough but ideally, for example, there would be some sort
of base implementation for users and then based on different queries
(followers, total users, users in a particular conversation, etc.),
the results could be easily displayed.
D.
Re: Code Harmonization
Posted by David Pollak <fe...@gmail.com>.
On Thu, Oct 15, 2009 at 1:25 AM, Richard Hirsch <hi...@gmail.com>wrote:
> The question is how difficult would it be to convert the other pages
> to using the same mechanism. Examples in Scala are already present -
> same with the Javascript and the HTML templates
>
The recently added lift-json library does an excellent job of bi-directional
JSON conversion of Scala case classes. It might be worth defining every
message that needs to get sent to/from the browser as a case class and use
this library to serialize.
>
> On Thu, Oct 15, 2009 at 9:25 AM, Vassil Dichev <vd...@apache.org> wrote:
> >> I'd like to see a JSON object being created in scala and then passed
> >> to the UI where a javascript tries to paste into a html template that
> >> determines via class refs how the data appears to the user. Scala
> >> deals with data and the UI with presentation. A clean division of
> >> labor that would also allow users to create new UIs (mobile?) without
> >> touching the scala code base.
> >
> > Yes, that's how it's done for the user timeline (arguably the most
> > important piece), but not for all the others. For the short term the
> > least complicated path is probably to stick to Lift binding to the
> > template.
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
Re: Code Harmonization
Posted by Richard Hirsch <hi...@gmail.com>.
The question is how difficult would it be to convert the other pages
to using the same mechanism. Examples in Scala are already present -
same with the Javascript and the HTML templates
On Thu, Oct 15, 2009 at 9:25 AM, Vassil Dichev <vd...@apache.org> wrote:
>> I'd like to see a JSON object being created in scala and then passed
>> to the UI where a javascript tries to paste into a html template that
>> determines via class refs how the data appears to the user. Scala
>> deals with data and the UI with presentation. A clean division of
>> labor that would also allow users to create new UIs (mobile?) without
>> touching the scala code base.
>
> Yes, that's how it's done for the user timeline (arguably the most
> important piece), but not for all the others. For the short term the
> least complicated path is probably to stick to Lift binding to the
> template.
>
Re: Code Harmonization
Posted by Vassil Dichev <vd...@apache.org>.
> I'd like to see a JSON object being created in scala and then passed
> to the UI where a javascript tries to paste into a html template that
> determines via class refs how the data appears to the user. Scala
> deals with data and the UI with presentation. A clean division of
> labor that would also allow users to create new UIs (mobile?) without
> touching the scala code base.
Yes, that's how it's done for the user timeline (arguably the most
important piece), but not for all the others. For the short term the
least complicated path is probably to stick to Lift binding to the
template.
Re: Code Harmonization
Posted by Richard Hirsch <hi...@gmail.com>.
I'd like to see a JSON object being created in scala and then passed
to the UI where a javascript tries to paste into a html template that
determines via class refs how the data appears to the user. Scala
deals with data and the UI with presentation. A clean division of
labor that would also allow users to create new UIs (mobile?) without
touching the scala code base.
D.
On Thu, Oct 15, 2009 at 8:45 AM, Vassil Dichev <vd...@apache.org> wrote:
>> I've just created a few JIRA items dealing with harmonization for our
>> main objects (users, tags/words, etc). We already have one set for
>> messages (comet-based with the display_mesages.js) but it isn't yet
>> used overall (like conversations). The idea is that we have a few
>> common code blocks for this stuff - which eases up bug-hunting, etc.
>>
>> It also means that we can have better re-use. I don't know scala /
>> lift well-enough but ideally, for example, there would be some sort
>> of base implementation for users and then based on different queries
>> (followers, total users, users in a particular conversation, etc.),
>> the results could be easily displayed.
>
> Dick, that's a really good idea. In the past, we've used
> MsgFormat.scala, which is now obsolete (and recently deleted from
> svn). The disadvantage is that it deals with layout in scala code,
> which we try to avoid. There must be a way to define one or two
> templates for how a message should look in markup and reuse that
> (maybe one full and one minimal layout).
>
> Another problem in consistent message layout is that there are two
> distinct ways we deal with messages- one is from Scala code, and one
> is from JavaScript (for real-time updates of the timeline), so the
> message goes through different paths before being rendered. Not sure
> how we can solve this problem, but at least for all the Lift-based (as
> opposed to jQuery-based) code we should try.
>
Re: Code Harmonization
Posted by Vassil Dichev <vd...@apache.org>.
> I've just created a few JIRA items dealing with harmonization for our
> main objects (users, tags/words, etc). We already have one set for
> messages (comet-based with the display_mesages.js) but it isn't yet
> used overall (like conversations). The idea is that we have a few
> common code blocks for this stuff - which eases up bug-hunting, etc.
>
> It also means that we can have better re-use. I don't know scala /
> lift well-enough but ideally, for example, there would be some sort
> of base implementation for users and then based on different queries
> (followers, total users, users in a particular conversation, etc.),
> the results could be easily displayed.
Dick, that's a really good idea. In the past, we've used
MsgFormat.scala, which is now obsolete (and recently deleted from
svn). The disadvantage is that it deals with layout in scala code,
which we try to avoid. There must be a way to define one or two
templates for how a message should look in markup and reuse that
(maybe one full and one minimal layout).
Another problem in consistent message layout is that there are two
distinct ways we deal with messages- one is from Scala code, and one
is from JavaScript (for real-time updates of the timeline), so the
message goes through different paths before being rendered. Not sure
how we can solve this problem, but at least for all the Lift-based (as
opposed to jQuery-based) code we should try.