SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Magic Box project:
   Effective K.I.S.S. with SpringFramework




                                          http://sourceforge.net/projects/magic-box




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                       Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
The event that host this presentation: Javaday


 Organizzato direttamente dalla collaborazione
 della community Java, gira l'Italia con passione                                                                        2007



                          Javaday è un evento
                            unico nel mondo!


                                                                                                                         2006
                    L' edizione romana è a cura di
                             Jug Roma
                          Java Italian Portal
                       Java Italian Association
Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Requirements for this talk


                                        “We believe not only that J2EE development should be
                                        much simpler than the mixture of drudgery and
                                        complexity it’s often made out to be, but that developing
                                        J2EE applications should be fun”
                                                                                    Rod Johnson
                                                                                               http://www.springframework.org/




                                                              Ralph, Erich, Richard, John at OOPSLA 1994



                                                                                             http://c2.com/cgi/wiki?GangOfFour
                                                                                             http://c2.com/cgi/wiki?DesignPatternsBook

Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Speaker

      Java Architect             *




      Co-fondatore e consigliere

      JugSardegna Onlus                      2003
                                                                                           * plus others bla bla bla bla




      Fondatore e coordinatore:

      SpringFramework Italian User Group                                      2006




      Jetspeed Italian User Group                            2003




      Groovy Italian User Group                            2007



Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Spring Knowledge


  Spring User da Luglio
  2004 (Spring 1.1)

  Primo articolo italiano
  settembre 2004 sul
  JugSardegna.

  Primo corso di
  formazione su Spring
  in Italia maggio 2005
  per la Sistemi
  Informativi a Roma.
Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
MagicBox Project




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
MagicBox Project




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
MagicBox Project




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Ideas behind the presentation




                                                                        http://c2.com/cgi/wiki?SevenPrinciplesOfSoftwareDevelopment

Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Ideas behind the presentation




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
This is not simple




 Don’t worry:
 knowing
 the language
 doesn’t really help.



Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Simplicity vs Complexity


       I actually enjoy complexity that's empowering. If it
       challenges me, the complexity is very pleasant. But
       sometimes I must deal with complexity that's disempowering.
       The effort I invest to understand that complexity is tedious
       work. It doesn't add anything to my abilities.

       What's the Simplest Thing that Could Possibly Work ?

       Simplicity: the Shortest Path to a Solution
                                                                                     Ward Cunningham
                                                                                     http://www.artima.com/intv/simplest.html
Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group          http://c2.com/cgi/wiki?WardCunningham
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Simplicity



                                                               !=
                     Simplicity                                                     Quick and Dirty




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Do the simplest thing



        The most important rule in our development is always to
       do the simplest thing that could possibly work.
       Not the most stupid thing, not something that clearly
       can’t work. But simplicity is the most important
       contributor to the ability to make rapid progress.

                                                                                       Ronald E.Jeffries
                                                                          http://www.xprogramming.com/Practices/PracSimplest.html




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
XP View




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Do the simplest thing that could possibly work !




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Design




                     Nella pianificazione, mai una mossa inutile;
                     nella strategia, nessun passo compiuto invano.


                                                                                                   Sun Tzu
                                                                                                The art of war



Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Interface in MagicBox


 EJ Item 16: Prefer interfaces to abstract classes

                                              For all Objects

                                                      Domain
                                                      Services
                                                       Dao




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Interface Advantage


                                  Switch from one implementation ,
                                   List entries = new java.util.ArrayList();

                                   Map map = new java.util.HashMap();




                                   to another more aggressive
                                   List entries = new javolution.util.FastList();

                                   Map map = new javolution.util.FastHashMap();
