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

João Carvalho

April 23, 2015
Tweet

More Decks by João Carvalho

Other Decks in Programming

Transcript

  1. Bringing a Legacy Java
    Application to 2015
    PT JUG - 23 Abril 2015
    João Carvalho
    Chief Software Architect - FenixEdu

    View Slide

  2. What is FenixEdu?

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  7. Academic Learning
    Drive Gears

    View Slide

  8. The platform for your
    organization

    View Slide

  9. 2015

    View Slide

  10. 2015
    2014
    2013
    2012
    2011
    2010
    2009

    View Slide

  11. 2002 2008
    2007
    2006
    2005
    2004
    2003

    View Slide

  12. View Slide

  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

    View Slide

  14. View Slide

  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

    View Slide

  16. http://android-france.fr/2012/03/14/google-play-developpeurs-impayes/angry-developer/

    View Slide

  17. Development was
    too slow

    View Slide

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

    View Slide

  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

    View Slide

  20. Domain Modelling
    Language

    View Slide

  21. DML
    • Declarative language to reify rich domain models
    • Java-like syntax
    • jOOQ-style code generation

    View Slide

  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

    View Slide

  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();
    }
    }

    View Slide

  24. Relations
    relation SystemUsers {
    protected Bennu playsRole bennu {
    multiplicity 1..1;
    }
    protected User playsRole user {
    multiplicity *;
    }
    }

    View Slide

  25. OJB XML ! DML

    View Slide

  26. Persistent Software
    Transactional Memory

    View Slide

  27. Database-like
    transactions…

    View Slide

  28. … only in memory!

    View Slide

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

    View Slide

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

    View Slide

  31. STM Properties
    • Strict Object Equality
    • Simplified transaction control
    • Stronger correctness guarantees
    • No locking!
    • Conflict-free reads

    View Slide

  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

    View Slide

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

    View Slide

  34. Fast Growth

    View Slide

  35. User
    Person

    View Slide

  36. 1.2M LoC
    1350 Entities
    1800 Relations

    View Slide

  37. • Long Compilation Times
    • Large Memory Requirements
    • Poor expandability
    • Poor encapsulation
    • Easy to break domain constraints

    View Slide

  38. Modularization

    View Slide

  39. • Separation of Concerns
    • Better Abstractions
    • Encapsulation
    • Independent Roadmaps
    • Development process improvements
    • Reusability

    View Slide

  40. Challenges

    View Slide

  41. Monolithic application

    View Slide

  42. Monolithic environment

    View Slide

  43. New Mindset

    View Slide

  44. New Technologies

    View Slide

  45. Build System

    View Slide

  46. Modular Fenix Framework

    View Slide

  47. Infrastructure Extraction

    View Slide

  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

    View Slide

  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

    View Slide

  50. Bennu Scheduling
    • Similar to Quartz Scheduler
    • Standard Cron-Style tasks
    • Ability to execute custom code on the running
    application

    View Slide

  51. Bennu Extensions
    • Full OAuth2 server support
    • Nashorn support
    • Common Spring/JAX-RS argument converters
    • Configurable Exception Handling
    • Modular Application Bootstrap

    View Slide

  52. UI Evolution

    View Slide

  53. Struts 1

    View Slide

  54. Early Attempts

    View Slide

  55. public class FindSpacesDA extends DispatchAction {
    }

    View Slide

  56. @Mapping(module = "public", path = "/findSpaces")
    @Forward(name = "listFoundSpaces", path = "/public/spaces/
    findSpaces.jsp")
    public class FindSpacesDA extends DispatchAction {
    }

    View Slide

  57. Renderers Framework

    View Slide

  58. No Struts can last
    forever…

    View Slide

  59. View Slide

  60. UI Framework Revolution

    View Slide

  61. View Slide

  62. Over 3000 distinct
    interfaces

    View Slide

  63. How to make them work
    together?
    While keeping a consistent design across the application?

    View Slide

  64. Bennu Portal

    View Slide

  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

    View Slide

  66. Functionalities only
    render their body

    View Slide

  67. View Slide

  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

    View Slide

  69. View Slide

  70. Contact Us
    http://fenixedu.org/dev
    github.com/fenixedu
    facebook.com/fenixedu
    [email protected]

    View Slide

  71. Bringing a Legacy Java
    Application to 2015
    PT JUG - 23 Abril 2015
    João Carvalho
    Chief Software Architect - FenixEdu

    View Slide