1 / 120

Agile Java Development With Spring, Hibernate and Eclipse

Agile Java Development With Spring, Hibernate and Eclipse. Anil Hemrajani anil@visualpatterns.com. About This Presentation. Not a tutorial on any one technology! Overview of each technology (use website, books, etc. for details) Downloadable code (working application)

bella
Download Presentation

Agile Java Development With Spring, Hibernate and Eclipse

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Agile Java Development With Spring, Hibernate and Eclipse Anil Hemrajani anil@visualpatterns.com

  2. About This Presentation • Not a tutorial on any one technology! • Overview of each technology (use website, books, etc. for details) • Downloadable code (working application) • Latest buzz in the US, Europe, etc. • End-to-end system! • Requirements • Architecture/design • Java development and debugging • Deployment • Logging/monitoring • Advanced considerations • Content/format (text, graphs, code, comics)

  3. Material In This Presentation Taken Directly From My Book Agile Java Development With Spring, Hibernate and Eclipse Forewords by Scott W. Ambler and Rod Johnson Introduction to Agile Java Development The Sample Application: An Online Timesheet System XP and AMDD-Based Architecture and Design Modeling Environment Setup: JDK, Ant, and JUnit Using Hibernate For Persistent Objects Overview of the Spring Framework The Spring Web MVC Framework The Eclipse Phenomenon Logging, Debugging, Monitoring and Profiling Beyond the Basics What Next? Parting Thoughts Appendices (with lots of goodies) available on amazon.com

  4. My Background (details at VisualPatterns.com) • 20 years of experience in the IT • Working with Java Technology since late 1995 as a developer, entrepreneur, author, and trainer. • Helped several Fortune 100 companies (some smaller organizations) • Published a book and 30 articles • Presented at conferences and seminars around the world • Awards: • "Outstanding Contribution to the Growth of the Java Community" • "Best Java Client" for BackOnline (a Java-based online backup product) • nominated for a Computerworld-Smithsonian award by Scott McNealy • Founder of: • Isavix Corporation – successful IT solutions company (now Inscope Solutions) • DeveloperHub.com (formerly isavix.net) - award-winning online developer community (grew to over 100,000 registered members) • At present – VisualPatterns.com and AgileDraw.org

  5. Practical Stuff, Not Fluff! • Recently completed project for U.S. Fortune 50 company • Application • Financial application process billions of $ every week • Clustered application (99.9% uptime required) • Used most the technologies covered in presentation(spring, hibernate, eclipse, ant, JUnit…)

  6. Agenda • Introduction to Agile Java Development • Agile Processes • Agile Modeling • Agile Development • Environment Setup: Directory Structure, JDK, Ant and JUnit • Using Hibernate For Persistent Objects • (Short Break) • The Spring Framework • The Eclipse Phenomenon! • Logging, Debugging, Monitoring, and Profiling • Beyond The Basics

  7. Introduction to Agile Java Development Assume simplicity. Travel light. - Agile Modeling principles: agilemodeling.com

  8. What Is Agile Java Development? It Could Include… • Agile Software Lifecycle Processes (e.g. Scrum, XP, TDD) • Agile Architecture/Design Modeling • Incremental (just-in-time) design • “Good enough” diagrams • Agile Model Driven Development (AMDD) • Agile Java Design/Development • Simple design and coding! • Test-driven development (TDD) • Efficient frameworks and tools (Ant, JUnit, Hibernate, Spring, Eclipse…) • Plain Old Java Objects (POJOs), whenever possible

  9. Sample (Time Sheet) Application Used In This Presentation Downloadable code: visualpatterns.com/resources.jsp

  10. Agile Processes Requirements change. Design evolves. Documents are seldom current.

  11. Some Stats by The Standish Group (standishgroup.com)

  12. The Solution CHAOS Ten – Success Factors source: standishgroup.com In 2001, seventeen methodologists came together to unify their methodologies under one umbrella; they jointly defined the term, Agile! Read story at: martinfowler.com/articles/agileStory.html

  13. AgileManifesto.org

  14. What Does “Agile” Exactly Mean? The Term Agile incorporates a wide range of methods, for example: • AM - Agile Modeling • ASD - Adaptive Software Development • AUP - Agile Unified Process • Crystal • FDD - Feature Driven Development • DSDM - Dynamic Systems Development Method • Lean Software Development • Scrum • Xbreed • XP - eXtreme Programming

  15. software software software software software software Agility - All About Smaller Chunks (Shorter/Frequent Cycles) Release 2 Release 1 Iteration 0 Iteration 1 Iteration n Iteration 0 Iteration 1 Iteration n ... ... ... Incrementally Build Software - Highest Priority Features First!

  16. Agile Method: Scrum • Simple process for product/project management • Product Backlog - List of known features/changes for product • Sprint - 1-month iterations (develop highest priority items) • Meetings • Sprint Planning Meeting – Done at beginning of each sprint (after planning, features moved from product backlog to sprint backlog) • Daily scrum meeting (short: 15 minutes) • Sprint review meeting

  17. Extreme Programming (XP) • Shorter and Frequent Cycles (smaller chunks!) • Release - Quarterly Cycles (set a theme) • Iteration - Weekly Cycles (e.g. aim for last day of week) • 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 • Communications - Sit Together, Informative Workspace, on-site customer • Flow - sustainable pace versus rigid phases; velocity, continuous integration • Others… visit extremeprogramming.org

  18. Presentation Outline • Introduction to Agile Java Development • Agile Processes • Agile Modeling • Agile Development • Environment Setup: Directory Structure, JDK, Ant and JUnit • Using Hibernate For Persistent Objects • The Spring Framework • The Eclipse Phenomenon! • Logging, Debugging, Monitoring, and Profiling • Beyond The Basics

  19. Agile Modeling “...your goal is to build a shared understanding, it isn’t to write detailed documentation.” - Scott W. Ambler

  20. Quick Poll Have you ever been on a project where documentation was kept up-to-date through end of project?

  21. Agile Model Driven Development (AMDD) • Subset of Agile Modeling (agilemodeling.com) • Agile version of Model Driven Development (MDD) • Instead of extensive models, “barely good enough” • Initial modeling activity • Requirements • Architecture • Requirements modeling • Usage models • Domain models • UI models • Architecture modeling • Free-form diagrams • Change cases

  22. Project Initiation

  23. Problem Statement Our employees currently submit their weekly hours worked using a paper-based timesheet system that is manually intensive and error-prone. We require an automated solution for submitting employee hours worked, in the form of an electronic timesheet, approving them, and paying for the time worked. In addition, we would like to have automatic notifications of timesheet status changes and a weekly reminder to submit and approve employee timesheets.

  24. Project Kickoff Meeting

  25. scope table,glossary, etc. domain model user stories UI prototype& flow map architecture ReleaseLevelModels acceptancetests CRC cards applicationflow map UML diagrams databasemodel IterationLevelModels Choices Of Release (High) Level Models Model with a purpose -- shared understanding!

  26. Sample Scope Table Shared understanding: what's in and what's out

  27. Domain Model Shared understanding: business concepts > key domain objects

  28. 3 XP Style User Story Card Use Case - Casual, Brief or Fully Dressed User Stories Or Use Cases Shared understanding: features required of software

  29. User Interface (UI) Prototype Shared understanding: functionality, look-and-feel, etc.

  30. UI Flow Map (Storyboard) Shared understanding: user interface navigation/flow

  31. High-Level Architecture Diagram RDBMS (Oracle) ControllerSpringDispatcherServlet Model Business objects, Hibernate beans Web Browser HTTP JDBC View JSP/HTML SpringScheduler Objects managed by Spring IoC Container BEA WebLogic Server Shared understanding: technologies, scalability, security, reliability

  32. Glossary - List Of Common Business/Technical Terms • AccountingThe accounting department/staff. • ApprovedStatus of a timesheet when a Manager approves a previously submitted timesheet. • EmployeeA person who works on an hourly basis and reports to a manager. • PaidStatus of a timesheet when the accounting department has issued a check. • Etc… Shared understanding: common terminology

  33. scope table,glossary, etc. domain model user stories UI prototype& flow map architecture ReleaseLevelModels      acceptancetests CRC cards applicationflow map UML diagrams databasemodel IterationLevelModels Choices Of Iteration Level (Detailed) Models

  34. Acceptance Tests (Serve As Detailed Requirements) • Sign In • The employee id can be up to 6 characters. The password must be between 8 and 10 characters. • Only valid users can sign in. • Timesheet List • Only a user's personal timesheets can be accessed. • Enter Hours • Hours must contain numeric data. • Daily hours cannot exceed 16 hours. Weekly hours cannot exceed 96 hours. • Hours must be billed to a department. • Hours can be entered as two decimal places. • Employees can only view and edit their own timesheets.

  35. Active Stakeholder Participation (With Business Representative)

  36. free-form architecture domain model Timesheet List screen Exploring Classes Using CRC Cards Second, let's explore classes on CRC cards using both as input models First, let's reflect on what we know, domain model, UI and architecture

  37. Application Flow Map (Home Grown Artifact) • Complementary to class diagrams and CRC cards • Can be extended using CRUD columns

  38. UML Class and Package Diagrams

  39. Physical Models Implementation Conceptual Models THE FINAL AND LASTING ARTIFACTS! Data Base Code Base UI prototype& flow map Focus Is On Working Software vs. Comprehensive Documentation problemstatement scopetable domain model  user stories glossary UIprototypes “…your goal is to build a shared understanding, it isn’t to write detailed documentation.” - Scott W. Ambler architecture databasemodel acceptancetests CRC cards  applicationflow map UML diagrams

  40. Shifting Some Upfront Design to Refactoring

  41. Shifting Some Upfront Design To Refactoring (Continuous Design) • Refactoring is not a new concept; the term is relatively new • 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 • Over 100 refactoring techniques; for example: • Extract superclass • Extract interface • Move class • Move method

  42. UI Flow Map High-Level Architecture Conceptual Class Diagram Agile Draw - Elegantly Simple Modeling Technique Visit AgileDraw.org

  43. Presentation Outline • Introduction to Agile Java Development • Agile Processes • Agile Modeling • Agile Development • Environment Setup: Directory Structure, JDK, Ant and JUnit • Using Hibernate For Persistent Objects • The Spring Framework • The Eclipse Phenomenon! • Logging, Debugging, Monitoring, and Profiling • Beyond The Basics

  44. Agile Java Development: Environment Setup (Directory Structure, JDK, Ant, and JUnit)

  45. Quick Poll How many of you are using Ant, JUnit, Maven, Cruise Control, etc?

  46. Personal Opinion: Early Environment Setup Is Essential • Involves more than people expect/plan • Cycle 0 • Get minimal environment setup (scripts, directory, version control, etc.) • Get end-to-end demo working • Helps team

  47. Directory Structure, Naming Conventions, Version Control, etc. • controller/TimesheetListController.java • model/Timesheet.java • model/TimesheetManager.java • test/TimesheetListControllerTest.java • test/TimesheetManagerTest.java • view/timesheetlist.jsp

  48. Ant (ant.apache.org) • Ant task types • Compile tasks (that is, javac) • Deployment tasks • File tasks such as copy, delete, move, and others. • Property tasks for setting internal variables • Audit/coverage tasks • Database tasks • Documentation tasks • Execution tasks • Mail tasks • Preprocess tasks • Property tasks • Remote tasks • Miscellaneous tasks (e.g. echo) <ftp server="mirrors.kernel.org" action="get" remotedir="/gnu/chess" userid="anonymous" password="guest@guest.com" verbose="yes" binary="yes"> <fileset file="README.gnuchess"/> </ftp> <mail tolist="friend@somehost.com" subject="Hello!" from="me@myhost.com" mailhost="myhost.com" user="myuserid" password="mypassword"/>

  49. JUnit (junit.org) • Originally written by • Erich Gamma (Gang of Four, Design Patterns) • Kent Beck (author of Extreme Programming and Test Driven Development) • Simple framework – various assert methods • assertEquals • assertFalse • assertNotNull • assertNotSame • assertNull • assertSame • assertTrue public class SimpleTest extends junit.framework.TestCase { int value1 = 2, value2 = 3, expectedResult = 5; public static void main(String args[]) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(SimpleTest.class); } public void testAddSuccess() { assertTrue(value1 + value2 == expectedResult); } }

  50. JUnit GUI Based Testing Console Runner Eclipse Plug-in

More Related