Mobile App Architecture mode

Source: Internet
Author: User

Mobile App Architecture mode

This article mainly summarizes several commonly used architecture pattern, basically is the layer progressive, reproduced please note name Source: Http://blog.csdn.net/uxyheaven

Using different architectural patterns in different life cycles of an app can effectively improve development efficiency

Basic MVC

Mobile apps typically use the classic MVC architecture

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 C: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 primary purposes of the View object is to display the data in the app model object and allow the user to edit 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 can 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's data into what the view can render.

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, capturing user input information and operations User first, with simplicity; no business-related logic processing
Business Logic Layer (BLL) Fetching data from the DAL, displayed in the UI; Get user directives and data from the UI, execute business logic, or write to a data source via the DAL As a bridge between the U-layer and the D-layer, the aim is to show 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 specifically 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 now is


Four-tier architecture

On the basis of the three-tier architecture, the business rules layer is added, and the common three layer is the business logic and business rules are merged into a 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 deal with database errors in time, and increase the structure definition of business logic Let business logic people 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) For the parameters passed down by the UI layer, check the legality. User first, with simplicity; no business-related logic processing
Five-tier architecture

In general, our business logic is placed in the middle tier, then to the internal of these a large number of different types of use of various classes, the invocation of the task, it falls completely to the presentation layer. This inevitably increases the amount of code in the presentation layer, complicates the task of representing the layer, and the presentation layer is only responsible for accepting the user's input and returning the results, and increases the degree of coupling between layers. Therefore, we need to increase the interface to the unified management of these services, design patterns in the facade mode of thought.

From top to bottom

    • Presentation Layer
    • Business Facade Layer
    • Business Rule Layer
    • Business logic layer or domain layer
    • Data Access Layer
level function Design Principles
Business Facade Layer Provides a consistent and simple interface for a set of interfaces in the subsystem.
Rookie Viper

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


Mobile App Architecture mode

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.