Skip to content

Instantly share code, notes, and snippets.

@DykiSA
Last active November 3, 2018 04:32
Show Gist options
  • Save DykiSA/2944b602b949ce94bf402dfbe0581b36 to your computer and use it in GitHub Desktop.
Save DykiSA/2944b602b949ce94bf402dfbe0581b36 to your computer and use it in GitHub Desktop.
Vaadin 10 - System Architecture for Bakery Demo

ARCHITACTURE PATTERN

Service Layer

It responsible to provide the data.

  1. Entity - a class that provide table schema
  2. Entity Repository - an interface for several query statement
  3. Entity Service - a class that provide action for reading and writing the certain data that requested by Data Provider

UI Layer

Responsible to presenting the view layout of the application.

  1. Data Provider - to parse data provided from Entity Service that needed by View
  2. View - any component or presenter that want to read/write the data using Data Provider helper

Login Architecture

Combine Vaadin access route within Spring Boot security class.

  1. Setup User Entity
  2. Define User Repository to get the information of the user by email or username. It depend on your privacy policy for how the user can signin
  3. Create custom Spring Boot configuration to setup the url permission and determine where the url address should be used to hendle the login action
  4. Create custom UserDetailService to build custom login validation and register the Roles of the logged in user to Spring Boot
  5. When you registering the roles of the current user, that roles has been saved in the security class and will be used to validate the page that implementing @Secured annotation and determine does there is a matched roles that is permitted to access the page
  6. For more information about security in spring boot, please read the example guide at https://spring.io/guides/gs/securing-web/

Model View Presenter (MVP)

The Bakery Demo App is using MVP pattern instead of MVC.

  1. Model - is Service layer that provide the data
  2. View - is a UI layer that used to display the application layout. For component with simple logic operation
  3. Presenter - is a UI layer that splitted up from View and contain abstract methods that will be implemented by View to get additional data/instance of other class. For component with much or complex logic operation (event listeners, service-layer calls, etc.)

Different Between MVC and MVP Diagram


MVC:

	              +--------------------+
          +-----------|         View       | <-------+
          |           +--------------------+         |
          v                                          v
+-----------------------+                +-----------------------+
|       Model           | <------------- |       Controller      |
+-----------------------+                +-----------------------+

MVP:

	              +--------------------+
                      |         View       | <-------+
                      +--------------------+         |
                                                     v
+-----------------------+                +-----------------------+
|       Model           | <------------- |       Presenter       |
+-----------------------+                +-----------------------+

What Next?

Here is useful link references that relevant to learn:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment