![Page 1: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/1.jpg)
Pragmatic Application Building: Step by Step
Jay Sissom
Principal Systems Analyst
Indiana University
![Page 2: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/2.jpg)
Code
public interface Presenter() { public String talk();}
public Jay implements Presenter { public String talk() { return “Welcome”; }}
![Page 3: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/3.jpg)
Agenda
• Overview
• Tools
• Architecture
• The Steps!
![Page 4: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/4.jpg)
Quote
"Things should be made as simple as possible, but no simpler.”
Albert Einstein
![Page 5: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/5.jpg)
Overview
• Developing Enterprise Applications is HARD!• IU has developed 10+ Enterprise Applications in
Java in the last 3 years• Teams were made up of 1 to 10 developers• Most developed using the Rational Unified
Process• RUP didn’t work well for our developers• We were looking for a better way to build
applications
![Page 6: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/6.jpg)
Methodologies
• Problems with previous methodologies Process driven Difficult to keep up with changes Time consuming Inefficient Sometimes less than satisfactory results Inflexible – requirements do change
![Page 7: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/7.jpg)
Overview
• A new Methodology was used to build the Pre-Disbursement Processor application
• We had a team of five to build this application Project Manager Lead Java Developer Java Developer Batch Developer Project Consultant
![Page 8: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/8.jpg)
Overview
Other
Libraries
SIS
Purchasing
PDP
Banks
Direct Deposit
Check Printing
![Page 9: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/9.jpg)
Tools - Application Frameworks
• OJB 1.0 - Object/Relational Mapping
• Spring Framework 1.0 - Application Framework
• Struts 1.1 - User Interface Framework
• Log4j 1.2 - Debug Logging
• jUnit 3.8 - Testing Framework
![Page 10: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/10.jpg)
Tools - Development Tools
• Java 1.4 - Java Virtual Machine
• Eclipse 3.0 - Integrated Development Environment
• MyEclipse 3.8 - Web/XML plugin to Eclipse
• Tomcat 5.0 - Servlet Container
• CVS - Source Code Version Control
![Page 11: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/11.jpg)
Tools - Server Platform
• RedHat Advanced Linux - Operating System
• Sun JDK 1.4 - Java Virtual Machine
• Tomcat 5.0 - Servlet Container
• Apache 2.0 - Web Server
![Page 12: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/12.jpg)
Architecture
• Key Objectives Design highly functional and flexible software Technology choices based on industry standard, open
source, and “proven” solutions Deliver applications via loosely-coupled components
and services with clearly defined APIs Leverage core “IT assets” Emphasize code re-use/reduce redundancy
![Page 13: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/13.jpg)
Service Based Architecture
• Services are loosely coupled
• Services have well-defined interfaces and are reusable
• Focus on business processes
![Page 14: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/14.jpg)
Service Based Architecture
DataAccessObjects(DAO)
DataAccessObjects(DAO)
ServiceService
StrutsActionsStruts
Actions
StrutsFormsStrutsForms
Business ObjectsBusiness Objects
Ser
vice
Inte
rfac
e
DA
O In
terf
ace
![Page 15: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/15.jpg)
DAO - Data Access Object
• DAO’s talk to datasources to create, retrieve, update and delete data
• No business logic allowed• All JDBC, SQL and/or OJB features should
be contained within these objects• No JDBC, SQL and/or OJB objects should
be exposed• Generally one DAO per entity
![Page 16: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/16.jpg)
DAO Interface
• Java interfaces for DAO objects
• Services should only be aware of the interface, not actual DAO implementation
• The interface allows the use of Mock objects when testing
![Page 17: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/17.jpg)
Service
• Used for business logic
• Call DAO’s to access data
• Should not contain SQL, JDBC or web specific information
• Each method will be a single database transaction
![Page 18: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/18.jpg)
Server Interface
• Java interfaces for Service objects
• The interface allows the use of Mock objects when testing
![Page 19: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/19.jpg)
Struts Actions
• Web user interface logic
• No business logic
• Call Services for business logic
• Generally should only call a single method in a service object
![Page 20: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/20.jpg)
Struts Forms
• Only used when a user posts a form to the server
• All user edited fields are String properties
• Validation should just validate that fields have the proper format
• Validation in the Struts Action should call business logic
• Action Forms can contain Business Objects
![Page 21: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/21.jpg)
Business Object
• A Business object is a Javabean (POJO)• There should be a business object for each entity
in the application• Business objects can be used in any tier of the
application• In most cases, Business objects will be OJB data
objects• Entity specific business logic can be in Business
objects
![Page 22: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/22.jpg)
Isolation
• Each tier should be isolated from other tiers
• A tier shouldn’t have knowledge of how a different tier is implemented
• A tier should only communicate to another tier through a Java interface
• The Spring framework can handle dependencies so each tier is truly isolated
![Page 23: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/23.jpg)
Dependency Injection
• Spring will pass dependant objects via calls set methods on managed objects so client objects don’t need to know details about how a dependant object works
• The dependencies are built into Spring’s context.xml file
![Page 24: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/24.jpg)
Declarative Transactions
• Spring will manage transactions if they are defined in the context.xml
• No code is required to begin, rollback or commit a transaction
• No code is required to open and close database connections
• Spring handles this automatically• Less code to maintain is a good thing!
![Page 25: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/25.jpg)
Declarative Transactions
• Each method call into a service object is a transaction
• Spring automatically begins the transaction before the method call and ends it after
• If the method throws a runtime exception, Spring rolls back the transaction
![Page 26: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/26.jpg)
Exceptions
• Runtime Exceptions Use when situation is non-recoverable
• Checked Exceptions Use when situation is recoverable
• Best Practice - fail as soon as possible The closer the failure to the problem, the easier it is to
find the problem
• Best Practice - fail big Hidden failures make it more difficult to fix the problem
![Page 27: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/27.jpg)
The Steps
• An Application is a collection of Use Cases
• One Use Case is implemented at a time
• Only develop functionality for the current use case - resist developing for future use cases
![Page 28: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/28.jpg)
Step One: Review Use Case
• Review the Use Case Do you understand it? Is it complete?
• Work with functional people until it is clear and has all the information required for development
![Page 29: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/29.jpg)
Step Two: Build a Prototype
• Users want to see what will be developed
• Most users can’t “visualize” a use case
• Update the use case based on the approved prototype, if necessary
• The HTML from the prototype can be used in your implementation
![Page 30: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/30.jpg)
Step Three: Build an Outline
• Create all the objects/methods required for the use case
• Don’t implement the methods yet
![Page 31: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/31.jpg)
Step Four: Test/Implement
• You can give this task to your less experienced developers
• Build unit tests first, then implement OR
• Build the implementation, then unit tests
• Make sure to do both
![Page 32: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/32.jpg)
Step Five: Refactor
• Look for duplicate code
• Look for common functionality
• Look for unclear code
• Refactor to fix these problems
• Unit tests will make sure nothing broke
![Page 33: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/33.jpg)
Step Six: User Testing
• Let the end user test the implemented use case
• They will probably find problems with the use case they wrote!
• Make sure this use case works the way the users want it to work
![Page 34: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/34.jpg)
Next Steps
• Repeat these steps for each use case
• When there are no more use cases, your application is done!
• Refactoring and testing are the keys to this methodology
![Page 35: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/35.jpg)
Quote - Revisited
"Things should be made as simple as possible, but no simpler.”
Albert Einstein
![Page 36: Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University jsissom@indiana.edu](https://reader036.vdocuments.us/reader036/viewer/2022062308/56649d595503460f94a395c4/html5/thumbnails/36.jpg)
Summary
• The PDP application was built within the allotted time and budget
• It is possible to follow a simple methodology to build enterprise applications
• This is one methodology that can be used to successfully complete your applications