Lightweight Development Strategies JavaZone, Olso 2005 - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Lightweight Development Strategies JavaZone, Olso 2005

Description:

Lightweight Development Strategies. JavaZone, Olso 2005. Bruce A. Tate ... Better, Faster, Lighter Java by Tate, Gehtland. Spring Developer Notebook by Tate, Gehtland ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 36
Provided by: bruc141
Category:

less

Transcript and Presenter's Notes

Title: Lightweight Development Strategies JavaZone, Olso 2005


1
Lightweight Development StrategiesJavaZone, Olso
2005
  • Bruce A. Tate
  • http//www.springframework.com
  • bruce.tate_at_j2life.com

2
Agenda
  • Introduction
  • Process
  • POJO programming frameworks
  • Inversion of control (not just DI)
  • Conclusion

3
Progress report
  • Introduction
  • Process
  • POJO programming frameworks
  • Inversion of control (not just DI)
  • Conclusion

4
About Me
  • Author 6 books
  • Better, Faster, Lighter Java
  • Bitter Java, Bitter EJB
  • Spring Developer Notebook
  • Beyond Java due this Summer
  • Independent consultant, author, speaker
  • Founder and president of J2Life, LLC
  • Customers include FedEx, Great West Life, IHS,
    many others
  • Worked for IBM for 13 years
  • Database lab
  • Object infrastructure lab
  • Java consulting

5
Motivation
  • Java development must get
  • Simpler
  • More reliable
  • More efficient
  • Or it will die!

6
Java is bloating
  • Pressure to add
  • With no counterbalance
  • Pressure from industry
  • Big money creates massive frameworks
  • To solve massive problems
  • And sells them to the mainstream
  • Misuse
  • Massive frameworks for simple problems

7
How will you respond?
  • Do nothing
  • Pick a new language or environment
  • Pick a new development paradigm
  • Let your vendor shield you from complexity
  • Simplify
  • The subject of this talk

8
Progress report
  • Introduction
  • Process
  • POJO programming frameworks
  • Inversion of control (not just DI)
  • Conclusion

9
Which process?
  • Pick a couple of principles
  • And follow them
  • And call it whatever you want to

10
Emphasis (in order) on
  • Small, smart teams
  • Good feedback from customers
  • Quality
  • Simple requirements management
  • Simplicity
  • Refactoring
  • Automated unit testing

11
Agile Development Perception
  • Managers often fear agile processes
  • Perception is lack of discipline

Agile development (XP, Scrum)
Formal OO development (RUP)
  • Like, just wing it, dude!
  • Design artifacts
  • Early design
  • Meticulous requirement

Discipline
12
Agile Development
  • Agile development is disciplined
  • It draws discipline from another source

Agile development (XP, Scrum)
Formal OO development (RUP)
  • Automated testing
  • Continuous integration
  • Refactoring emphasis
  • On site customer
  • Design artifacts
  • Early design
  • Meticulous requirement

Discipline
13
Principles Getting started
  • Dont sell a process sell principles.
  • Simplicity
  • Continuous refactoring and integration
  • Automated tests, code tests first
  • Small teams with access to customer

14
Progress report
  • Introduction
  • Process
  • POJO programming frameworks
  • Inversion of control (not just DI)
  • Conclusion

15
POJO programming
  • Stretching Java!
  • Adding services
  • Interceptors
  • AOP
  • Proxies
  • Dependency injection
  • Loosen coupling
  • Multiple configurations of components

16
Concepts dependency injection
  • Old ways
  • Hard wiring
  • service new service()
  • Limiting relies on tight coupling
  • Lookup
  • Application.register(service, serviceName)
  • client.lookup(serviceName)
  • Traditional J2EE way.
  • Loosens coupling but does not break it

17
Concepts dependency injection
  • The parts a service, a consumer, and a container
  • Wrap the service in an interface
  • Provide a property in the consumer
  • Type the services interface
  • Let the container manage life cycles
  • The container is responsible for setting the
    property in the consumer

18
Setter-based injection example
  • Load context
  • Instantiates beans
  • Configures simple properties
  • Resolves dependencies

