Very good initiative!
Do we really have to use the ugly underscore in the package name lift_module?
Heiko
On Saturday, 8 January 2011, Peter Robinett <pe...@bubblefoundry.com> wrote:
> After some good discussion, both at Scala LiftOff London and here on the mailing list (see Creating a module system for Lift <https://groups.google.com/d/topic/liftweb/GfVqg7hHmYA/discussion> and Locating Templates in Modules <https://groups.google.com/d/topic/liftweb/gIjjKvg4bsI/discussion>), we've got everything we need to create nice reusable modules. Please check out the wiki page <http://www.assembla.com/wiki/show/liftweb/Modules> for more information. I have created a Hello World module <https://github.com/pr1001/HelloWorld> and a Lift app that uses it <https://github.com/pr1001/HelloWorldExampleApp>. Of course, the conventions aren't set in stone (they're just that, conventions), so please suggest rooms for improvement.
> I look forward to the modules you create and perhaps we can soon start thinking about a community site to host them!
> Peter
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
--
Heiko Seeberger
Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Akka - Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through
Actors: akka.io
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Peter Robinett wrote:
> Yes, it is rather ugly, isn't it? First, you can name your package
> anything you want, the convention only cares about the last part.
How important is it to have the convention of last part of the package
same as the module name?
> There isn't any sort of module validator or creator (though I think that would
> be a great addition to something like Lifty or Giter8), so it really is
> just for humans to check, not computers.
Lifty could be a nice candidate I hope. Once we have an existing project
(i.e., project/build.properties exists) giter8's role is pretty much
over. Further, just for safety/convenience do you consider some trait,
say LiftModule, could be useful?
> I seem to remember having
> problems with a domain name with a dash in Maven so I used an underscore
> instead, which I believe is the suggested approach.
I think it's more of Java problem than Maven (java package name cannot
have a dash).
David already has
> lift-tools.org and lift-modules.org (Oops, .org, not .net! I guess I
> should change my example!), so that is why I chose the package name I
> did for my Hello World example.
>
> Peter
>
> On Saturday, January 8, 2011 4:16:19 PM UTC+1, Heiko Seeberger wrote:
>
> Hi,
>
> Very good initiative!
>
> Do we really have to use the ugly underscore in the package name
> lift_module?
>
> Heiko
>
How important is it to have the convention of last part of the package
same as the module name?
Lifty could be a nice candidate I hope. Once we have an existing project
(i.e., project/build.properties exists) giter8's role is pretty much
over. Further, just for safety/convenience do you consider some trait,
say LiftModule, could be useful?
I think it's more of Java problem than Maven (java package name cannot
have a dash).
On Saturday 8 January 2011 at 11:49 PM, Peter Robinett wrote:
Thanks, Indrajit. To answer your questions:
On Saturday, January 8, 2011 7:00:44 PM UTC+1, Indrajit Raychaudhuri wrote:How important is it to have the convention of last part of the package
same as the module name?It's not. However, if you know the package name then you know the name of the object to import and call in Boot, which I think is useful.
Lifty could be a nice candidate I hope. Once we have an existing project
(i.e., project/build.properties exists) giter8's role is pretty much
over. Further, just for safety/convenience do you consider some trait,
say LiftModule, could be useful?Sounds reasonable. A trait could be used but my goal was to put forward the module system with a minimum of changes to Lift. I believe that Lift modules, including their convention, should be managed by the community at large, as the general goal is the lower the barrier to entry. At the same time, I believe structural types could be used to verify a Lift module object is 'valid' (ie has an init method), yes?
I think it's more of Java problem than Maven (java package name cannot
have a dash).Ahh, ok. So are we stuck with the underscore then?
Cheers,Peter
My brain is working slower I think :(
The way I understand is you still need to know the package name (the whole of it) to do an import as thus:import net.lift_modules.HelloWorld.HelloWorldso that you can call:HelloWorld.initHow would have it been different if it was:import net.lift_modules.Universe.HelloWorld
Totally! Would be interesting to see how community convention evolves. Related to this, maybe we could consider aligning Lift's distributed modules along the same convention (in case any divergence shows up, that is).
On Sunday 9 January 2011 at 12:55 AM, Peter Robinett wrote:
On Saturday, January 8, 2011 8:19:24 PM UTC+1, Indrajit Raychaudhuri wrote:My brain is working slower I think :(
The way I understand is you still need to know the package name (the whole of it) to do an import as thus:import net.lift_modules.HelloWorld.HelloWorldso that you can call:HelloWorld.initHow would have it been different if it was:import net.lift_modules.Universe.HelloWorldBecause you only need to know the module's package is net.lift_modules.HelloWorld and you can guess that the object is HelloWorld. If you looked for Universe in net.lift_modules.Universe you'd be disappointed and so the module writer would need to alert module users that, hey, actually the module object is called HelloWorld. My goal, basically, is to reduce the amount of per-module documentation required. This also, I believe, makes future tools easier to write.
This is really a very minor thing, so don't worry if the benefits aren't immediately apparent! And frankly, maybe they just aren't that great.
Totally! Would be interesting to see how community convention evolves. Related to this, maybe we could consider aligning Lift's distributed modules along the same convention (in case any divergence shows up, that is).I think that eventually, as people are willing to maintain them, it makes sense to move the existing modules out of Lift proper. Or, if not move out, at least supersede. For instance, I've been thinking about rewriting the Flot module from scratch as a stand-alone Lift Module.
Hmm, that means I am not supposed to have all related features show up as individual modules under same package hierarchy. So the following aren't legal by convention:
net.lift_modules.Universe.Feature1.initnet.lift_modules.Universe.Feature2.initnet.lift_modules.Universe.Feature3.init
Fantastic! My thoughts behind segregating modules into separate repo (in the other thread) was quite along the lines. Separate repo would mean less impediment to separate governance for modules moving in or out (after IP legalities being taken care of). FWIW, Drupal follows a similar approach I think (core modules vs contrib modules).
On Sunday 9 January 2011 at 3:20 AM, Peter Robinett wrote:
On Saturday, January 8, 2011 9:16:25 PM UTC+1, Indrajit Raychaudhuri wrote:Hmm, that means I am not supposed to have all related features show up as individual modules under same package hierarchy. So the following aren't legal by convention:
net.lift_modules.Universe.Feature1.initnet.lift_modules.Universe.Feature2.initnet.lift_modules.Universe.Feature3.initI'm afraid I hadn't thought of submodules/features at all. I guess you could have something like:net.lift_modules.Universe.Universe.init(Feature1 :: Feature2 :: Nil) // initialize some or all features
Or, individually:net.lift_modules.Universe.Universe.initnet.lift_modules.Universe.Feature1.initnet.lift_modules.Universe.Feature2.initnet.lift_modules.Universe.Feature3.initOr even, if it's some sort of massive module and you want subpackages:net.lift_modules.Universe.Universe.initnet.lift_modules.Universe.Feature1.Feature1.initnet.lift_modules.Universe.Feature2.Feature2.initnet.lift_modules.Universe.Feature3.Feature3.initThough, at that point you might want to just consider making each feature a stand-alone module in itself. There's nothing saying that modules can't depend upon other modules and in fact I hope they do. For instance, I can think of a generic login module which would use one or more of OpenId, Facebook, Twitter, LDAP and other modules to authenticate a user.
Fantastic! My thoughts behind segregating modules into separate repo (in the other thread) was quite along the lines. Separate repo would mean less impediment to separate governance for modules moving in or out (after IP legalities being taken care of). FWIW, Drupal follows a similar approach I think (core modules vs contrib modules).Yes, I think that makes a lot of sense. And, what's nice is that we can do that without affecting the examples at demo.liftweb.net and the testing that David and others use them for. (Though it would be nice to have the various sample apps for the existing lift-modules public somewhere.)
Yes, it is rather ugly, isn't it? First, you can name your package anything you want, the convention only cares about the last part. There isn't any sort of module validator or creator (though I think that would be a great addition to something like Lifty or Giter8), so it really is just for humans to check, not computers. I seem to remember having problems with a domain name with a dash in Maven so I used an underscore instead, which I believe is the suggested approach. David already has lift-tools.org and lift-modules.org (Oops, .org, not .net! I guess I should change my example!), so that is why I chose the package name I did for my Hello World example.
Peter
On Saturday, January 8, 2011 4:16:19 PM UTC+1, Heiko Seeberger wrote:Hi,Very good initiative!
Do we really have to use the ugly underscore in the package name lift_module?
Heiko
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Peter--
After some good discussion, both at Scala LiftOff London and here on the mailing list (see Creating a module system for Lift and Locating Templates in Modules), we've got everything we need to create nice reusable modules. Please check out the wiki page for more information. I have created a Hello World module and a Lift app that uses it. Of course, the conventions aren't set in stone (they're just that, conventions), so please suggest rooms for improvement.I look forward to the modules you create and perhaps we can soon start thinking about a community site to host them!
--Peter
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
A few thoughts:1) Since we're for the most part post-2.7, why not define the convention that the init method should be a member of the package object? No need for a singleton with the same name as the package. Just call net.liftmodules.helloworld.init.
2) Why not recommend that the package name be the name of the module *except in lowercase*, as is the standard in Java and Scala?
3) Minor point -- the wiki page says the init method should return nothing. Perhaps it would be better to say "Unit" explicitly. Even though it's obvious, there is another type called Nothing.
4) Is it possible that it should matter at what point in Boot init is called?Also, re the "lift_modules" name: Why not host the modules at a subdomain of the main lift domain, e.g., modules.liftweb.net?
On Tuesday 11 January 2011 at 7:15 PM, Peter Robinett wrote:
On Monday, January 10, 2011 3:49:56 PM UTC+1, ngug wrote:A few thoughts:1) Since we're for the most part post-2.7, why not define the convention that the init method should be a member of the package object? No need for a singleton with the same name as the package. Just call net.liftmodules.helloworld.init.I hadn't thought about package objects (I didn't know anything about them), but after reading a little bit on them right now they sound like the right tool for the job. What do others think?
2) Why not recommend that the package name be the name of the module *except in lowercase*, as is the standard in Java and Scala?Another good suggestion. Any objections?
3) Minor point -- the wiki page says the init method should return nothing. Perhaps it would be better to say "Unit" explicitly. Even though it's obvious, there is another type called Nothing.You're right. Fixed.4) Is it possible that it should matter at what point in Boot init is called?Also, re the "lift_modules" name: Why not host the modules at a subdomain of the main lift domain, e.g., modules.liftweb.net?My goal is to have a community site like how the Ruby on Rails community has http://www.railsplugins.org/ and http://agilewebdevelopment.com/plugins/ (among others). This both frees us of Lift's (good!) committer rules and provides a little bit of separation for the main Lift project if something less than ideal happens in the wild west of the module world.Peter
--
--
On Tuesday 11 January 2011 at 11:13 PM, Derek Chen-Becker wrote:
IIRC, hyphens aren't allowed in package names because package names follow the rules for Java identifiers (http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8). Interestingly, the DNS spec (http://www.freesoft.org/CIE/RFC/1035/6.htm) disallows underscores and allows hyphens. As a network engineer (and DNS pedant) this little quirk provides no end of frustration/bemusement depending on how my day is going ;)
>> 2) Why not recommend that the package name be the name of the module *except in lowercase*, as is the standard in Java and Scala?
>>
>> Another good suggestion. Any objections?
> Except multi-word module names start looking out of the place after a while. And then people start having widgetlib, widgetlibhtml5, widgetlibhtml5foriphone etc. I am not opposed to this, just that a set of guidelines would help ;)
I haven't been following the discussion closely, but couldn't there be widgetlib, widgetlib.html5 and widgetlib.html5.iphone?
Regards,
--Chris
After some good discussion, both at Scala LiftOff London and here on the mailing list (see Creating a module system for Lift and Locating Templates in Modules), we've got everything we need to create nice reusable modules.
Github supports webhooks which would allow the modules site to automatically download and compile the source whenever a change is pushed. I think that would be pretty neat.rubygems uses a terminal comand to perform the publish. Which approach would be best?
Agreed. I think a Maven repo is a must for Lift modules (I'll even
say any lib on the JVM), not just for enterprise IT departments. All
the build tools in use for Scala are able to read a maven a repo (at
least SBT, Maven & Gradle are :-)
/Jeppe
As Richard mentioned, it'd be great to have a repository to publish modules to.
Richard
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.