Dirk Burkholz My project Overview & Motivation Core principles - - PowerPoint PPT Presentation

dirk burkholz my project overview motivation
SMART_READER_LITE
LIVE PREVIEW

Dirk Burkholz My project Overview & Motivation Core principles - - PowerPoint PPT Presentation

Dirk Burkholz My project Overview & Motivation Core principles and techniques Spotlight on one technique Further features Conclusion Dirk Burkholz - The Spring Framework 14.01.2009 for Java and .NET 2 GLOBUS


slide-1
SLIDE 1

Dirk Burkholz

slide-2
SLIDE 2

 My project  Overview & Motivation  Core principles and techniques

 Spotlight on one technique

 Further features  Conclusion

14.01.2009 2 Dirk Burkholz - The Spring Framework for Java and .NET

slide-3
SLIDE 3

 GLOBUS group, hypermarkets  Spring for Java in use for several

J2EE projects

 Launch of software-aided business process

management based on .NET

 Project: Evaluation if the knowledge and

experience about Spring for Java can easily be transferred to projects in C#.NET using Spring.NET

 Sample project using some core features of Spring

14.01.2009 3 Dirk Burkholz - The Spring Framework for Java and .NET

slide-4
SLIDE 4

 Core Principles

 Inversion of Control (IoC)  Dependency Injection (DI)  Aspect Oriented Programming (AOP)

 Further features

 Template-based database access (DAO support)  Webservices  …

14.01.2009 4 Dirk Burkholz - The Spring Framework for Java and .NET

slide-5
SLIDE 5

 Rod Johnson, J2EE consultant, found some

drawbacks in J2EE design

 He collected best practices to avoid this

drawbacks in his book „Expert One-on-one J2EE Design and Development“ in 2002; a very basic framework was already included

 Now: Spring Framework for Java 2.5 in 2007  Mark Pollack‘s first .NET port in 2003  Now: Spring.NET 1.2 in 2008

14.01.2009 5 Dirk Burkholz - The Spring Framework for Java and .NET

slide-6
SLIDE 6

 Responsibility to instatiate new objects not by

the using object but by the IoC container

 Coding against interfaces and superclasses, not implementations

 Uses Dependency Injection  XML-based context describing managed

  • bjects, their properties and dependencies to
  • ther managed objects

14.01.2009 6 Dirk Burkholz - The Spring Framework for Java and .NET

slide-7
SLIDE 7

<bean id=„student1“ class=„Student“> <property name=„studentid“ value=„42“ /> … </bean> … <bean id=„university0“ class=„University“> <property name=„bestStudent“ ref=„student1“ /> … </bean>

14.01.2009 7 Dirk Burkholz - The Spring Framework for Java and .NET

slide-8
SLIDE 8

 Injecting dependencies of managed objects by

the IoC container instead of instatiating dependent objects by new ObjectType()

 Spring uses

 Setter Injection: matching properties by name

 String property xy – setXy(String s)

 Constructor Injection: matching constructur

arguments by order and type

 Object obj, int argument i – new obj(i)

14.01.2009 8 Dirk Burkholz - The Spring Framework for Java and .NET

slide-9
SLIDE 9

 Crosscutting concerns are requirements

  • rthogonal to the software design/

decomposition, e.g. logging

 Joinpoints are points in the program flow,

Pointcuts select a subset of them

 Advices add the desired functionality at the

joinpoints selected by pointcuts

 Spring supports Before-, Around-, After-,

AfterException and AfterReturning Advices

14.01.2009 9 Dirk Burkholz - The Spring Framework for Java and .NET

slide-10
SLIDE 10

 Drawbacks to classic AOP (e.g. AspectJ)

 Advising managed objects only  Advising public methods only  No advices for advised methods

 Advices are singletons  Access to method invocation: arguments,

return value, thrown exception

 Possibility to check, change or omit return values

14.01.2009 10 Dirk Burkholz - The Spring Framework for Java and .NET

slide-11
SLIDE 11

SPRING JAVA SPRING.NET

 AspectJ-like  J2SE dynamic proxies to

advice interfaces

 CGlib2 proxies to

advice classes

 Annotation-based

syntax possible

 Full advising of

interfaces only

 Advising virtual

methods of classes only

14.01.2009 11 Dirk Burkholz - The Spring Framework for Java and .NET

slide-12
SLIDE 12

 Central concept: Template

 Capsules and manages connection to data source  Provides methods mapping result sets to more

generic collections/types

 Provides many helper methods  Translates vendor-specific exceptions to Spring‘s

generic DataAccessException hierarchy (using SQLExceptionTranslator)

14.01.2009 12 Dirk Burkholz - The Spring Framework for Java and .NET

slide-13
SLIDE 13

SPRING JAVA SPRING.NET

 DataSource  JdbcTemplate  Mapping to Map/List

queryForMap()/List

 Statement parameters

by object array

 queryForObject() and

specialized methods

 DbProvider  AdoTemplate  Mapping to DataSet

DataSetCreateWithParams()

 Statement parameters

by IDbParameters

 ExecuteScalar() only

14.01.2009 13 Dirk Burkholz - The Spring Framework for Java and .NET

slide-14
SLIDE 14

 Goal: Webservice support easier than with

J2EE/ASP.NET

 Using webservice proxies  Testing scenario:

 Cut between DataProvider and Factory  Connections via webservice

 Java – Java  .NET – .NET  Java - .NET  .NET – Java

14.01.2009 14 Dirk Burkholz - The Spring Framework for Java and .NET

slide-15
SLIDE 15

 Core principles are the same except for Java/.NET

core technology differences

 Spring for Java developers can easily apply their knowledge when developing Spring.NET applications

 Some differences in details, especially naming

 Developers can easily overcome this by using code completion and looking up the reference’s section Spring.NET for Java developers

 Spring for Java has more features than Spring.NET

 Core features are already well supported, so certain features are only missing for special cases

 More features: Web MVC, Security, Validation, …

14.01.2009 15 Dirk Burkholz - The Spring Framework for Java and .NET

slide-16
SLIDE 16

 The Spring Framework - Reference

Documentation: http://static.springframework.org/spring/docs/2 .5.x/reference/index.html

 The Spring.NET Framework – Reference

Documentation: http://www.springframework.net/docs/1.2.0/ref erence/html/index.html

 Rod Johnson. Expert One-on-one J2EE Design and

Development (Programmer to Programmer). Wiley & Sons 2003. ISBN: 978-0764543852

14.01.2009 16 Dirk Burkholz - The Spring Framework for Java and .NET