Felino micio = new Gatto();




         without affecting the client


                                                                                  Felino micio = new TigerInsideImpl();

Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                        Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Composition


  EJ Item 14: Favor composition over inheritance

              This design is called composition because the existing class becomes
              a component of the new one.
              Each instance method in the new class invokes the corresponding
              method on the contained instance of the existing class and returns the
              results.
              This is known as forwarding, and the methods in the new class are
              known as forwarding methods.




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Composition in Domain Objects


     public final class UtenteImpl implements UtenteView{

           public UtenteImpl (){
                 utenteLight = new UtenteLightImpl();
                 indirizzo = new IndirizzoImpl();
                 recapiti = new RecapitoTelefonicoImpl();
           }
     ...




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Abstractions from a hierarchy



        Inheritance on interfaces

                     public interface UtenteView extends UtenteLightView{
                           ...
                     }




            public interface UtenteLightView extends UtenteUltraLightView{
                  ...
            }



                                public interface UtenteUltraLightView {
                                      ...
                                }




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                      Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Immutability


   Item 13: Favor immutability


   An immutable class is simply a class whose instances cannot be
   modified.
   All of the information contained in each instance is provided
   when it is created and is fixed for the lifetime of the object.

   Immutable classes are easier to design, implement, and use
   than mutable classes. They are less prone to error and are
   more secure

Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Immutability


 Only accessors on public interfaces.                                           public interface UtenteUltraLightView {

                                                                                       public boolean isNew();

                                                                                       public long getId();


 Final implementation class.                                                           public String getNominativo();

                                                                                       public long getIdGruppo();

 All fields private.                                                            }



 No mutable component.

 Mutators accessible only on
 implementation class, for web binding
 and in the Data Mapper Layer                                 public class CentroFormController extends SimpleFormController{

                                                                  public CentroFormController(){
                                                                      setCommandClass(CentroImpl.class);
                                                                      setCommandName(Constant.CENTRO);
                                                                      setFormView(quot;admin/centroFormquot;);
                                                                      setSuccessView(Constant.REDIRECT_ELENCO_CENTRI);
                                                                  }

                                                              ...

                                                              }


Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                      Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Data mapper


   The Data Mapper is a layer of software that separates the in-
   memory objects from the database. Its responsibility is to transfer
   data between the two and also to isolate them from each other.
   With Data Mapper the in-memory objects needn't know even that
   there's a database present; they need no SQL interface code, and
   certainly no knowledge of the database schema. (The database
   schema is always ignorant of the objects that use it.) Since it's a
   form of Mapper (473), Data Mapper itself is even unknown to the
   domain layer.
                                                                        http://martinfowler.com/eaaCatalog/dataMapper.html

Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
iBATIS mapping class - table

      <typeAlias type=quot;org.magicbox.domain.AmministratoreImplquot; alias=quot;adminquot;/>
      <typeAlias type=quot;org.magicbox.domain.AmministratoreLightImplquot; alias=quot;adminLightquot;/>

      <resultMap class=quot;adminLightquot; id=quot;resultAdminLightquot;>
            <result column=quot;idquot; property=quot;idquot; jdbcType=quot;INTEGERquot; />
            <result column=quot;centroquot; property=quot;centroquot; jdbcType=quot;BIGINTquot; />
            <result column=quot;nominativoquot; property=quot;nominativoquot; jdbcType=quot;VARCHARquot; />
      </resultMap>

      <resultMap class=quot;adminquot; id=quot;resultAdminquot; extends=quot;resultAdminLightquot;>
            <result column=quot;emailquot; property=quot;emailquot; jdbcType=quot;VARCHARquot; />
            <result column=quot;usernamequot; property=quot;usernamequot; jdbcType=quot;VARCHARquot; />
            <result column=quot;cellularequot; property=quot;cellularequot; jdbcType=quot;VARCHARquot; />
      </resultMap>

       <select id=quot;getAdminByUsernamequot; resultMap=quot;resultAdminquot;>
           SELECT
           id, centro, email, cellulare, nominativo, username
           FROM amministratori
           WHERE username = #username#
       </select>
     ...

           <insert id=quot;insertAdminquot; parameterClass=quot;adminquot;>
                  <selectKey keyProperty=quot;idquot; resultClass=quot;longquot;>
                        select nextval('amministratori_id_seq')
                  </selectKey>
                  INSERT INTO amministratori (id, centro, nominativo, email, username, cellulare)
                  VALUES (#id:INTEGER#, #centro:BIGINT#, #nominativo:VARCHAR#,
                         #email:VARCHAR#, #username:VARCHAR#, #cellulare:VARCHAR#)
            </insert>

     ...




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                       Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
iBATIS Dao

         public class AmministratoriDaoImpl extends SqlMapClientDaoSupport implements AmministratoriDao{


            public Integer deleteAmministratore(long idAdmin, long idCentro) throws DataAccessException{
                  Map map = new FastMap();
                  map.put(quot;idquot;, idAdmin);
                  map.put(quot;centroquot;, idCentro);
                  return getSqlMapClientTemplate().delete(quot;deleteAdminquot;, map);
            }


            public Long insertAmministratore(AmministratoreView admin) throws DataAccessException {
                  return (Long)getSqlMapClientTemplate().insert(quot;insertAdminquot;, admin);
            }


            public Integer updateAmministratore(AmministratoreView admin) throws DataAccessException {
                  return getSqlMapClientTemplate().update(quot;updateAdminquot;, admin);
            }



            public AmministratoreView getAmministratore(String username) throws DataAccessException{
                  return (AmministratoreView)getSqlMapClientTemplate().queryForObject(quot;getAdminByUsernamequot;, username);
            }


            ..

            }




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                      Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Transaction on service layer


 public class AmministratoriManagerImpl implements AmministratoriManager{

 public long saveAmministratore(AmministratoreView admin) {
       return admin.isNew() ? amministratoriDao.insertAmministratore(admin) :amministratoriDao.updateAmministratore(admin);
 }

 public AmministratoreView getAmministratore(String username) {
       return amministratoriDao.getAmministratore(username);
 }

 public boolean deleteAmministratore(long idAdmin,long idCentro) {
       return amministratoriDao.deleteAmministratore(idAdmin, idCentro)== 1 ? true : false;
 }

 public List<AmministratoreView> getAmministratori() {
             return amministratoriDao.getAmministratori();
 }




                           Spring Way: declarative
  <bean name=quot;txAttributesquot; class=quot;org.springframework.transaction.interceptor.NameMatchTransactionAttributeSourcequot;>
        <property name=quot;propertiesquot;>
              <props>
                    <prop key=quot;*quot;>PROPAGATION_SUPPORTS,readOnly</prop>
                    <prop key=quot;save*quot;>PROPAGATION_REQUIRED,-Exception</prop>
                    <prop key=quot;insert*quot;>PROPAGATION_REQUIRED,-Exception</prop>
                    <prop key=quot;update*quot;>PROPAGATION_REQUIRED,-Exception</prop>
                    <prop key=quot;delete*quot;>PROPAGATION_REQUIRED,-Exception</prop>
              </props>
        </property>
  </bean>

Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                       Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Test !




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Demo



       MagicBox it' s a JEE solution to coordinate blood donations




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Q&A



                                                                                             All this leads to
                                                                                             great
                                                                                             software
                                                                                             projects




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                     Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
Thanks for your attention




                                          Massimiliano Dessì
                                         desmax74 at yahoo.it
                                   http://wiki.java.net/bin/view/People/MassimilianoDessi
                              http://www.jugsardegna.org/vqwiki/jsp/Wiki?MassimilianoDessi
                                                   http://jroller.com/desmax


                                              Spring Framework Italian User Group
                                    http://it.groups.yahoo.com/group/SpringFramework-it




Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group
Javaday Roma - 01/12/2007
                                                                      Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License

Mais conteúdo relacionado

Semelhante a Javaday Roma2007 Magic Box Kiss With Spring

Tapestry 5 in Action Pratica
Tapestry 5 in Action Pratica Tapestry 5 in Action Pratica
Tapestry 5 in Action Pratica maraexception
 
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...GreeceJS
 
On our way to headless - A transition in progress
On our way to headless - A transition in progressOn our way to headless - A transition in progress
On our way to headless - A transition in progressAlexander Varwijk
 
Eclipse@Rome 12 July 2007 Long Ver1
Eclipse@Rome 12 July 2007  Long Ver1Eclipse@Rome 12 July 2007  Long Ver1
Eclipse@Rome 12 July 2007 Long Ver1Paolo Maresca
 
Disassembling the Monolith: Taming Large Software Projects with Node.js
Disassembling the Monolith: Taming Large Software Projects with Node.jsDisassembling the Monolith: Taming Large Software Projects with Node.js
Disassembling the Monolith: Taming Large Software Projects with Node.jsNicholas Young
 
Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)
Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)
Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)Rick. Bahague
 
