国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

項目架構 the clean architecture筆記

2019-11-08 00:30:22
字體:
來源:轉載
供稿:網友

前言

這是一篇學習Clean架構的筆記,MVP本身是屬于展現層的邏輯,對于小型項目可能方便很多,但是對于大型項目來說MVP并不足以使代碼優化、依然會代碼冗余。所以分層和模塊化才是方向,clean架構就指出了這種架構的設計方式,所有本篇文章就做些clean架構的學習筆記。

原文: architecting-android-the-clean-way the-clean-architecture

The clean system should be:

quality software could be : not only about satisfying requirements, also should be robust, maintainable, testable, and flexible enough to adapt to growth and change.

the detail is :

Independent of FrameWorkTestableIndependent of UIIndependent of DatabaseIndependent of any external agency

like this

the Dependency Rule: source code dependencies can only point inwards and nothing in an inner circle can know anything at all about something in an outer circle.Entities: business object of applicationUse Cases(Interactors): orchestrate the flow of data to and from the entitiesInterface Adapters: convert data from the format most convenient for the Interactors and entities.PResenters and Controllers in here.Frameworks and Drivers: all the datails go,with the UI logic

An application would be separated to three different layer

Each layer uses its own data model so this independence can be reached.(the project uses datamapper to acheive the indepenices. 具體實施中還待商榷,畢竟同樣的model類型再次創建費勁。在確保可測試情況下應該重復創建。 ).

layer

Presentation Layer:

here is about the login related with views and animations.here can be MVP 、MVVM or MVC.The activities and fragments here are only views,only exist UI logic.Presenters in this layer are composed with interactors, use callback to translate data in background thread.

presentation layer

Domain Layer

Business rules here: all the logic happens in this layer. communicate with outside using interfaces.

domain layer

Data Layer

All data needed for the application comes from this layer through a UserRepository implementation that uses a Repository Pattern with a strategy that, through a factory, picks different data sources depending on certain conditions. load data from this layer.

data layer

Testing

Presentation Layer: used android instrumentation and espresso for integration and functional testing.Domain Layer: JUnit plus mockito for unit tests was used here.Data Layer: Robolectric (since this layer has android dependencies) plus junit plus mockito for integration and unit tests.

擴展閱讀: 說說Android的MVP模式


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 双江| 砀山县| 甘泉县| 咸宁市| 平泉县| 翼城县| 宝坻区| 射阳县| 隆德县| 克山县| 广东省| 涪陵区| 丹寨县| 松潘县| 邛崃市| 高要市| 贵溪市| 沭阳县| 巴马| 广水市| 乐都县| 三亚市| 栾城县| 峡江县| 龙州县| 汉阴县| 招远市| 磐安县| 西丰县| 鄱阳县| 栾川县| 会昌县| 明光市| 抚顺市| 乡宁县| 同仁县| 洛南县| 盈江县| 武威市| 同仁县| 腾冲县|