Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bringing a Legacy Java Application to 2015

Bringing a Legacy Java Application to 2015

Eb987f4f2b2d43faa8b3b5a377713913?s=128

João Carvalho

April 23, 2015
Tweet

Transcript

  1. Bringing a Legacy Java Application to 2015 PT JUG -

    23 Abril 2015 João Carvalho Chief Software Architect - FenixEdu
  2. What is FenixEdu?

  3. Software Development Advanced CS/SDE Training Improve Técnico Lisboa

  4. Software Development Advanced CS/SDE Training Improve Técnico Lisboa

  5. Advanced CS/SDE Training Software Development Improve Técnico Lisboa

  6. Advanced CS/SDE Training Improve Técnico Lisboa Software Development

  7. Academic Learning Drive Gears

  8. The platform for your organization

  9. 2015

  10. 2015 2014 2013 2012 2011 2010 2009

  11. 2002 2008 2007 2006 2005 2004 2003

  12. None
  13. Presentation Tier — Based on Struts Application Tier POJO’s Persistence

    Tier — Based on OJB XML Configuration Service Manager Services Filters XML Configuration DTO’s XML Configuration Data Repository JDBC JSP Views Actions SQL Statements
  14. None
  15. A new feature in 11 simple steps 1. Create a

    POJO to represent the domain object 2. Write the SQL schema to store the domain object 3. Write the xml configuration to map the POJO against the SQL schema 4. Write SQL statements for custom reading of the domain object (in case something other than a read by ID or a read all was necessary) 5. Create data transfer objects for passing information to the presentation tier 6. Write services at the application level for creating, reading, updating and deleting the domain object 7. Write access control filters to limit who can invoke services 8. Write service and filter configurations in a xml file 9. Create JSP views for presenting information to the users 10. Write Actions to handle user requests 11. Configure struts xml files to specify the application flow
  16. http://android-france.fr/2012/03/14/google-play-developpeurs-impayes/angry-developer/

  17. Development was too slow

  18. https://www.openhub.net/p/fenixedu/analyses/latest/languages_summary

  19. Modularity Native Java ORM Highly Consistent Persistent STM Multiple Persistency

    Backends Transaction Management Consistency Predicates Transaction Introspection Lifecycle Events JSON Support Domain Introspection Opacity Isolation Conflict-free Reads In-Memory Fenix Framework
  20. Domain Modelling Language

  21. DML • Declarative language to reify rich domain models •

    Java-like syntax • jOOQ-style code generation
  22. Classes public class User { protected String username (REQUIRED); protected

    String password; protected String salt; protected DateTime created; public LocalDate expiration; public String email; public Locale preferredLocale; } domain.dml
  23. Custom Types valueType java.util.Locale as Locale { externalizeWith { String

    toLanguageTag(); } internalizeWith forLanguageTag(); } OR valueType java.util.Locale as JsonLocale { externalizeWith { String getLanguage(); String getCountry(); } }
  24. Relations relation SystemUsers { protected Bennu playsRole bennu { multiplicity

    1..1; } protected User playsRole user { multiplicity *; } }
  25. OJB XML ! DML

  26. Persistent Software Transactional Memory

  27. Database-like transactions…

  28. … only in memory!

  29. atomic { origin.withdraw(100); destination.deposit(100); }

  30. atomic(() -> { origin.withdraw(100); destination.deposit(100); });

  31. STM Properties • Strict Object Equality • Simplified transaction control

    • Stronger correctness guarantees • No locking! • Conflict-free reads
  32. Presentation Tier — Based on Struts Application Tier Persistence Tier

    — Fenix Framework Based Service Manager Services Filters XML Configuration Domain Objects XML Configuration Data Repository JDBC JSP Views Actions DML Configuration
  33. https://www.openhub.net/p/fenixedu/analyses/latest/languages_summary

  34. Fast Growth

  35. User Person

  36. 1.2M LoC 1350 Entities 1800 Relations

  37. • Long Compilation Times • Large Memory Requirements • Poor

    expandability • Poor encapsulation • Easy to break domain constraints
  38. Modularization

  39. • Separation of Concerns • Better Abstractions • Encapsulation •

    Independent Roadmaps • Development process improvements • Reusability
  40. Challenges

  41. Monolithic application

  42. Monolithic environment

  43. New Mindset

  44. New Technologies

  45. Build System

  46. Modular Fenix Framework

  47. Infrastructure Extraction

  48. User Management Legacy technologies integration Spring Struts Faces Agnostic storage

    support Cron Tasks Runtime manual tasks Domain Browser Messaging Event driven programming Modular System Portal Runtime modifable Menu Themable Runtime configuration User authentication REST infrastructure Full OAuth Stack Transactional IO Indexing Searching Internationalization Client Toolkit Bootstrap Bennu Fine grain user groups JavaScript pluggability WebSockets Multi Language
  49. Bennu • Web framework for Fenix Framework-based applications • Application

    Configuration and monitoring (including full domain browser and analytics) • Security: user management, logins, groups • Localization support • Full JAX-RS Integration and JSON Support • Multi-backend File Storage
  50. Bennu Scheduling • Similar to Quartz Scheduler • Standard Cron-Style

    tasks • Ability to execute custom code on the running application
  51. Bennu Extensions • Full OAuth2 server support • Nashorn support

    • Common Spring/JAX-RS argument converters • Configurable Exception Handling • Modular Application Bootstrap
  52. UI Evolution

  53. Struts 1

  54. Early Attempts

  55. public class FindSpacesDA extends DispatchAction { }

  56. @Mapping(module = "public", path = "/findSpaces") @Forward(name = "listFoundSpaces", path

    = "/public/spaces/ findSpaces.jsp") public class FindSpacesDA extends DispatchAction { }
  57. Renderers Framework

  58. No Struts can last forever…

  59. None
  60. UI Framework Revolution

  61. None
  62. Over 3000 distinct interfaces

  63. How to make them work together? While keeping a consistent

    design across the application?
  64. Bennu Portal

  65. Bennu Portal • UI Integration Framework • Uniform styling across

    the application • Dynamically configurable theme • Request Dispatcher/Router • Dynamic menu construction and rendering • Out-of-the-box scaffolding for web applications
  66. Functionalities only render their body

  67. None
  68. • UI Code declares what functionalities it exposes • Dynamic

    model built from declared functionalities • Auto-injected theme with full menu • Easily support many presentation technologies
  69. None
  70. Contact Us http://fenixedu.org/dev github.com/fenixedu facebook.com/fenixedu hello@fenixedu.org

  71. Bringing a Legacy Java Application to 2015 PT JUG -

    23 Abril 2015 João Carvalho Chief Software Architect - FenixEdu