Copyright © 2005 Finetix LLC All Rights Reserved 0 Spring Framework Developer Session Chris Donnan & Solomon Duskis The Peer Frameworks Series -.Net and.

Slides:



Advertisements
Similar presentations
Spring Roo and the Cloud Shekhar Gulati.
Advertisements

Jim McKeeth | Podcast at Delphi.org
2006 Pearson Education, Inc. All rights reserved Object-Oriented Programming: Inheritance.
Advanced Piloting Cruise Plot.
Our library has two forms of encyclopedias: Hard copy and electronic versions. The first is simply the old-fashioned "book on the shelf" type of encyclopedia.
Final and Abstract Classes
Design Patterns.
Copyright © 2002 Pearson Education, Inc. Slide 1.
Chapter 6 Structures and Classes. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Learning Objectives Structures Structure types Structures.
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
Introduction to Product Family Engineering. 11 Oct 2002 Ver 2.0 ©Copyright 2002 Vortex System Concepts 2 Product Family Engineering Overview Project Engineering.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
12 Copyright © 2005, Oracle. All rights reserved. Structuring Code Using Abstract Classes and Interfaces.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
10 Copyright © 2005, Oracle. All rights reserved. Reusing Code with Inheritance and Polymorphism.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
Copyright CompSci Resources LLC Web-Based XBRL Products from CompSci Resources LLC Virginia, USA. Presentation by: Colm Ó hÁonghusa.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Richmond House, Liverpool (1) 26 th January 2004.
ABC Technology Project
EU Market Situation for Eggs and Poultry Management Committee 21 June 2012.
VOORBLAD.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
©2007 First Wave Consulting, LLC A better way to do business. Period This is definitely NOT your father’s standard operating procedure.
CMPT 275 Software Engineering
© 2012 National Heart Foundation of Australia. Slide 2.
Lecture 6: Software Design (Part I)
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Implementation Architecture
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
25 seconds left…...
Slippery Slope
Copyright © Cengage Learning. All rights reserved.
Copyright 2001 Advanced Strategies, Inc. 1 Data Bridging An Overview Prepared for DIGIT By Advanced Strategies, Inc.
H to shape fully developed personality to shape fully developed personality for successful application in life for successful.
Januar MDMDFSSMDMDFSSS
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
PSSA Preparation.
Immunobiology: The Immune System in Health & Disease Sixth Edition
Chapter 11 Component-Level Design
Immunobiology: The Immune System in Health & Disease Sixth Edition
CpSc 3220 Designing a Database
Abstract Class, Packages and interface from Chapter 9
1 Abstract Class and Packages from Chapter 9 Lecture.
Chapter 9: Using Classes and Objects. Understanding Class Concepts Types of classes – Classes that are only application programs with a Main() method.
Spring, Hibernate and Web Services 13 th September 2014.
The Spring Framework: A brief introduction to Inversion of Control James Brundege
Presenter - Donn Felker.  Senior Consultant for Microsoft Gold Certified Partner- Statêra.  8 years of experience in developing and architecting enterprise.
Copyright © 2005 Finetix LLC All Rights Reserved 0 SpringFramework.Java Developer Session Solomon Duskis The Peer Frameworks Series -.Net and Java.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Copyright © 2005 Finetix LLC All Rights Reserved 0 SpringFramework.Net Developer Session Chris Donnan The Peer Frameworks Series -.Net and Java.
Spring Framework. Spring Overview Spring is an open source layered Java/J2EE application framework Created by Rod Johnson Based on book “Expert one-on-one.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Alternative Architectures: Inversion of Control Mike Hadlow mikehadlow.blogspot.com.
Presentation transcript:

Copyright © 2005 Finetix LLC All Rights Reserved 0 Spring Framework Developer Session Chris Donnan & Solomon Duskis The Peer Frameworks Series -.Net and Java

Copyright © 2005 Finetix LLC All Rights Reserved 1 Overview –Light Snack 630 – 700 –Introduction to Inversion of Control, Dependency Injection and other core concepts. 700 – 730 –Spring Framework -.Net Session 730 – 800 –Spring Framework – Java Session

Copyright © 2005 Finetix LLC All Rights Reserved 2 About Us Chris Donnan –Senior Software Engineer at Finetix - servicing investment banking clients –Contact me at : –Blog: Solomon Duskis –Solomon Duskis is a Senior Consultant at Finetix. He has worked with clients in a variety of fields including financial, insurance, publishing, and medicine. Over the last three years he has worked at clients with some level of Spring Framework deployments. His technical ramblings can be found at

Copyright © 2005 Finetix LLC All Rights Reserved 3 Spring Top Level Overview and History The history of spring. Where did Spring come from and why? –J2EE problems –Rod Johnson and his book Started in 2002/ version in 2004 Where is Spring being used? The parts of spring –Java –.Net

Copyright © 2005 Finetix LLC All Rights Reserved 4 Spring for Java

Copyright © 2005 Finetix LLC All Rights Reserved 5 Spring for.Net Core AOP ServicesData Access Web DesktopWindows Services 3 rd Party Integration

Copyright © 2005 Finetix LLC All Rights Reserved 6 Dependency Resolution Plain old way –new your dependencies Service Locator –use a locator to get instances of your dependencies Dependency Injection –Get your dependencies handed to you. These all imply certain couplings…

