Hi!

We have a convenient way of specifying application assembly as -

ApplicationContext application = appFactory.newApplication( new Assembler[][][]
    {
        { // Swing layer
          {
              new ModuleName( "Swing" ),
              new ViewAssembler()
          }
        },
        { // Domain layer
          {
              new ModuleName( "Domain" ),
              new DomainAssembler()
          }
        },
        { // Infrastructure layer
          {
              new ModuleName( "Infrastructure" ),
              new InfrastructureAssembler() }
        }
    } );

For someone new to Qi4j, that can be a bit hard to understand if you
remove the comments.


Would it be good to have an alternative that names the layers more
explicitly, thus removing the need for the comments in the code above?

Something like -
ApplicatonAssembly assembly = new ApplicationAssembly(
        new LayerAssembly( "Swing layer", new ModuleAssembly(
"Module1", assembler1, assembler2 ) ),
        new LayerAssembly( "Domain layer", new ModuleAssembly(
"Module2", assembler3 ) ),
        new LayerAssembly( "Infrastructure", new ModuleAssembly(
"Module3", new InfrastructureAssembler() ) )
)

or, something using a fluent interface, like -

ApplicationAssembly = ...;
assembly.addLayer( "layer1" ).addModule( "module1", assembler1,
assemler2 ).addModule( "module2", assembler3 ).
        addLayer( "layer2" ).addModule( "module3", new MyAssembler() )


Just a thought... :)

Regards,
Sonny

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to