Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

What is FenixEdu?

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

Academic Learning Drive Gears

Slide 8

Slide 8 text

The platform for your organization

Slide 9

Slide 9 text

2015

Slide 10

Slide 10 text

2015 2014 2013 2012 2011 2010 2009

Slide 11

Slide 11 text

2002 2008 2007 2006 2005 2004 2003

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Development was too slow

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

Domain Modelling Language

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

OJB XML ! DML

Slide 26

Slide 26 text

Persistent Software Transactional Memory

Slide 27

Slide 27 text

Database-like transactions…

Slide 28

Slide 28 text

… only in memory!

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

Fast Growth

Slide 35

Slide 35 text

User Person

Slide 36

Slide 36 text

1.2M LoC 1350 Entities 1800 Relations

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

Modularization

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

Challenges

Slide 41

Slide 41 text

Monolithic application

Slide 42

Slide 42 text

Monolithic environment

Slide 43

Slide 43 text

New Mindset

Slide 44

Slide 44 text

New Technologies

Slide 45

Slide 45 text

Build System

Slide 46

Slide 46 text

Modular Fenix Framework

Slide 47

Slide 47 text

Infrastructure Extraction

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

UI Evolution

Slide 53

Slide 53 text

Struts 1

Slide 54

Slide 54 text

Early Attempts

Slide 55

Slide 55 text

public class FindSpacesDA extends DispatchAction { }

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

Renderers Framework

Slide 58

Slide 58 text

No Struts can last forever…

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

UI Framework Revolution

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Over 3000 distinct interfaces

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

Bennu Portal

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

Functionalities only render their body

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

• UI Code declares what functionalities it exposes • Dynamic model built from declared functionalities • Auto-injected theme with full menu • Easily support many presentation technologies

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

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

Slide 71

Slide 71 text

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