DevOps - Keepers of the Keys to the Kingdom
DevOps - Keepers of the Keys to the KingdomDevOps - Keepers of the Keys to the Kingdom
DevOps - Keepers of the Keys to the KingdomDevOpsDays Tel Aviv
 
Burckhardtsource.org: manual for scholars
Burckhardtsource.org: manual for scholarsBurckhardtsource.org: manual for scholars
Burckhardtsource.org: manual for scholarsAlessio Piccioli
 
DevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOps
DevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOpsDevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOps
DevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOpsDevOps Indonesia
 
*Source - towards the semantic annotation of digital content / Wittgenstein S...
*Source - towards the semantic annotation of digital content / Wittgenstein S...*Source - towards the semantic annotation of digital content / Wittgenstein S...
*Source - towards the semantic annotation of digital content / Wittgenstein S...Alessio Piccioli
 
Agile: Implications and Complications
Agile: Implications and Complications Agile: Implications and Complications
Agile: Implications and Complications Intergen
 
A Responsive Project Process
A Responsive Project ProcessA Responsive Project Process
A Responsive Project ProcessPhase2
 
Aspect Oriented Programming and MVC with Spring Framework
Aspect Oriented Programming and MVC with Spring FrameworkAspect Oriented Programming and MVC with Spring Framework
Aspect Oriented Programming and MVC with Spring FrameworkMassimiliano Dessì
 
