An example of an app architecture-using MVP mode, using Otto for module communication

Source: Internet
Author: User

First, the overall architecture of this app is divided into:

Divided into four modules: 1.app module 2.common Module 3.domain Module 4.model module dependency of the app module:dependencies {
Compile Filetree (dir: ' Libs ', include: [' *.jar '])
Compile project (':d omain ')...} It relies on domain, domain layer modules. In the app module, the MVP mode is applied to divide the view and presenter of an activity. dependencies for domain modules:dependencies {
Compile project (': Common ')
Compile project (': Model ') ...} It relies on the model module. The domain logic code is placed in this module, the need to obtain data, the implementation code to get the data is placed in module modules, it relies on common, common functions, the entire application of common code, placed in the common module. the Model module relies on:dependencies {
Compile project (': Common ')....} This module only relies on the common module. The Model module provides data acquisition and modification functions. dependency of the Common module:dependencies {
compile ' com.squareup:otto:1.3.5 '
Compile ' com.google.dagger:dagger:2.0 '
Compile ' org.glassfish:javax.annotation:10.0-b28 '
It does not rely on the Domain,app,model module. It uses a third-party class library to provide functionality to other modules. Use the Dagger Dependency Injection framework for dependency injection and the Otto Class library for bus-mode communication. second, the entire implementation process brief analysisApp module: Moviesactivity,moviespresenter. Domain module: configurationusecase, Getmoviesusecasecontroller. Module modules: Restmoviesource. Communication between modules, using bus bus for collaboration. For example, module modules, accept the data query request, after the query is finished, it is post through the bus, then, the app module or domain module, using the bus to subscribe to an event, then the method of subscribing to the event will be callback. iii. Dependency Injection framework, injection process

An example of an app architecture-using MVP mode, using Otto for module communication

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.