Architecture in administrative applications

Download Report

Transcript Architecture in administrative applications

Architecture in administrative
applications
View, controller, model,
persistency
Larman chapter 30
Architecture in administrative
applications
1
Layers
• An application consists of several layers [Larman, page
451]
– Presentation layer
• GUI
– Application layer
• Controller(s)
– Domain layer
• Worker classes (alias model)
– Business layer
• We wont go into that layer in this note
– Technical layer
• Like a database layer
– Foundation layer
• Like JDBC
Architecture in administrative
applications
2
Architecture
• An architecture tells
– Which layers we need
– How to send information from one layer to
another
• In this note we consider data
– Where to put data
– When to read and update date
Architecture in administrative
applications
3
Persistency
• Data must be kept on stable storage
(usually hard disk) to prevent loss of data
when the application stops.
• Data can be stored on the disk in
– A simple file
– A database
Architecture in administrative
applications
4
CRUD terminology
• CRUD commonly used abbreviation
– Create new data
– Read existing data
– Update existing data
– Delete existing data
Architecture in administrative
applications
5
Handling data
• Data can be handled in many ways in a
layered application
– Memory based
– Memory based, with “write through”
• Like memory based
• But all CUD operation goes directly to the hard
disk
• Other users can see the updated data
– All operations disk based
– Persistency framework
Architecture in administrative
applications
6
Memory based
• Application start
– Read data into
collection classes in
memory.
• Application running
Gear
GUIcreateGear
GUIfindCustomer
CreateGearHandler
FindCustomerHandler
GearCatalog
CustomerCatalog
* 1
– Do CRUD on the data
in memory.
Customer
1 *
GearDBFacade
• Application stop
– Write the data back to
the disk
Architecture in administrative
applications
JDBC
java.sql
7
Memory based, with “write through”
• Like memory based
• But all CUD operation
goes directly to
persistent store
• Other users can see
the updated data
immediately.
Gear
GUIcreateGear
GUIfindCustomer
CreateGearHandler
FindCustomerHandler
GearCatalog
CustomerCatalog
* 1
Customer
1 *
GearDBFacade
JDBC
java.sql
Architecture in administrative
applications
8
All operations are disk based
• Controllers does
CRUD directly on the
persistent store.
• No in-memory data.
• Domain layer not
used
Gear
GUIcreateGear
GUIfindCustomer
CreateGearHandler
FindCustomerHandler
GearCatalog
CustomerCatalog
* 1
– Domain classes may
be used for sending
information between
application and
technical layer
Architecture in administrative
applications
Customer
1 *
GearDBFacade
JDBC
java.sql
9
Persistency framework
• A persistency framework moves objects from
memory to stable storage (typically a database)
– Lots of interfaces and abstract classes in the
technical layer.
– Reusable
• For every application
• For every type of stable storage
– Simple files
– Different DBMS’es
– J2EE (Java 2 Enterprise Edition) application servers
offers a persistency framework
– [Larman, chapter 34] designs a persistency
framework.
Architecture in administrative
applications
10