Measuring Web Performance - HighEdWeb Edition
Measuring Web Performance - HighEdWeb EditionMeasuring Web Performance - HighEdWeb Edition
Measuring Web Performance - HighEdWeb EditionDave Olsen
 
Sakai spring maven archetype
Sakai spring maven archetypeSakai spring maven archetype
Sakai spring maven archetypegjenning
 
ABSE and AtomWeaver : A Quantum Leap in Software Development
ABSE and AtomWeaver : A Quantum Leap in Software DevelopmentABSE and AtomWeaver : A Quantum Leap in Software Development
ABSE and AtomWeaver : A Quantum Leap in Software DevelopmentRui Curado
 
The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...
The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...
The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...Alan Quayle
 

Semelhante a Javaday Roma2007 Magic Box Kiss With Spring (20)

Tapestry 5 in Action Pratica
Tapestry 5 in Action Pratica Tapestry 5 in Action Pratica
Tapestry 5 in Action Pratica
 
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
Next.js and the pursuit of happiness (Dimitris Michalakos, Lead Developer at ...
 
On our way to headless - A transition in progress
On our way to headless - A transition in progressOn our way to headless - A transition in progress
On our way to headless - A transition in progress
 
Eclipse@Rome 12 July 2007 Long Ver1
Eclipse@Rome 12 July 2007  Long Ver1Eclipse@Rome 12 July 2007  Long Ver1
Eclipse@Rome 12 July 2007 Long Ver1
 
Disassembling the Monolith: Taming Large Software Projects with Node.js
Disassembling the Monolith: Taming Large Software Projects with Node.jsDisassembling the Monolith: Taming Large Software Projects with Node.js
Disassembling the Monolith: Taming Large Software Projects with Node.js
 
Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)
Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)
Drupal campmanila 2012 (Responsive Web in Drupal with Omega Theme)
 
DevOps - Keepers of the Keys to the Kingdom
DevOps - Keepers of the Keys to the KingdomDevOps - Keepers of the Keys to the Kingdom
DevOps - Keepers of the Keys to the Kingdom
 
Burckhardtsource.org: manual for scholars
Burckhardtsource.org: manual for scholarsBurckhardtsource.org: manual for scholars
Burckhardtsource.org: manual for scholars
 
DevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOps
DevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOpsDevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOps
DevOps Indonesia #12 - Adopting DevOps as culture using Azure DevOps
 
*Source - towards the semantic annotation of digital content / Wittgenstein S...
*Source - towards the semantic annotation of digital content / Wittgenstein S...*Source - towards the semantic annotation of digital content / Wittgenstein S...
*Source - towards the semantic annotation of digital content / Wittgenstein S...
 
Make Tools
Make ToolsMake Tools
Make Tools
 
Introduction to Eclipse Che
Introduction to Eclipse CheIntroduction to Eclipse Che
Introduction to Eclipse Che
 
Spring Roo Internals Javaday IV
Spring Roo Internals Javaday IVSpring Roo Internals Javaday IV
Spring Roo Internals Javaday IV
 
Agile: Implications and Complications
Agile: Implications and Complications Agile: Implications and Complications
Agile: Implications and Complications
 
A Responsive Project Process
A Responsive Project ProcessA Responsive Project Process
A Responsive Project Process
 
Aspect Oriented Programming and MVC with Spring Framework
Aspect Oriented Programming and MVC with Spring FrameworkAspect Oriented Programming and MVC with Spring Framework
Aspect Oriented Programming and MVC with Spring Framework
 
Measuring Web Performance - HighEdWeb Edition
Measuring Web Performance - HighEdWeb EditionMeasuring Web Performance - HighEdWeb Edition
Measuring Web Performance - HighEdWeb Edition
 
Sakai spring maven archetype
Sakai spring maven archetypeSakai spring maven archetype
Sakai spring maven archetype
 
ABSE and AtomWeaver : A Quantum Leap in Software Development
ABSE and AtomWeaver : A Quantum Leap in Software DevelopmentABSE and AtomWeaver : A Quantum Leap in Software Development
ABSE and AtomWeaver : A Quantum Leap in Software Development
 
The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...
The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...
The Difference Between Your Project Succeeding or Burning To A Crisp Is Actua...
 

Mais de Massimiliano Dessì

When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...Massimiliano Dessì
 
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Massimiliano Dessì
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudMassimiliano Dessì
 
Web Marketing Training 2014 Community Online
Web Marketing Training 2014 Community OnlineWeb Marketing Training 2014 Community Online
Web Marketing Training 2014 Community OnlineMassimiliano Dessì
 
Vert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVMVert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVMMassimiliano Dessì
 
Reactive applications Linux Day 2013
Reactive applications Linux Day 2013Reactive applications Linux Day 2013
Reactive applications Linux Day 2013Massimiliano Dessì
 
Scala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVCScala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVCMassimiliano Dessì
 
Codemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_sprayCodemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_sprayMassimiliano Dessì
 
Why we cannot ignore functional programming
Why we cannot ignore functional programmingWhy we cannot ignore functional programming
Why we cannot ignore functional programmingMassimiliano Dessì
 
Three languages in thirty minutes
Three languages in thirty minutesThree languages in thirty minutes
Three languages in thirty minutesMassimiliano Dessì
 

Mais de Massimiliano Dessì (20)

Code One 2018 maven
Code One 2018   mavenCode One 2018   maven
Code One 2018 maven
 
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
When Old Meets New: Turning Maven into a High Scalable, Resource Efficient, C...
 
Hacking Maven Linux day 2017
Hacking Maven Linux day 2017Hacking Maven Linux day 2017
Hacking Maven Linux day 2017
 
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Docker dDessi november 2015
Docker dDessi november 2015Docker dDessi november 2015
Docker dDessi november 2015
 
