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

Developing Modular Web Applications

Developing Modular Web Applications

Developing Modular Web Applications using the Fenix Framework

Eb987f4f2b2d43faa8b3b5a377713913?s=128

João Carvalho

April 11, 2014
Tweet

Transcript

  1. Developing modular (Web) Applications Using the Fenix Framework Luis Cruz

    & João Carvalho April 2014
  2. Outline • FenixEdu • What does modular mean? • Benefits

    • Challenges
  3. None
  4. None
  5. None
  6. 12 Years Ago

  7. <copiar arch> 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
  8. The 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.
  9. Fenix Framework

  10. <arch ff> 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
  11. This allowed the application to grow

  12. User Person

  13. Domain Model Complexity

  14. Quickly grew out of control

  15. • Long compilation times • Large memory requirements • Poor

    expansibility • Poor encapsulation • It becomes easy to break domain constraints
  16. Solution?

  17. Modularisation

  18. What is modularisation?

  19. Divide and conquer

  20. Breaking your application into smaller parts

  21. Clear boundary definition

  22. Build your application from the small modules

  23. Persistence Tier — Fenix Framework Based Data Repository Fenix Application

    Request Controller Module 1 Presentation Tier Application Tier Domain Objects Module 2 Presentation Tier Application Tier Domain Objects ... Module N Presentation Tier Application Tier Domain Objects
  24. Benefits

  25. Separation of Concerns

  26. Greater Cohesion

  27. Abstraction

  28. Encapsulation

  29. Independent roadmaps

  30. Improved development process

  31. Reusability

  32. Pluggability

  33. DOT! IST DOT ! IST-ID FENIX ! IST DOT !

    ADIST DOT ! Reitoria! UL SOTIS JobBank SIADAP! Processes SnailMail! Tracking Domain! Browser Renderers Organizationa l! Module Fenix! Framework Regulation! Dispatch Financial! Projects Workflow File! Manage-ment Working! Capital Expenditure s Messaging Inst.! Protocols Bennu ! Framework WebServic e Scaffolding Authentica- tion i18n Groups & ACLs WebApp Scaffolding Scheduler Persistent IO Indexing Support
  34. Challenges

  35. Thinking in modules (Or thinking inside the box)

  36. Choosing your build tool

  37. Versioning

  38. Versioning • What’s the difference between: • v1.1.3 and v1.1.4?

    • v1.2.3 and v1.3.5? • v1.3.5 and v2.0.0?
  39. Semantic Versioning • Major Version (2.0.0) • API Disruption •

    Minor Version (1.2.0) • New (backward-compatible) API • Revision (1.2.3) • Bug fixes and internal changes http://semver.org/
  40. You must explicitly declare your dependencies (and their versions)

  41. A @ 1.0.0 B @ 2.3.1

  42. Dependency Nightmare org.fenixedu:bennu-portal:jar:2.3.0-SNAPSHOT +- org.fenixedu:bennu-core:jar:2.3.0-SNAPSHOT:compile | +- org.jasig.cas.client:cas-client-core:jar:3.3.0:compile | \-

    org.antlr:antlr-runtime:jar:3.5.2:compile +- org.fenixedu:fenixedu-commons:jar:1.0.0:compile +- com.google.guava:guava:jar:15.0:compile +- joda-time:joda-time:jar:2.3:compile +- com.google.code.gson:gson:jar:2.2.4:compile +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile +- com.mitchellbosecke:pebble:jar:1.0.0:compile | \- com.coverity.security:coverity-escapers:jar:1.1:compile +- pt.ist:fenix-framework-core-api:jar:2.4.0:compile | +- pt.ist:fenix-framework-core-dml:jar:2.4.0:compile | | +- commons-lang:commons-lang:jar:2.6:compile | | \- antlr:antlr:jar:2.7.7:compile | +- javax.transaction:jta:jar:1.1:compile | +- pt.ist.esw:advice-runtime:jar:1.8:compile | \- org.jgroups:jgroups:jar:3.2.7.Final:compile +- pt.ist:fenix-framework-core-consistency-predicates:jar:2.4.0:compile | +- jvstm:jvstm-fenix:jar:1.4:compile | \- pt.ist:fenix-framework-core-adt-bplustree:jar:2.4.0:compile +- javax.servlet:javax.servlet-api:jar:3.0.1:provided +- org.slf4j:slf4j-api:jar:1.7.5:compile \- junit:junit:jar:4.11:test \- org.hamcrest:hamcrest-core:jar:1.3:test
  43. Managing dependencies can be chaotic!

  44. Inconsistencies A @ 1.0.0 C @ 2.3.1 B @ 2.3.5

    C @ 3.4.0 YourApp @ 1.0.0 Conflict!
  45. Circular Dependencies A @ 1.0.0 C @ 2.3.1 B @

    2.3.5
  46. Managing Graph Complexity

  47. Source Management

  48. One branch per feature

  49. Tagging every release

  50. Distributed tools help a lot…

  51. Artifact Management

  52. Building everything from source can be painful (I’m looking at

    you Gentoo)
  53. Where to keep compiled artifacts?

  54. Artifact Repository

  55. Modular Infrastructure

  56. Many frameworks are not modular-friendly…

  57. … and the language doesn’t help. Java 9, prove me

    wrong!
  58. Fenix Framework

  59. Fenix Framework 1.x FenixFramework.initialize(new Config() { { dbAlias = "//localhost:3306/hellodb";

    dbUsername = "hello"; dbPassword = "world"; domainModelPath = "src/main/dml/domain.dml"; rootClass = MyRootClass.class; } });
  60. Single Domain Model!

  61. No bidirectional relations

  62. No encapsulation

  63. How to allow modules to define their own DMLs?

  64. Fenix Framework 2.0

  65. Make modularity a core concern

  66. Creates the complete domain from the dependency graph

  67. Bidirectional Dependencies

  68. Each module can only see its sub-graph Which is different

    for every module
  69. Fenix Framework 2.0 dbAlias=//localhost:3306/fenix1 dbUsername=root dbPassword= fenix-framework.properties

  70. Presentation

  71. • Structure and styling • Menus and navigation • Multiple

    presentation technologies
  72. Bennu Portal

  73. It’s magic!

  74. Integration framework

  75. Uniform styling across the entire application

  76. Dynamic menu construction/rendering

  77. Functionalities only render their body

  78. Out of the box scaffolding for web applications

  79. Build your own application in 2 minutes

  80. Q?

  81. Join Us http://fenixedu.org/dev github.com/fenixedu! facebook.com/fenixedu hello@fenixedu.org

  82. Developing modular (Web) Applications Using the Fenix Framework Luis Cruz

    & João Carvalho April 2014