Share
Embed
Transcript
12 slides
-
Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved.
C2M - Mobile App Architecture Android & iOS - Dinkar Kumar - Suyash Gupta -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 2 Agenda • Basics of MVP • Responsibilities of each layer • Implementing MVP in android apps • Demo • How it addresses separation of concerns and testability -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 3 Why any architectural pattern • Modular • Testable • Maintainable • Separation of concern • Documentable -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 4 MVP • Model: It is responsible for handling the data part of the application. • View: It is responsible for laying out the views with specific data on the screen. • Presenter: It is a bridge that connects a Model and a View. It also acts as an instructor to the View. -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 5 -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 6 MVP - Model • Data provider • Network call • DB fetch • Shared Preferences -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 7 MVP - View • Activity • Fragment • Custom View -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 8 MVP – View Responsibility • Permissions • Event listeners • Showing dialogs, Toasts, Snackbars • Working with Android View and Widget • Starting activities • All functionality which is related to the Android Context -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 9 MVP - Presenter • Act as instructor • Retrieves data from the Model • Returns Formatted data to View • Should not have Android SDK dependency -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 10 Demo -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 11 MVP : Testability • MVP make the code more testable by making it more decoupled • We can easily mock model to validate UI rendering for different response -
Copyright © 2016 Talentica Software (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talentica Software (I) Pvt Ltd. All rights reserved. 12