Docker linuxday 2015
Docker linuxday 2015Docker linuxday 2015
Docker linuxday 2015
 
Openshift linuxday 2014
Openshift linuxday 2014Openshift linuxday 2014
Openshift linuxday 2014
 
Web Marketing Training 2014 Community Online
Web Marketing Training 2014 Community OnlineWeb Marketing Training 2014 Community Online
Web Marketing Training 2014 Community Online
 
Vert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVMVert.X like Node.js but polyglot and reactive on JVM
Vert.X like Node.js but polyglot and reactive on JVM
 
Reactive applications Linux Day 2013
Reactive applications Linux Day 2013Reactive applications Linux Day 2013
Reactive applications Linux Day 2013
 
Scala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVCScala Italy 2013 extended Scalatra vs Spring MVC
Scala Italy 2013 extended Scalatra vs Spring MVC
 
Codemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_sprayCodemotion 2013 scalatra_play_spray
Codemotion 2013 scalatra_play_spray
 
Why we cannot ignore functional programming
Why we cannot ignore functional programmingWhy we cannot ignore functional programming
Why we cannot ignore functional programming
 
Scala linux day 2012
Scala linux day 2012 Scala linux day 2012
Scala linux day 2012
 
Three languages in thirty minutes
Three languages in thirty minutesThree languages in thirty minutes
Three languages in thirty minutes
 
MongoDB dessi-codemotion
MongoDB dessi-codemotionMongoDB dessi-codemotion
MongoDB dessi-codemotion
 
MongoDB Webtech conference 2010
MongoDB Webtech conference 2010MongoDB Webtech conference 2010
MongoDB Webtech conference 2010
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Spring Roo JaxItalia09
Spring Roo JaxItalia09Spring Roo JaxItalia09
Spring Roo JaxItalia09
 

