i'm building sdk used in hosting app. sdk going integrated in applications lot of users.
we started build layered architecture - ui, managers interacting models , networking layer. 3 layers total. ui getting updates callbacks.
side note: member in teams builded android applications lot of users, in of them used same layered architecture. these applications have active users , there feedbacks until now.
we have our beta version , seems working expected.
a week ago 1 of our team members come , think need change our architecture event driven based. have static event handles in sdk handle listeners , dispatch triggered other component.
i think it's bit risky, think hard handle large sdk lot of dependencies , services, in multithreaded environment in way. in addition, because building sdk, want isolate our main classes form our host application, , think impossible.
my questions:
what think right way go, layered architecture , need stick it, or event based preferred one?
do think it's suitable solution sdk that's needs efficient possible?
do think solution multithreaded environment?
appreciate feedback, thanks.
some articles have read:
architecting-android-the-clean-way
android based on event-based model. android application uses special thread, named looper thread, select events event queue 1 @ time, , processes them sequentially executing handlers. there may additional regular threads communicate between each other , looper thread using conventional synchronization operations. main role of looper thread continuously check event queue, select , process 1 event @ time.
to best of knowledge, main motivation android use event based model has handle alot of events (touch screen, click, sensors, network, internal , external events etc) , choice of event based model make sense.
if main concern concurrency , multitasking event driven , reactive models happens better choice multi-threading (or concurrency in general). layered structure not bad either, in-fact think better.
at end of day, depends on nature of job. if think sdk proving, similar android's job (handling massive events) go event based model otherwise layered structure better.
if concurrency (multi-threading) main issue , want exploit multi-core architecture , jobs cpu intensive there other architectures should see.
Comments
Post a Comment