Professional Documents
Culture Documents
Anil Hemrajani
anil@visualpatterns.com
• Founder of:
Isavix Corporation – successful IT solutions company (now InScope Solutions)
Isavix Community (now DeveloperHub.com) - award-winning online developer
community (grew to over 100,000 registered members)
• Application
Financial application process billions of $ every week
Assume
Assumesimplicity.
simplicity.
Travel
Travellight.
light.
- -Agile
AgileModeling
Modelingprinciples:
principles:agilemodeling.com
agilemodeling.com
Requirements
Requirementschange.
change.
Design
Designevolves.
evolves.
Documents
Documentsare
areseldom
seldomcurrent.
current.
InIn2001,
2001,seventeen
seventeensoftware
softwarepundits
punditscame
cametogether
togethertotounify
unify
their
theirmethodologies
methodologiesunder
underone
oneumbrella;
umbrella;they
theyjointly
jointlydefined
defined
the term, Agile!
the term, Agile!
Read
Readstory at:martinfowler.com/articles/agileStory.html
storyat: martinfowler.com/articles/agileStory.html
• Others…
Release 1 Release 2
Iteration
0
Iteration
1
... Iteration
n
Iteration
0
Iteration
1
... Iteration
n
...
Incrementally
IncrementallyBuild
BuildSoftware
Software--Highest
HighestPriority
PriorityFeatures
FeaturesFirst!
First!
software
software
software
software software
software software
software software
software software
software
10-minute builds
Continuous integration (multiple times per day; manual or automatic)
Incremental Design and Planning (defer investment till needed)
Development in small increments using Test-First development
“...your
“...yourgoal
goalisistotobuild
buildaashared
sharedunderstanding,
understanding,ititisn’t
isn’ttoto
write
writedetailed
detaileddocumentation.”
documentation.”
- -Scott
ScottW.
W.Ambler
Ambler
Practices Principles
"A
"A preliminary
preliminary work
work or or construction
construction
that
that serves
serves as
as aa plan
plan from
from which
which aa
final
final product
product isis to
to be
be made
made ...
... used
used
in
in testing
testing or
or perfecting
perfecting aa final
final
product."
product."
Word “model” used to describe diagrams
and other artifacts, in this presentation.
• Requirements modeling
Usage models
Domain models
UI models
Let’s
Let’s apply
apply this
this
• Architecture modeling to
to aa sample
sample
Free-form diagrams
application,
application,
Change cases
next
next ...
...
© Visual Patterns, Inc. 23
Initiating A New Software Application Project
Our
Ouremployees
employeescurrently
currentlysubmit
submittheir
theirweekly
weekly
hours
hoursworked
workedusing
usingaapaper-based
paper-basedtimesheet
timesheet
system
systemthat
thatisismanually
manuallyintensive
intensiveand
anderror-
error-
prone.
prone.
We
Werequire
requirean
anautomated
automatedsolution
solutionfor
for
submitting
submittingemployee
employeehours
hoursworked,
worked,ininthe
theform
form
of
ofan
anelectronic
electronictimesheet,
timesheet,approving
approvingthem,
them,
and
andpaying
payingfor
forthe
thetime
timeworked.
worked.
In
Inaddition,
addition,we
wewould
wouldlike
liketo
tohave
haveautomatic
automatic
notifications
notificationsof
oftimesheet
timesheetstatus
statuschanges
changesand
andaa
weekly
weeklyreminder
reminderto tosubmit
submitand
andapprove
approve
employee
employeetimesheets.
timesheets.
Release
scope
scopetable,
table, UI
UIprototype
prototype
Level domain
domainmodel
model user
userstories
stories architecture
architecture
Models glossary,
glossary,etc.
etc. &&flow
flowmap
map
Iteration
acceptance
acceptance application
application UML
UML database
database
Level CRC
CRCcards
cards
Models tests
tests flow
flowmap
map diagrams
diagrams model
model
Scope Functionality
Include Time Expression will provide the capability to enter, approve, and
pay for hours worked by employees.
Defer Time Expression will not calculate deductions from paychecks, such
as federal/state taxes and medical expenses.
Defer Time Expression will not track vacation or sick leave.
Shared
Sharedunderstanding:
understanding:what's
what'sininand
andwhat's
what'sout
out
Shared
Sharedunderstanding:
understanding:business
businessconcepts
concepts>>key
keydomain
domainobjects
objects
Description
This process allows User to log into the System
Actors/Interfaces
XP Style User Story Card • FM Trader
• The System
Trigger
Userperforms a Login acti
on
Preconditions
• N/A
Success/BasicFlow
1. The System displaysthe Loginpanel rop mpting User forlogindetails
as speci
fi
ed in
the
2. Usercom pletes all lds and performs a Submit action.
required fie
Failure/Alternative Flow
InvalidUserID and/ orPassword- The systemnoti
fiesFM trader
with themessage“ Invalid
User
ID and/ or Password
”. The systemdisplaystheLoginpaneltoUserwith thecontentsofallfield
s
empty.
Shared
Sharedunderstanding:
understanding:features
featuresrequired
requiredofofsoftware
software
© Visual Patterns, Inc. 30
User Interface (UI) Prototype
Shared
Sharedunderstanding:
understanding:functionality,
functionality,look-and-feel,
look-and-feel,etc.
etc.
© Visual Patterns, Inc. 31
UI Flow Map (Storyboard)
Shared
Sharedunderstanding:
understanding:user
userinterface
interfacenavigation/flow
navigation/flow
© Visual Patterns, Inc. 32
High-Level Architecture Diagram
Web HTTP
Controller Model JDBC
Spring Business objects,
RDBMS
Browser DispatcherServlet Hibernate beans (Oracle)
View Spring
Scheduler
JSP/HTML
Shared
Sharedunderstanding:
understanding:technologies,
technologies,scalability,
scalability,security,
security,reliability
reliability
© Visual Patterns, Inc. 33
Glossary - List Of Common Business/Technical Terms
• Accounting
The accounting department/staff.
• Approved
Status of a timesheet when a Manager approves a previously
submitted timesheet.
• Employee
A person who works on an hourly basis and reports to a
manager.
• Paid
Status of a timesheet when the accounting department has
issued a check.
• Etc…
Shared
Sharedunderstanding:
understanding:common
commonterminology
terminology
© Visual Patterns, Inc. 34
Choices Of Iteration Level (Detailed) Models
Release
scope
scopetable,
table, domain
UI
UIprototype
prototype
Level
glossary, domainmodel
model user
userstories
stories architecture
architecture
Models glossary,etc.
etc. &&flow
flowmap
map
Iteration
acceptance
acceptance application
application UML
UML database
database
Level CRC
CRCcards
cards
Models tests
tests flow
flowmap
map diagrams
diagrams model
model
TimesheetManager
Timesheet
scope
domain table
domainmodel
model table
user
userstories
stories
UIUI glossary
prototypes glossary • •Model in Small Increments
prototypes architecture
architecture
Model in Small Increments
• •Depict Models Simply
Physical Models
Depict Models Simply
• •Discard temporary models
acceptance
acceptance
database
database Discard temporary models
tests model
tests CRC model
CRCcards
cards
• •Prove it with code
Prove it with code
application UML
application UML
flow map diagrams
flow map diagrams
- -agilemodeling.com
agilemodeling.com
Implementation THE FINAL AND LASTING ARTIFACTS!
Data UI prototype
DataBase
Base Code
UI Base
prototype
Code Base
& flow map
& flow map
• refactoring.com
“Refactoring is a disciplined technique for restructuring an existing body of
code, altering its internal structure without changing its external behavior.”
- Martin Fowler
High-Level Architecture
UI Flow Map
Visit
Visit AgileDraw.org
AgileDraw.org
Conceptual Class Diagram
➔controller/TimesheetListController.java
➔model/Timesheet.java
➔model/TimesheetManager.java
➔test/TimesheetListControllerTest.java
➔test/TimesheetManagerTest.java
➔view/timesheetlist.jsp
• Originally written by
Erich Gamma (Gang of Four, Design Patterns)
Kent Beck (author of Extreme Programming and Test Driven Development)
Console Runner
Eclipse Plug-in
More unit test code
If code passes the unit tests, it is done!
Can help design classes better (from a client/interface perspective)
More actual code
Refactor with confidence
• Relationships
unidirectional and bidirectional
relations in a relational database are bidirectional by definition
• Cardinality (OO term is multiciplicity)
One-to-one
one-to-many
many-to-one
and many-to-many
• Object Identity
• Cascade
• Others…
© Visual Patterns, Inc. 57
Hibernate Basics
• Dialect
(DB2, Microsoft SQL Server, MySQL, Oracle, PostgreSQL, SAP DB,
Sybase, TimesTen…)
Transaction tx = session.beginTransaction();
Department department = (Department)
session.get(Department.class, "IT");
System.out.println("Name for IT = " + department.getName());
...
...
sessionFactory.close();
• Deleting records
session.delete(Object), or
session.createQuery("DELETE from Timesheet")
• Many others
No Singletons
Builds on top of existing technologies (e.g. JEE, Hibernate)
Robust MVC web framework
Consistent database exception hierarchy (e.g. wrap SQLException)
© Visual Patterns, Inc. 69
Where Spring Framework Fits Into Our Architecture
Optional
Hibernate
integration
• Support for various view technologies and web frameworks (e.g. Struts,
webwork, tapestry, JSF)
1. Controller
2. ModelAndView
3. Command (Form
Backing) Object
4. Validator
5. Spring Tag
Library
(spring:bind)
mockHttpServletRequest =
mockHttpServletRequest =
new MockHttpServletRequest("GET",
new MockHttpServletRequest("GET",
"/timesheetlist.htm");
"/timesheetlist.htm");
ModelAndView modelAndView =
ModelAndView modelAndView =
timesheetListController.handleRequest(
timesheetListController.handleRequest(
mockHttpServletRequest, null);
mockHttpServletRequest, null);
assertNotNull(modelAndView);
assertNotNull(modelAndView);
assertNotNull(modelAndView.getModel());
assertNotNull(modelAndView.getModel());
1. EnterHoursController.java
2. EnterHoursValidator.java
3. enterhours.jsp
<spring:bind
<spring:bind path="command.employeeId">
path="command.employeeId">
<input
<input name='<c:out value="${status.expression}"/>'
name='<c:out value="${status.expression}"/>'
value='<c:out
value='<c:out value="${status.value}"/>'
value="${status.value}"/>'
type="text"
type="text" size="6"
size="6" maxlength="6">
maxlength="6">
</spring:bind>
</spring:bind>
• Other
Web Flow – gaining a lot of momentum! Wizard-like features.
Portlet API – based on JSR-168 Portlet Specification (jcp.org).
© Visual Patterns, Inc. 80
Spring ORM Module: Support for Hibernate
• Management of sessionfactory and session (no close calls)
getHibernateTemplate().saveOrUpdate(timesheet);
getHibernateTemplate().saveOrUpdate(timesheet);
• Much more
JEE support
Sub-projects (Acegi, BeanDoc, Spring IDE, etc.)
• Platform objectives
robust platform for highly integrated dev tools
enable view and/or editing of any content type
attract a large community of developers to develop plug-ins
• Projects
Application Development, editors, modeling, performance, testing, reporting,
and many more
© Visual Patterns, Inc. 87
Personal Opinion:
The Java versus
Microsoft Thing
7. Plug-ins (galore!)
sample workspace
JUnit
Ant Assist
Java Compile Errors/Warnings © Visual Patterns, Inc. 91
JDT: Other Notable Features
• Compile during save (within the blink of an eye)
• Formatting options
• Scrapbook
• TODO lists
• Others
Powerful search
Code refactoring (some based on Fowler's refactoring.com)
Export feature (create zip files, etc.)
• Editors
Source - HTML, JavaScript, CSS, JSP, SQL, XML, DTD, XSD, and WSDL
Graphical - XSD and WSDL
• Much more…
Database
Web Services
© Visual Patterns, Inc. 94
CVS (Eclipse Team Sharing)
Hibernate
Spring IDE
© Visual Patterns, Inc. 96
Startup Time Comparison To IntelliJ and NetBeans
NetBeans - 42 seconds.
Eclipse
Eclipsewith
withJDT,
JDT,WTP,
WTP,Hibernate,
Hibernate,Eclipse...
Eclipse...19
19seconds!
seconds!
• Breakpoints
• Step through
code
• Variable
inspection
• Hotswap
• Remote
debugging
Web Developer
<timex:periodcheck
<timex:periodcheck
checkDate="${command.periodEndingDate}">
checkDate="${command.periodEndingDate}">
<input
<input name="save"
name="save" type="submit"
type="submit" value="Save">
value="Save">
</timex:periodcheck>
</timex:periodcheck>
return TagSupport.SKIP_BODY;
}
User-level
authentication
& authorization
Wire protocol
(HTTP/S) Application-level
authentication
“A
“A generalizing
generalizing
specialist
specialist isis
someone
someone with with aa
good
good grasp
grasp ofof
how
how everything
everything
fits
fits together.”
together.”
--agilemodeling.com
agilemodeling.com
RON
RON STEVE
STEVE RAJ
RAJ SUSAN
SUSAN
© Visual Patterns, Inc. 116
VisualPatterns.com - Downloadable Application & Presentation
visualpatterns.com/resources.jsp
visualpatterns.com/resources.jsp
••Spring
Spring
••Hibernate
Hibernate
••Ant
Ant
••JUnit
JUnit
••DisplayTag
DisplayTag
••HSQLDB
HSQLDB
Model
Web Controller Model
Web HTTP
HTTP
Controller Business JDBC RDBMS
Spring Business JDBC RDBMS
Browser Spring objects,
Browser DispatcherServlet
DispatcherServlet
objects, (Oracle)
(Oracle)
Hibernate beans
Hibernate beans
View Spring
View Spring
Scheduler
JSP/HTML Scheduler
JSP/HTML
Objects managed by Spring IoC Container
Objects managed by Spring IoC Container
Planning Coding
• User stories are written. • The customer is always available.
• Release planning creates the • Code must be written to agreed
schedule. standards.
• Make frequent small releases. • Code the unit test first.
• The Proje ct Velocity is measured. • All production code is pair programmed.
• The project is divided into iterations. • Only one pair integrates code at a time.
• Iteration planning starts each • Integrate often.
iteration. • Use collective code ownership.
• Move people around. • Leave optimization till last.
• A stand -up meeting starts each day. • No overtime.
• Fix XP when it breaks.
Designing Testing
• Simplicity. • All code must have unit tests.
• Choose a system meta phor. • All code must pass all unit tests before it
• Use CRC cards for design sessions. can be released.
• Create spike solutions to reduce risk. • When a bug is found tests are created.
• No functionality is added early. • Acceptance tests are run often and the
• Refactor whenever and wherever score is published.
possible.
Comics
Cheat Sheets
R&D Concepts
© Visual Patterns, Inc. 118
THE END!
• agilemodeling.com
• agiledata.org Stay
Stayinintouch!
touch!
• agilemanifesto.org
• extremeprogramming.org Anil@VisualPatterns.com
Anil@VisualPatterns.com
• hibernate.org
• springframework.org
• eclipse.org
• code.google.com/webtoolkit/
• getahead.ltd.uk/dwr/