Building modern enterprise applications from scratch: lessons learned DOAG 2014 Dr. Clemens Wrzodek @wrzodek
Roche Group Penzberg Founded 1896 in Basel, Switzerland Employing > 82,000 people Clear focus on healthcare Pharma Research and Early Development (pred) Informatics Provide informatic and bioinformatic services and tools to researchers
Focus of this talk Architecture Traditional Revised Web UI Server-side Client-side Backend Interfaces Integration
Great! A new project! Let s setup the architecture. DB Middle tier WebUI
Great! A new project! Let s setup the architecture. DB Middle tier WebUI This talk will focus on Java for the middle tier and Oracle as database.
Let s implement things! JPA DB Middle tier WebUI Technology choices have been similar to this for many years.
Why has it developed like this? DB Middle tier WebUI
Why has it developed like this? Our enterprise web servers are application platforms Requirements: Interactivity with users DB Middle tier WebUI Dynamic content MVC on server-side JavaEE Developer Client flow is determined and given by server, which holds sessions
Why has it developed like this? Our enterprise web servers are application platforms Requirements: Interactivity with users DB Middle tier WebUI Dynamic content MVC on server-side Client flow is determined and given by server, which holds sessions Browser is used as dumb terminal
Let s look aside! What about the big tech-companies? Platforms provide services Services are separated from applications Web 2.0: DB Middle tier WebUI Facebook Maps Twitter Application layer Service layer
Let s think again! Frontend architecture: SOFEA service oriented frontend architecture DB Middle tier WebUI Use Oracle functionality Takes care of integrity Provide resources, independent of workflow Processing unit Application flow MVC Database architecture similar to frontend?
Frontend technologies Architecture Web UI Backend Traditional Revised Server-side Client-side Interfaces Integration
WebUI: Overview Server-side Client-side Conclusion Frontend technologies APEX JSF / JSP GWT HTML5 / JavaScript Plain + JQuery Angular Ember
WebUI: Overview Server-side Client-side Conclusion Frontend technologies APEX JSF / JSP GWT HTML5 / JavaScript Availability of JavaScript Frameworks Plain + JQuery comparable Angular to situation with Java ~2006. Ember
WebUI: Overview Server-side Client-side Conclusion Frontend technologies Google trends
WebUI: Overview Server-side Client-side Conclusion Frontend technologies Server-side examples Server-side solutions Integrated development of WebUI and middle tier Server-side MVC Application runs on the server Need more bandwidth and server memory (stateful) Example: APEX PL/SQL (JavaScript) Smaller projects with focus on reporting and grid-editing Rapid application development Example: JSF Established and stable Usually, heavily coupled to the Backend Java code
WebUI: Overview Server-side Client-side Conclusion Frontend technologies Client-side examples Client-side solutions Application runs in the browser Client-side MVC Consumes services from servers Stateful Client Stateless Server Example: Google Web Toolkit (GWT) Java to JavaScript translator by Google, now open-source Easy to start for Java Developers Eclipse as IDE, Java Code with all it s advantages for large teams Many DOM Elements, not really lightweight
WebUI: Overview Server-side Client-side Conclusion Frontend technologies Client-side examples Example: JavaScript Yes, it is mature! Package management: npm Build tool: grunt Dependency management: Bower/requireJS IDE: WebStorm/Eclipse Testing: Jasmin/Karma/Protractor UI-Widgets: Bootstrap (Alternatives: MaterialDesign, Foundation, Pure, ) Frameworks AngularJS Ember
WebUI: Overview Server-side Client-side Conclusion Conclusion and remarks SOFEA is not a fat-client architecture No session timeouts No session clustering/replication More lightweight app servers Quicker client-side modifications and re-deployments High responsiveness and enhanced user-experience Why keeping the view and app flow on the server? Why having this many workarounds?
Ready for the lessons-learned Architecture Traditional Revised Web UI Server-side Client-side Backend Interfaces Integration
Lessons-learned 1. Know your team! Choose according to available knowledge. Don t underestimate the coolness of new technologies.
Lessons-learned 1. Know your team! Choose according to available knowledge. Don t underestimate the coolness of new technologies. 2. Choose according to project complexity.
Lessons-learned 1. Know your team! Choose according to available knowledge. Don t underestimate the coolness of new technologies. 2. Choose according to project complexity. 3. New technology vs. workarounds for existing technology
Lessons-learned 1. Know your team! Choose according to available knowledge. Don t underestimate the coolness of new technologies. 2. Choose according to project complexity. 3. New technology vs. workarounds for existing technology 4. Be professional! Also in UI code development!
Backend technologies Architecture Web UI Backend Traditional Revised Server-side Client-side Interfaces Integration
Backend: WebUI interface DB interface Use case Continuous integration Middle tier WebUI interfaces vs. DB Middle tier WebUI
Backend: WebUI interface DB interface Use case Continuous integration Middle tier WebUI interfaces SOAP vs. REST SOAP Simple object access protocol XML Requires dedicated protocol implementation on client-side Needs some time Secure +++ Stateful Service oriented (getstockprice) REST Representational state transfer JSON Describes the web-architecture ( It s the internet ) Easy to implement Secure ++ Stateless Resource oriented (/stock)
Backend: WebUI interface DB interface Use case Continuous integration Middle tier WebUI interfaces Digression: best-practice for REST API design http://www.example.com/api/1.1/cars HTTP methods for CRUD Querystring for filtering, sorting, paging /cars/?doors=4 HTTP Command GET POST PUT DELETE Operation Get Create new Update existing Delete HTTP Response codes (200 OK, 404 Not found, 405 Not allowed) vs. JSON object with status
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces DB Middle tier WebUI
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces DirectSQL Quick n dirty Unsecure Object-relational mapping (ORM) Very popular (JPA, Hibernate) Quick and easy, once it is setup Mostly uses database just for persistence PL/SQL API Java and PL/SQL share objects, Java calls PL/SQL API Business logic also in PL/SQL Recommended for complex inserts Allows using full oracle DB feature set
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Roche pharma research
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Roche pharma research Treatments for cancer
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Roche pharma research Treatments for cancer Cancer is due to proliferating cells
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Roche pharma research Treatments for cancer Cancer is due to proliferating cells Antibodies can be used to kill cancer cells
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Roche pharma research Treatments for cancer Cancer is due to proliferating cells Antibodies can be used to kill cancer cells Screening for antibodies results in many variants
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Roche pharma research Treatments for cancer Cancer is due to proliferating cells Antibodies can be used to kill cancer cells Screening for antibodies results in many variants Has one of these variants already been tested? Do we already know properties of one of these variants? Antibody registration on molecular level.
Backend: WebUI interface C H 2 C H 3 DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case 1. Check uniqueness Sequences Connections Properties 2. Register C H 2 C H 3 -S-S- -S-S- Sequences Connections Properties Domains Mutations
Backend: WebUI interface C H 2 C H 3 DB interface Use case Continuous integration C H 2 C H 3 Middle tier database interfaces Reasoning for PL/SQL API: A use-case Domains -S-S- -S-S- Decompose C H 2 C H 3 based on similarity to other sequences -S-S- -S-S- -S-S- -S-S- C H 2 C H 3
Backend: WebUI interface DB interface Use case Continuous integration Middle tier database interfaces Reasoning for PL/SQL API: A use-case Oracle Cartridge API for DNA sequence search Accelrys Cartridge for Chemistry searches Transaction with inserts / updates into 11 tables PL/SQL code for utilizing Oracle features ensuring integrity Performance Java code to simply INSERT or UPDATE Antibody-object
Backend: WebUI interface DB interface Use case Continuous integration Continous integration / delivery DB Middle tier WebUI
Backend: WebUI interface DB interface Use case Continuous integration Continous integration / delivery Continous integration Write Unit tests Test PL/SQL Packages from JUnit, if no other means available Integration tests Continous delivery / Continous deployment Configure build server to deploy on DEV after tests succeed UI developers benefit from an always up-to-date backend Application layer Service layer Code Commit Unit test Integrate Deploy
Ready for the lessons-learned Architecture Traditional Revised Web UI Server-side Client-side Backend Interfaces Integration
Lessons-learned 1. Clear API design! Decouple UI / Backend, Document API (swagger, enunciate)
Lessons-learned 1. Clear API design! Decouple UI / Backend, Document API (swagger, enunciate) 2. Use provided oracle features. Don t implement DB methods in Java. https://blogs.oracle.com/imc/entry/oracle_database_12c_free_new
Lessons-learned 1. Clear API design! Decouple UI / Backend, Document API (swagger, enunciate) 2. Use provided oracle features. Don t implement DB methods in Java. 3. Organize and plan your code well! Refactor is a must in agile setups, define rules and structure Code Refactor Test Integrate
Lessons-learned 1. Clear API design! Decouple UI / Backend, Document API (swagger, enunciate) 2. Use provided oracle features. Don t implement DB methods in Java. 3. Organize and plan your code well! Refactor is a must in agile setups, define rules and structure 4. Jersey!= RESTeasy. Start with final setup!
Lessons-learned 1. Clear API design! Decouple UI / Backend, Document API (swagger, enunciate) 2. Use provided oracle features. Don t implement DB methods in Java. 3. Organize and plan your code well! Refactor is a must in agile setups, define rules and structure 4. Jersey!= RESTeasy. Start with final setup! 5. Unit test ALL code UI, Middle tier, PL/SQL use CI/CD
Conlusion Choices for our project DB Middle tier WebUI PL/SQL API Oracle cartridge REST PL/SQL Interface Bootstrap Angular
Thank DB you Middle very tier much WebUI for PL/SQL API Oracle cartridge REST your attention! PL/SQL Interface Bootstrap Angular
Doing now what patients need next