Último

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Último (20)

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Javaday Roma2007 Magic Box Kiss With Spring

  • 1. Magic Box project: Effective K.I.S.S. with SpringFramework http://sourceforge.net/projects/magic-box Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 2. The event that host this presentation: Javaday Organizzato direttamente dalla collaborazione della community Java, gira l'Italia con passione 2007 Javaday è un evento unico nel mondo! 2006 L' edizione romana è a cura di Jug Roma Java Italian Portal Java Italian Association Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 3. Requirements for this talk “We believe not only that J2EE development should be much simpler than the mixture of drudgery and complexity it’s often made out to be, but that developing J2EE applications should be fun” Rod Johnson http://www.springframework.org/ Ralph, Erich, Richard, John at OOPSLA 1994 http://c2.com/cgi/wiki?GangOfFour http://c2.com/cgi/wiki?DesignPatternsBook Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 4. Speaker Java Architect * Co-fondatore e consigliere JugSardegna Onlus 2003 * plus others bla bla bla bla Fondatore e coordinatore: SpringFramework Italian User Group 2006 Jetspeed Italian User Group 2003 Groovy Italian User Group 2007 Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 5. Spring Knowledge Spring User da Luglio 2004 (Spring 1.1) Primo articolo italiano settembre 2004 sul JugSardegna. Primo corso di formazione su Spring in Italia maggio 2005 per la Sistemi Informativi a Roma. Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 6. MagicBox Project Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 7. MagicBox Project Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 8. MagicBox Project Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 9. Ideas behind the presentation http://c2.com/cgi/wiki?SevenPrinciplesOfSoftwareDevelopment Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 10. Ideas behind the presentation Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 11. This is not simple Don’t worry: knowing the language doesn’t really help. Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 12. Simplicity vs Complexity I actually enjoy complexity that's empowering. If it challenges me, the complexity is very pleasant. But sometimes I must deal with complexity that's disempowering. The effort I invest to understand that complexity is tedious work. It doesn't add anything to my abilities. What's the Simplest Thing that Could Possibly Work ? Simplicity: the Shortest Path to a Solution Ward Cunningham http://www.artima.com/intv/simplest.html Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group http://c2.com/cgi/wiki?WardCunningham Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 13. Simplicity != Simplicity Quick and Dirty Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 14. Do the simplest thing The most important rule in our development is always to do the simplest thing that could possibly work. Not the most stupid thing, not something that clearly can’t work. But simplicity is the most important contributor to the ability to make rapid progress. Ronald E.Jeffries http://www.xprogramming.com/Practices/PracSimplest.html Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 15. XP View Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 16. Do the simplest thing that could possibly work ! Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 17. Design Nella pianificazione, mai una mossa inutile; nella strategia, nessun passo compiuto invano. Sun Tzu The art of war Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 18. Interface in MagicBox EJ Item 16: Prefer interfaces to abstract classes For all Objects Domain Services Dao Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 19. Interface Advantage Switch from one implementation , List entries = new java.util.ArrayList(); Map map = new java.util.HashMap(); to another more aggressive List entries = new javolution.util.FastList(); Map map = new javolution.util.FastHashMap(); Felino micio = new Gatto(); without affecting the client Felino micio = new TigerInsideImpl(); Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 20. Composition EJ Item 14: Favor composition over inheritance This design is called composition because the existing class becomes a component of the new one. Each instance method in the new class invokes the corresponding method on the contained instance of the existing class and returns the results. This is known as forwarding, and the methods in the new class are known as forwarding methods. Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 21. Composition in Domain Objects public final class UtenteImpl implements UtenteView{ public UtenteImpl (){ utenteLight = new UtenteLightImpl(); indirizzo = new IndirizzoImpl(); recapiti = new RecapitoTelefonicoImpl(); } ... Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 22. Abstractions from a hierarchy Inheritance on interfaces public interface UtenteView extends UtenteLightView{ ... } public interface UtenteLightView extends UtenteUltraLightView{ ... } public interface UtenteUltraLightView { ... } Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 23. Immutability Item 13: Favor immutability An immutable class is simply a class whose instances cannot be modified. All of the information contained in each instance is provided when it is created and is fixed for the lifetime of the object. Immutable classes are easier to design, implement, and use than mutable classes. They are less prone to error and are more secure Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 24. Immutability Only accessors on public interfaces. public interface UtenteUltraLightView { public boolean isNew(); public long getId(); Final implementation class. public String getNominativo(); public long getIdGruppo(); All fields private. } No mutable component. Mutators accessible only on implementation class, for web binding and in the Data Mapper Layer public class CentroFormController extends SimpleFormController{ public CentroFormController(){ setCommandClass(CentroImpl.class); setCommandName(Constant.CENTRO); setFormView(quot;admin/centroFormquot;); setSuccessView(Constant.REDIRECT_ELENCO_CENTRI); } ... } Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 25. Data mapper The Data Mapper is a layer of software that separates the in- memory objects from the database. Its responsibility is to transfer data between the two and also to isolate them from each other. With Data Mapper the in-memory objects needn't know even that there's a database present; they need no SQL interface code, and certainly no knowledge of the database schema. (The database schema is always ignorant of the objects that use it.) Since it's a form of Mapper (473), Data Mapper itself is even unknown to the domain layer. http://martinfowler.com/eaaCatalog/dataMapper.html Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 26. iBATIS mapping class - table <typeAlias type=quot;org.magicbox.domain.AmministratoreImplquot; alias=quot;adminquot;/> <typeAlias type=quot;org.magicbox.domain.AmministratoreLightImplquot; alias=quot;adminLightquot;/> <resultMap class=quot;adminLightquot; id=quot;resultAdminLightquot;> <result column=quot;idquot; property=quot;idquot; jdbcType=quot;INTEGERquot; /> <result column=quot;centroquot; property=quot;centroquot; jdbcType=quot;BIGINTquot; /> <result column=quot;nominativoquot; property=quot;nominativoquot; jdbcType=quot;VARCHARquot; /> </resultMap> <resultMap class=quot;adminquot; id=quot;resultAdminquot; extends=quot;resultAdminLightquot;> <result column=quot;emailquot; property=quot;emailquot; jdbcType=quot;VARCHARquot; /> <result column=quot;usernamequot; property=quot;usernamequot; jdbcType=quot;VARCHARquot; /> <result column=quot;cellularequot; property=quot;cellularequot; jdbcType=quot;VARCHARquot; /> </resultMap> <select id=quot;getAdminByUsernamequot; resultMap=quot;resultAdminquot;> SELECT id, centro, email, cellulare, nominativo, username FROM amministratori WHERE username = #username# </select> ... <insert id=quot;insertAdminquot; parameterClass=quot;adminquot;> <selectKey keyProperty=quot;idquot; resultClass=quot;longquot;> select nextval('amministratori_id_seq') </selectKey> INSERT INTO amministratori (id, centro, nominativo, email, username, cellulare) VALUES (#id:INTEGER#, #centro:BIGINT#, #nominativo:VARCHAR#, #email:VARCHAR#, #username:VARCHAR#, #cellulare:VARCHAR#) </insert> ... Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 27. iBATIS Dao public class AmministratoriDaoImpl extends SqlMapClientDaoSupport implements AmministratoriDao{ public Integer deleteAmministratore(long idAdmin, long idCentro) throws DataAccessException{ Map map = new FastMap(); map.put(quot;idquot;, idAdmin); map.put(quot;centroquot;, idCentro); return getSqlMapClientTemplate().delete(quot;deleteAdminquot;, map); } public Long insertAmministratore(AmministratoreView admin) throws DataAccessException { return (Long)getSqlMapClientTemplate().insert(quot;insertAdminquot;, admin); } public Integer updateAmministratore(AmministratoreView admin) throws DataAccessException { return getSqlMapClientTemplate().update(quot;updateAdminquot;, admin); } public AmministratoreView getAmministratore(String username) throws DataAccessException{ return (AmministratoreView)getSqlMapClientTemplate().queryForObject(quot;getAdminByUsernamequot;, username); } .. } Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 28. Transaction on service layer public class AmministratoriManagerImpl implements AmministratoriManager{ public long saveAmministratore(AmministratoreView admin) { return admin.isNew() ? amministratoriDao.insertAmministratore(admin) :amministratoriDao.updateAmministratore(admin); } public AmministratoreView getAmministratore(String username) { return amministratoriDao.getAmministratore(username); } public boolean deleteAmministratore(long idAdmin,long idCentro) { return amministratoriDao.deleteAmministratore(idAdmin, idCentro)== 1 ? true : false; } public List<AmministratoreView> getAmministratori() { return amministratoriDao.getAmministratori(); } Spring Way: declarative <bean name=quot;txAttributesquot; class=quot;org.springframework.transaction.interceptor.NameMatchTransactionAttributeSourcequot;> <property name=quot;propertiesquot;> <props> <prop key=quot;*quot;>PROPAGATION_SUPPORTS,readOnly</prop> <prop key=quot;save*quot;>PROPAGATION_REQUIRED,-Exception</prop> <prop key=quot;insert*quot;>PROPAGATION_REQUIRED,-Exception</prop> <prop key=quot;update*quot;>PROPAGATION_REQUIRED,-Exception</prop> <prop key=quot;delete*quot;>PROPAGATION_REQUIRED,-Exception</prop> </props> </property> </bean> Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 29. Test ! Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 30. Demo MagicBox it' s a JEE solution to coordinate blood donations Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 31. Q&A All this leads to great software projects Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License
  • 32. Thanks for your attention Massimiliano Dessì desmax74 at yahoo.it http://wiki.java.net/bin/view/People/MassimilianoDessi http://www.jugsardegna.org/vqwiki/jsp/Wiki?MassimilianoDessi http://jroller.com/desmax Spring Framework Italian User Group http://it.groups.yahoo.com/group/SpringFramework-it Massimiliano Dessì - desmax74@yahoo.it – SpringFramework Italian User Group Javaday Roma - 01/12/2007 Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License