Copyright © 2005 Finetix LLC All Rights Reserved 7 Plain old dependency creation Example: public class Foo { private IBar bar; private IBaz baz; public Foo() { bar = new SomeBar(); baz = new SomeBaz(); } Characteristics Cons –Your class depends upon all its dependencies depend on. –Your class must know how to assemble instances of its dependencies and their dependencies. –Hard to change behavior without opening code –Hard to test as you must also test depends. Cannot use mocks. Pros –Easy to understand

Copyright © 2005 Finetix LLC All Rights Reserved 8 Service Locator Example: public class Foo { private IBar bar; private IBaz baz; private IServiceLocator locator; public Foo(IServiceLocator locator_) { locator = locator_; bar = locator.Get( ServiceNames.BAR ); baz = new SomeBaz( ServicesNames.BAZ ); } Characteristics Cons –Your class depends upon the service locator –You must still get the locator to the class – either statically (yuk) or via… some sort of injection like mechanism Pros –Easy to understand –Testable –Flexible –Extensible –Enforces separation of interface from implementation

Copyright © 2005 Finetix LLC All Rights Reserved 9 Inversion of Control Example: public class Foo { private IBar bar; private IBaz baz; public Foo(IBar bar_, IBaz baz_) { bar = bar_; baz = baz_; } Characteristics Cons –You must create dependencies to pass along Pros –Easy to understand –Testable –Flexible –Extensible –Enforces separation of interface from implementation –Code is simple and clear

Copyright © 2005 Finetix LLC All Rights Reserved 10 Inversion Of Control Inversion Of Control, Dependency Injection, The Hollywood Principal etc. In stead of instantiating concrete class references in your class, depend on an abstraction and allow your concrete dependencies to be given to you.

Copyright © 2005 Finetix LLC All Rights Reserved 11 Injection Types Setter Injection –Pass dependencies in via mutators/ property setters Constructor Injection –Pass dependencies in via constructor

Copyright © 2005 Finetix LLC All Rights Reserved 12 Without IoC

Copyright © 2005 Finetix LLC All Rights Reserved 13 Concrete Class Dependency

Copyright © 2005 Finetix LLC All Rights Reserved 14 Allow dependency to be passed in

Copyright © 2005 Finetix LLC All Rights Reserved 15 Same thing – with property setter

Copyright © 2005 Finetix LLC All Rights Reserved 16 The problem with IoC by itself To build these objects now takes assembling the whole object graph of dependencies!!! What a pain!!!

Copyright © 2005 Finetix LLC All Rights Reserved 17 Containers to the rescue The solution is a container – to manage the complex creation, lifecycle, etc. This is where Spring comes in. –To manage complex object assembly I ask for object named Y – the container gets any dependencies for that type, creates then or gets cached instances – gives them to the object I am trying to get and returns me that object. I then use this object as I normally would. –To manage object lifecycles Singleton-ness or Non-Singleton-ness

Copyright © 2005 Finetix LLC All Rights Reserved 18 Springs Heart At its core – Spring is a framework for wiring up your entire application.

Copyright © 2005 Finetix LLC All Rights Reserved 19 Object Factory –The thing that creates object instances for you –You ask the object factory for a named item – it returns an instance to you – either a singleton or a prototype. Singleton –There is 1 and only 1 instance –Each time you ask the object factory for one – you get the same one Prototype –This is a non-singleton –Each time you ask the object factory for one – you get a new one

Copyright © 2005 Finetix LLC All Rights Reserved 20 Object factory as a Service Locator Ideally – you could use Spring to ask for an object at the top level of your application – and it would give you back an entire object graph of fully baked objects. That said – this is not always feasable. You can use Spring as a service locator – or as an implementation detail of your service locator. Service locator is a great alternative to IoC – especially when things like UI designers New your objects in for you. Depending on how you do this – you could be more or less tied to spring (that is not great). In the past – I have tried to make spring an implementation detail – and hide it behind my own abstraction for locator.

Copyright © 2005 Finetix LLC All Rights Reserved 21 Why IoC with a Container Support programming best practices: –Separation of interface from implementation Allows you to substitute implementation –Code is smaller and cleaner – program your intent – not how to create your dependencies and their dependencies etc. –The Dependency Inversion Principle (DIP) Depend upon Abstractions. Do not depend upon concretions. –The Open Closed Principle (OCP) A module should be open for extension but closed for modification. Of all the principles of object oriented design, this is the most important. It originated from the work of Bertrand Meyer. It means simply this: We should write our mod-ules so that they can be extended, without requiring them to be modified. In other words, we want to be able to change what the modules do, without changing the source code of the modules.

Copyright © 2005 Finetix LLC All Rights Reserved 22 Why IoC - continued Testability –You can substitute implementation – specifically pass in a Mock object so you only write code to test the code you are writing. You are NOT testing the code in your dependencies. Manages assembly of complex objects for you! Reduce coupling of code Easy reconfiguration Reusability increase due to decoupling

Copyright © 2005 Finetix LLC All Rights Reserved 23 Other IoC Related Frameworks Hivemind Pico Container Copeland StructureMap EJB 3 JBoss Seam Object Builder in Microsoft CAB

Copyright © 2005 Finetix LLC All Rights Reserved 24 Spring Framework.net.Net presentation

Copyright © 2005 Finetix LLC All Rights Reserved 25 Spring Framework – Java Java presentation

Copyright © 2005 Finetix LLC All Rights Reserved 26 The Big Picture

Copyright © 2005 Finetix LLC All Rights Reserved 27 The Peer Frameworks Series -.Net and Java 1) Spring Framework Developer Session - SpringFramework.net, SpringFramework.org 2) Test Drive Development Developer Session - NUnit, JUnit; Rhino Mocks in.net and Easy Mock in Java 3) Db4o Developer Session - Open Source Object Database in.net and Java 4) ORM Developer Session - Hibernate, NHibernate / IBatis

Copyright © 2005 Finetix LLC All Rights Reserved 28 References

Copyright © 2005 Finetix LLC All Rights Reserved 29 Ruby does IoC Concrete Implementations