MyDataSource
Configuration File Beans Name
MyDataSource URL host/ProductDatabase
UserID batate Password pass
Name PetStoreDao Datasource
MyDataSource Version 4.7
URL host/ProductDatabase UserID
batate Password pass
PetStoreDao
Version 4.7
Datasource MyDataSource
19
What is AOP?
  • AOP seeks to get crosscutting concerns
  • Away from main-line code
  • To develop AOP code
  • You build your main-line logic
  • You code independent services
  • And weave them together with configuration
  • Advantages
  • Full transparency to services
  • Isolated aspects (often pre-defined)
  • Disadvantages? Immature

20
The core problem
Method body Exceptions
Security
Security
Open transaction
Open transaction
Mainline logic
Method Client
Commit transaction
Roll back
Commit transaction
Roll back
21
Active strategies
  • AOP
  • Code generation
  • Example EJB 2.x
  • Byte code enhancement/injection
  • Run time dynamic proxies
  • Hibernate, Spring, Hive Mind, etc
  • Compile time byte code injection step
  • JDO, AspectJ, obfuscators
  • Source level metadata
  • Can be both active and passive
  • In Java 5 annotations
  • In XDoclet tags

22
Passive strategies
  • Reflection
  • Deal with an object via its primitive parts
  • Deal with methods, attributes generically
  • Combine with other techniques
  • Example Hibernate

23
Java limitations
  • How do you express configuration
  • For dependency injection?
  • For AOP?
  • For reflection (specify methods, sigs, etc)
  • In Java or XML?
  • Metaprogramming in Java?

24
Progress report
  • Introduction
  • Process
  • POJO programming frameworks
  • Inversion of control (not just DI)
  • Conclusion

25
Inversion of control
  • Javas customization is outside first
  • while(iltlength)
  • row customLibrary()
  • Certain problems require inside out customization
  • Iteration
  • JDBC

Custom code
26
Typical JDBC
27
Example from jPetStore
  • Get a list of pet types (Strings)
  • JdbcTemplate template new JdbcTemplate(dataSourc
    e)
  • final List names new LinkedList()
  • template.query("SELECT id,name FROM types ORDER
    BY name",
  • new RowCallbackHandler(
    )
  • public void
    processRow(ResultSet rs)
  • throws
    SQLException

  • names.add(rs.getString(1))
  • )

28
What is a continuation?
  • The rest of the program
  • A frozen point in time
  • A copy of the call stack
  • With local variable values
  • And current point of execution

29
Continuation server
  • Back button
  • Threading
  • Inversion of control

Server
Application
Request
Request
Request
Request
Query
Query
Query
Browser
30
A brief demo
  • Seaside
  • Developed by Avi Bryant
  • In a language called Squeak
  • A derivative of Smalltalk

31
Solution in Java
  • Spring WebFlow
  • Implement a state machine
  • Specify a machine using Web Flow rules
  • Nodes are pages or methods
  • Transition on events (failure, success, etc)
  • Store a state in a dictionary like a continuation
  • Rife
  • Implements native Java continuations
  • Watch class loader, get stack
  • Compute offset to current line of code
  • Do byte code injection to insert stack
  • Skip to current line of code
  • Force all instance variables to implement
    Clonable
  • Cocoon 2
  • Implement Java on Rhino (JavaScript engines)
  • Use custom code to implement continuations in
    Rhino

32
Language limitations
  • Java needs code blocks!
  • Closures are important parts of other languages
  • They are more useful with dynamic typing
  • Continuations are important

33
Progress Report
  • Introduction
  • Philosophies
  • Process
  • Technologies
  • Conclusion

34
Predictions
  • Spring replaces EJB
  • EJB will struggle
  • Again
  • Theyre late
  • Both annotations and AOP will get us into
    trouble, in spots
  • Java meta-programming increases
  • Moving more people to dynamic languages
  • REST will slowly subsume WebServices
  • Except maybe SOAP
  • One dynamic language explodes (Ruby?)

35
Resources
  • Quick starts and philosophy books
  • Better, Faster, Lighter Java by Tate, Gehtland
  • Spring Developer Notebook by Tate, Gehtland
  • Make sure you get the reprint
  • Hibernate Developer Notebook by Elliot
  • References
  • Pro Spring
  • Hibernate in Action
  • REST tutorial http//www.xfront.com/REST.html
  • Spring Good article http//www.sys-con.com/story/
    print.cfm?storyid47735
  • Lightweight development series on DeveloperWorks
Write a Comment
User Comments (0)
About PowerShow.com