Mobile App Architecture Design

Source: Internet
Author: User

Mobile App Architecture Design

This article mainly summarizes several kinds of frequently used architecture pattern, basically is the layer of progressive reprint please note name Source Http://blog.csdn.net/uxyheaven, good typesetting in https://github.com/uxyheaven/reading

Assuming that this article is good, please give a top in csdn, GitHub to a star.

Native app development compared to the traditional project iteration cycle is much shorter, the change in demand is more frequent, in the different life cycle of the development of different architecture model can effectively save development time, improve development efficiency, this article describes several commonly used architectural patterns:

Presentation layer the main MVC

Mobile apps are typically a classic MVC framework

level function Design Principles
Model Layer Encapsulates a series of data for an application, and defines the operations that manipulate the logic and calculation rules of the data. Feedback to the controller via NOTIFICATION,KVO
View Layer (views) A View object is an object that the user can see in an app. The View object knows how to draw itself and can respond to the user's actions. One of the main purposes of the View object is to display the data in the application model object and consent to the user editing the data Views can be fed through target-action, delegate, DataSource and controllers by not manipulating the model layer directly
Controllers Layer (Controller) The controller layer is the middle man in the view layer and several model layers C ability to manipulate the model layer and the view layer directly

Summary: C to M:apic to V:outletv to C:target-action, Delegate,datasourcem to C:notification. KVO

An improved version of MVVM for MVC

MVVM is based on the MVC of a View Model: A representation of logic that transforms the Model data into what the view can render. Apps for a large number of display classes

Hmvc

Hierarchical MVC, which decomposes the client application into a hierarchical parent-child relationship, reuses this pattern to form a structured client architecture. Suitable for heavy-duty B/S Architecture WebApp.

An MVC module is abstracted from an application's module. One of the most important concepts is the Parent MVC, which can be an abstract object and an entity on the corresponding interface. Imagine an app with Tab bar, toolbar, navigation bar, main workspace, corresponding to Hmvc on the bottom of the app is Layer1, Layer2 navigation bar, main workspace, toolbar. Suppose that Layer2 is too complex to be able to put the main work area into Layer3, and so on.

Controller is the main control room of the function module, it is responsible for communication with the child controller or the parent controller, and notifies its view processing to change the interface display, Model handles some business logic or database access operation. In the case of the sample, click on a button in the toolbar, the Controller of the toolbar responds to the event, found that to switch the main workspace, the toolbar can not do, pass his parent controller processing (assuming that the parent controller can not handle, The controller handles the tab bar to switch the main workspace.

Strengths:

    • Divides the program into several parts, reducing the dependency
    • Support inspiring reuse of code, components or modules.
    • Scalability is improved in future maintenance.
Tiered design three-tier architecture

We're looking at the classic three-tier architecture.

From top to bottom

    • Presentation Layer (UI)
    • Business logic layer or domain layer (BLL)
    • Data access Layer (DAL)
level function Design Principles
Presentation Layer (UI) Presenting specific business data to users. Collection of user input information and actions User first. Not including any business-related logical processing
Business Logic Layer (BLL) Fetching data from the DAL, displayed in the UI; Get user directives and data from the UI, run business logic, or write to a data source via the DAL As a bridge between the U-layer and the D-layer, the purpose is to demonstrate a clear function structure, which is only responsible for data processing, not SQL statements and ADO
Data access Layer (DAL) Direct operation of the database, for the addition of data to delete changes to find; Provide data services in detail for the business logic layer or presentation layer.

Specialized operations database, regardless of data legitimacy. Database error returned-1, logical error returned 0, and the reason for the error, the successful return 1

And then, the structure we have today is


Four-tier architecture

The business rules layer is built on a three-tier architecture, and the usual three tiers are the consolidation of business logic and business rules into one layer. Collectively referred to as the business layer. The proposed business rules layer can not only deal with the illegal information of user input in time, but also can deal with database errors in time, increase the structure definition of business logic layer, and make the business logic personnel concentrate on logic

From top to bottom

    • Presentation Layer
    • Business Rule Layer
    • Business logic layer or domain layer
    • Data Access Layer
level function Design Principles
Business Rules layer (ECL) Check legitimacy for the number of UI-level passes. User first, both concise. Does not include whatever business-related logical processing

Introducing the service layer

The architecture that introduces the service layer and the common layered architecture are different: there is data inside the service layer that can be executed separately.

From top to bottom

    • Presentation Layer
    • Services Layer (Service)
    • Data Access Layer
    • Business Logic Layer
level function Design Principles
Presentation Layer Show the interaction with the user
Service Layer The service layer provides a business logic entry for the presentation layer, which is completed by defining the interface service in the form of interface tuning.
Business Logic Layer 1 receive the DTO from the service layer, then process the incoming DTO according to business rules, return to the processed information 2 need to provide business behavior for each object, and these objects are independent of the 3 business objects between the interaction process through the service layer to organize
Data Access Layer Access interface for local data remote data
Rookie Viper

Viper here not much to say, please want to know the self-search


Mobile App Architecture Design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.