Thanks... Being a hobbyist rather than a professional, my questions will be more conceptual in nature, and may help others learn what I hope to find of the essence of Lift, which includes a little of its java-like heritage, as in the 'static' analogy.
I see Lift as a vehicle with 'legs' for the future, meaning it can scale well and handle almost any type of web app, so I want to concentrate on it fully and master it, and I want my understanding to be rock-solid. Therefore, I'm starting with what I see as the foundation of any app, which is the Model, hence my question, which I see now I understood totally backwards! On May 18, 3:05 pm, David Pollak <[email protected]> wrote: > On Sat, May 16, 2009 at 2:39 PM, g-man <[email protected]> wrote: > > > As I create the Models to define the real-world things of interest to > > my webapp, I'm wondering what to put into either the class or the > > object. Here is some pseudocode as I understand the Model table > > definition pattern: > > > // first comes the class, which defines fields and creates the > > singleton: > > class Thing extends LongKeyedMapper[Thing] with IdPK { > > def getSingleton = Thing > > // define a field... > > object field extends mappedWhatever(this) { > > // and define some constraints and validations for the field... > > } > > // global class methods here plus xml, json, etc output... > > } > > // then the object: > > object Thing extends Thing with LongKeyedMetaMapper[Thing] { > > // define an instance method: > > def instanceMethod() = { > > doSomething > > } > > // more instance methods, etc... > > } > > > My question is: how do I know what kinds of methods and other goodies > > should go into either the class or the object, that is, into each > > 'half' of the Model specification? > > The "object Thing" is a singleton object in your system. It is a good place > for methods associated with the model, but not a particular instance of the > model. If you're a java programmer, this is the place to put methods that > would be static in Java. > > The "class Thing" is an instance that contains one model object. Methods on > the instance should operate on the instance data. > > Hope this helps. > > Thanks, > > David > > > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://www.apress.com/book/view/1430219890 > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
