Layered Architecture - mobitile/mobitile.github.io GitHub Wiki
Overview
To make code organised MobiTile uses Layered Architecture and each functional area is divided on four layers:
presentation
application
domain
infrastructure
Config Class
Each functional area contains Config
class in its root package, this config class is used to plug functional area into Inversion of Control Context.
Presentation Layer
Represents User Interface. Responsible for handling User's action and presenting application's data and state. Examples of functionality:
- display User info
- display errors in forms
- handle click on button and dispatch concrete message to execute command
Package structure:
presentation
- contains Presentation Model classespresentation.artwork
-presentation.component
- contains complex display types that could interacts with User called components (e.g. custom Button, List etc)presentation.display
- contains simple display types (e.g. custom DisplayObjects)presentation.events
- contains custom eventspresentation.popup
- contains classes for popupspresentation.renderer
- contains classes for List's rendererspresentation.view
- contains complex display types that have dependency on application (e.g. Header, Footer etc)presentation.layout
- contains layout classes
Explicitly interacts with Application layer
Application Layer
Defines application behaviour, it couples other parts of application. Responsible for how application interacts with User. Examples of functionality:
- navigate through application
- initiate business logic flow, such as create new post
- intercept data-modification, such as "Are you sure save change in this Filter? Yes/No"
- error handling / logging etc
Package structure:
application
- could contain various classes for application supportapplication.commands
- contains command classesapplication.messages
- contains message classes, classes that triggers commands
Explicitly interacts with Domain layer
Domain Layer
Represents business layer, it is a place where business logic is implemented. Responsible for working with data. Examples of functionality:
- read/create/update/remove data
- store application state
- implement business logic flow, such as "receive storages list, add Device and Photos items to it, store it for future use"
Package structure:
domain
- contains top-level domain class that is entry point to functional area's business logic, also could contain classes that describes domain model or various supporting classesdomain.enum
- contains enumerationsdomain.list
- contains classes that extend ListCollection classdomain.menu
- contains providers for Context Menudomain.validators
- contains form validators
Explicitly interacts with Infrastructure layer
Infrastructure Layer
Interacts with other systems such as remote server or file system. Responsible for transmitting data between application and other system. Examples of functionality:
- interact with server to modify data as specified in Domain layer
- perform data format change between application and other system
Package structure:
infrastructure
- contains service interfacesinfrastructure.assembler
- contains serialisation/deserialisation classesinfrastructure.dto
- contains classes for conversion domain model objects into form appropriate to serverinfrastructure.impl
- contains implementations of service interfaces