[Lift] Re: Sitemap and mapper dependency's effects on object reuse

2009-08-19 Thread David Pollak
Glenn,

Lemme see if I can put together some abstractions that might help out.

Thanks,

David

On Tue, Aug 18, 2009 at 4:58 PM, glenn gl...@exmbly.com wrote:


 I'm looking for some answers on best coding practices, particularly
 when it comes to object reuse.

 In a data-centric application, where the Sitemap is used to navigate
 through your mapper entities, has anyone given much thought to the
 object dependencies this can create.

 In the case of page specific rendering with SiteMap, for example,
 where should the Menu entries go - in their own
 object, or should they stay with the MetaMappers. And what about the
 templates, which can have dependencies on snippets, which reside
 elsewhere.

 In other words, it seems to me that good design requires managing the
 chain of dependencies that an ordinary Menu entry may require. A
 consistent approach is always best, and I admit that I don't have one
 at present.


 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://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 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
-~--~~~~--~~--~--~---



[Lift] Re: Sitemap and mapper dependency's effects on object reuse

2009-08-19 Thread glenn

David,

Sounds like you know where I'm coming from on this.

What got me was an attempt to write a Menu Loc for listing
all registered users on the site. The Template for this contains
a lift tag for a snippet in another class. I don't necessarily object
to the dependency on a snippet class, but this does lead to reuse
problems for my User MetaMapper.

/**
   * The menu item for listing all users
   */
  def listUsersMenuLoc: Box[Menu] = {
Full(Menu(Loc(listUsers, listUsers :: Nil, S.??(List
Users),
  listUsers, testLogginIn)))
  }

 def listUsers = Template({ () =
  lift:surround with=default at=content
   h3Site Users/h3
div id=entryform
  table
tr
thFirst Name/th
thLast Name/th
thEmail/th
thRoles/th
th/th
th/th
/tr
lift:ManageUsers.list
user:entry
  tr
tduser:firstname //td
tduser:lastname //td
tduser:email //td
tduser:roles//td
tduser:actions//td
  /tr
/user:entry
/lift:ManageUsers.list
  /table
  /div
hr /
  div id=user-edit/
/lift:surround
  })

On Aug 19, 3:08 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Glenn,

 Lemme see if I can put together some abstractions that might help out.

 Thanks,

 David



 On Tue, Aug 18, 2009 at 4:58 PM, glenn gl...@exmbly.com wrote:

  I'm looking for some answers on best coding practices, particularly
  when it comes to object reuse.

  In a data-centric application, where the Sitemap is used to navigate
  through your mapper entities, has anyone given much thought to the
  object dependencies this can create.

  In the case of page specific rendering with SiteMap, for example,
  where should the Menu entries go - in their own
  object, or should they stay with the MetaMappers. And what about the
  templates, which can have dependencies on snippets, which reside
  elsewhere.

  In other words, it seems to me that good design requires managing the
  chain of dependencies that an ordinary Menu entry may require. A
  consistent approach is always best, and I admit that I don't have one
  at present.

 --
 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 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
-~--~~~~--~~--~--~---



[Lift] Re: Sitemap and mapper dependency's effects on object reuse

2009-08-19 Thread glenn

Complicating matters a bit, I decided to use the new
ModelSnippet, which extends StatefulSniippet for my
snippet class, so I'm not sure the Template can be
refactored to not use it.

Glenn...

On Aug 19, 4:42 pm, glenn gl...@exmbly.com wrote:
 David,

 Sounds like you know where I'm coming from on this.

 What got me was an attempt to write a Menu Loc for listing
 all registered users on the site. The Template for this contains
 a lift tag for a snippet in another class. I don't necessarily object
 to the dependency on a snippet class, but this does lead to reuse
 problems for my User MetaMapper.

 /**
    * The menu item for listing all users
    */
   def listUsersMenuLoc: Box[Menu] = {
     Full(Menu(Loc(listUsers, listUsers :: Nil, S.??(List
 Users),
                   listUsers, testLogginIn)))
   }

  def listUsers = Template({ () =
   lift:surround with=default at=content
    h3Site Users/h3
     div id=entryform
       table
         tr
                 thFirst Name/th
                 thLast Name/th
                 thEmail/th
                 thRoles/th
                 th/th
                 th/th
         /tr
         lift:ManageUsers.list
         user:entry
               tr
                 tduser:firstname //td
                 tduser:lastname //td
                 tduser:email //td
                 tduser:roles//td
                 tduser:actions//td
               /tr
         /user:entry
         /lift:ManageUsers.list
       /table
       /div
     hr /
       div id=user-edit/
 /lift:surround
   })

 On Aug 19, 3:08 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:

  Glenn,

  Lemme see if I can put together some abstractions that might help out.

  Thanks,

  David

  On Tue, Aug 18, 2009 at 4:58 PM, glenn gl...@exmbly.com wrote:

   I'm looking for some answers on best coding practices, particularly
   when it comes to object reuse.

   In a data-centric application, where the Sitemap is used to navigate
   through your mapper entities, has anyone given much thought to the
   object dependencies this can create.

   In the case of page specific rendering with SiteMap, for example,
   where should the Menu entries go - in their own
   object, or should they stay with the MetaMappers. And what about the
   templates, which can have dependencies on snippets, which reside
   elsewhere.

   In other words, it seems to me that good design requires managing the
   chain of dependencies that an ordinary Menu entry may require. A
   consistent approach is always best, and I admit that I don't have one
   at present.

  --
  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 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
-~--~~~~--~~--~--~---