Architectural Design Thinking
A large project needs someone to do the overall architectural design, that is, a so-called architect is needed. Through the experience of several projects, we are now doing some thinking on the design of the architecture.
1. Things to do in architecture design
1. Horizontally divide the abstraction level and the dependencies between functions. Assuming that the implementation language is java, the output may be sub-projects, package names, sub-package names, interface names, etc. This part also involves which open source components or codes to choose.
2. Vertical segmentation of sub-systems, sub-modules, services, etc.
3. Interaction and decoupling between various parts, including the service level and the internal
subsystems What interactive things are included on the client side?
Hardware events such as touch, UI and effects, time-related logic such as timer, logic system, model, and network interaction
Third, the interaction and design between the client parts are
separated from MVC: hardware events and UI Interaction (if the os has already encapsulated the controls, it is very simple, if not, you need to design the event system yourself); the UI is passively refreshed, which is the observer and responder of logic; logic (usually a singleton or static function) is controlled by timer, Driven by network and UI (such as whether you have seen the logic above UI); timer and network are self-driven and distribute events; model serves logic, providing services such as cache, serialization, deserialization, encryption and decryption, and persistence; practical The upper core is an observer mode
4. Horizontal segmentation of the android client
1. Basic functions
common
common.nio
common.log
common.compression
common.security
common.security.md5
common.security.rsa
common.security.des
.
.
.
2. Service package
service.net
NetworkState isWIFIConnected and other services.http AsyncWWW , etc., you can consider loopj framework service.asyncIO
service.cache MediaScanner DiskLruCache CacheManager service .webview service.versioncontrol SOManager service.sdk service.sdk.share service.sdk.share.weixin service.sdk.share.weibo
service.sdk.pay
service.sdk.pay.alipay
service.sdk.push
service.sdk.push.baidu
service.sdk.login
service.statistics
Device 3. Services
provided by a certain type of app, such as services required by video apps
.video.nativeplayer
service.video.ad
service.video.p2p
service.video.thumbnailer
service.video.subtitle
service.video.danmaku
service.video.drm
service.video.grey
4. MVC architecture
frame of app
5. Specific app implements
app
app.base
BaseActivity
ActivityManager
BaseActivityLogic
app.impl.models
app.impl.logicSystem
app.impl.service
app.impl.api
app.impl.api.net
HttpClient
MsgFactory
app.impl.ui
app.impl.ui.fragment
app.impl.ui.animation
app .impl.ui.activity
app.impl.ui.adapter
app.impl.ui.custom
app.impl.ui.custom.control
app.impl.ui.custom.view
AsyncImageView
app.impl.ui.custom.layout
Five, What does the server include?
Data persistence, cache, model, logic, network framework and asynchronous IO, timer
six, and the interaction between the server parts
Persistence and cache are model services; network and timer drive logic; generally, the server will be divided into services, and the inside of the service is the trigger logic of event callbacks. The logic implements the so-called logic based on the model,
etc.
1. Basic package
common
common.nio
common.log
common.compression
common.security
common.security.md5
common.security.rsa
common.security.des
common.executer
common.tcpPool
common.scheduler
common.asyncIO
common.IDGenerator
common.route
common.timer
2. Encapsulation of services and components
component.netty
AsyncTcp
component.redis
component.redis.connectionPool
component.mysql
component.mysql.connectionPool
component.load
component.config
component.bootstrap
component.loadbalance
component.heartbeat
component.sql
component.rpc
3. Basic aggregation
base.app
base.service
4. Implementation of specific services
app
app.base
app.impl
app.impl.subsystem
Architecture Design Thinking
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326986510&siteId=291194637
Recommended
Ranking