Model-View-Controller: Tips&Tricks

Ciklum Ukraine
Ciklum UkraineCiklum Ukraine
Design Pattern
MVC
July 17th, 2014
MVC
Agenda
● History
● MVC
● Controller specifications
● View specifications
● Model specifications
● Demo
History
Model View Controller (MVC) is one of the most quoted
(and most misquoted) patterns around. It started as a
framework developed by Trygve Reenskaug for the
Smalltalk platform in the late 1970s. Since then it has
played an influential role in most UI frameworks and in
the thinking about UI design.
MVC
● Controller sends commands to the model to update state.
Also sends commands to its associated view to change
the appearance.
MVC
● Controller sends commands to the model to update state.
Also sends commands to its associated view to change
the appearance.
● A model notifies its controllers when there has been a
change in its state. This notification allows the views to
produce updated output.
MVC
● Controller sends commands to the model to update state.
Also sends commands to its associated view to change
the appearance.
● A model notifies its controllers when there has been a
change in its state. This notification allows the views to
produce updated output.
● A view requests information from the model that it needs
for generating an output representation to the user.
MVC
Model specifications:
● business logic
MVC
Model specifications:
● business logic
● has knowledge about itself but does not know
about the controllers and views;
MVC
Model specifications:
● business logic
● has knowledge about itself but does not know
about the controllers and views;
● in some cases is a database manager or a set
of objects;
MVC
Business logic - real-world business rules that determine
how data can be created, displayed, stored, and changed.
Model
Model base types:
- passive model
- active model (basic type)
MVC
Model
ApiClient DataManager
update UI
MVC
@property (readonly) DPManagerProvider *provider;
MVC
@property (readonly) DPManagerProvider *provider;
#dynamic state
@property (readonly) NSString *email;
@property (readonly) NSString *password;
@property (readonly) NSString *messageText;
@property (readonly) BOOL canEdit;
MVC
@property (readonly) DPManagerProvider *provider;
#dynamic state
@property (readonly) NSString *email;
@property (readonly) NSString *password;
@property (readonly) NSString *messageText;
@property (readonly) BOOL canEdit;
#static states
@property (readonly) NSString *emailDefaultText;
@property (readonly) NSString *passwordDefaultText;
@property (readonly) NSString *title;
@property (readonly) NSString *loginTitle;
MVC
@property (readonly) DPManagerProvider *provider;
#dynamic state
@property (readonly) NSString *email;
@property (readonly) NSString *password;
@property (readonly) NSString *messageText;
@property (readonly) BOOL canEdit;
#static states
@property (readonly) NSString *emailDefaultText;
@property (readonly) NSString *passwordDefaultText;
@property (readonly) NSString *title;
@property (readonly) NSString *loginTitle;
#data access methods
- (void)login;
- (BOOL)shouldChangeEmailInRange:(NSRange)range
replacementText:(NSString *)text;
- (BOOL)shouldChangePasswordtInRange:(NSRange)range
replacementText:(NSString *)text;
MVC
ControllerModel
MVC
ControllerModel
● Notification
MVC
ControllerModel
● Notification
● KVO
MVC
ControllerModel
● Notification
● KVO
● Delegate
MVC
ControllerModel
● Notification
● KVO
● Delegate
● Binding
MVC
Controller specifications:
● can transmit data
MVC
Controller specifications:
● can transmit data
● can place Views on the screen
MVC
Controller specifications:
● can transmit data
● can place Views on the screen
● can respond to user’s actions
MVC
Controller specifications:
● can transmit data
● can place Views on the screen
● can respond to user’s actions
● can operate with several Views
MVC
View specifications:
● can display data
MVC
View specifications:
● can display data
● can, in some cases, have code that
implements some business logic
MVC
Controller
Model View
@ view;
@ model;
MVC
Controller
Model View
View
MVC
Controller
Model
ViewController
View
MVC
Controller
Model View
View
Controller
MVC
Controller
Model
View
MVC
Controller
Model
View
View
Controller
Model
@parameters
MVC
Controller
Model
Storyboard
Controller
Model @
parameters
MVC
Additional materials:
● Msdn MVC
● MVC https://developer.apple.com
● Refactoring code
http://martinfowler.com/books/refactoring.html
● Steve McKinley “Perfect Code”
● Eric Freeman “Design Patterns”
Demo: dima.sai github - dsay
1 von 37

Recomendados

Angularjs in mobile appAngularjs in mobile app
Angularjs in mobile appYvonne Yu
3.3K views21 Folien
Angular jsAngular js
Angular jsDinusha Nandika
293 views18 Folien

Más contenido relacionado

Was ist angesagt?

Angular JS tutorialAngular JS tutorial
Angular JS tutorialcncwebworld
137 views20 Folien
Angular jsAngular js
Angular jsManav Prasad
590 views30 Folien
AngularJS introAngularJS intro
AngularJS introdizabl
2.9K views22 Folien

Was ist angesagt?(20)

Angular JS tutorialAngular JS tutorial
Angular JS tutorial
cncwebworld137 views
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0
Nagaraju Sangam1.7K views
Angular jsAngular js
Angular js
Manav Prasad590 views
iOS architecture patternsiOS architecture patterns
iOS architecture patterns
allanh0526508 views
AngularJS introAngularJS intro
AngularJS intro
dizabl2.9K views
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
samhelman2.2K views
Why angular js Framework Why angular js Framework
Why angular js Framework
Sakthi Bro425 views
AngularJS introductionAngularJS introduction
AngularJS introduction
Tania Gonzales1.2K views
The AngularJS wayThe AngularJS way
The AngularJS way
Boyan Mihaylov1.2K views
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh339 views
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners Workshop
Sathish VJ4.4K views
Understanding angular jsUnderstanding angular js
Understanding angular js
Aayush Shrestha5.4K views
Angular jsAngular js
Angular js
ParmarAnisha323 views
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at Datacom
David Xi Peng Yang1.1K views
Angularjs architectureAngularjs architecture
Angularjs architecture
Michael He999 views
Angular js 1.3 basic tutorialAngular js 1.3 basic tutorial
Angular js 1.3 basic tutorial
Al-Mutaz Bellah Salahat2K views
WJAX 2012 - Web Apps With AngularJSWJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJS
Philipp Burgmer586 views

Similar a Model-View-Controller: Tips&Tricks(20)

ASp.net Mvc 5ASp.net Mvc 5
ASp.net Mvc 5
ahmedxp kh73 views
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar44.4K views
Struts(mrsurwar) pptStruts(mrsurwar) ppt
Struts(mrsurwar) ppt
mrsurwar1.9K views
深入淺出 MVC深入淺出 MVC
深入淺出 MVC
Jace Ju20.8K views
Fundaments of Knockout jsFundaments of Knockout js
Fundaments of Knockout js
Flavius-Radu Demian2.4K views
MVC.pptxMVC.pptx
MVC.pptx
ssuserfd27a76 views
Introduction to Knockout JsIntroduction to Knockout Js
Introduction to Knockout Js
Knoldus Inc.1.8K views
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVC
Acquisio5.6K views
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
Dipika Wadhvani676 views
MvcMvc
Mvc
abhigad579 views
MVCMVC
MVC
akshin2K views
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok4.4K views
Eclipse MVCEclipse MVC
Eclipse MVC
Zoltán Mátyás149 views
Ios modelsIos models
Ios models
JUDYFLAVIAB51 views
Introduction to Struts 1.3Introduction to Struts 1.3
Introduction to Struts 1.3
Ilio Catallo16.3K views

Más de Ciklum Ukraine(20)

Alex Pazhyn: Google_Material_DesignAlex Pazhyn: Google_Material_Design
Alex Pazhyn: Google_Material_Design
Ciklum Ukraine996 views
Your 1st Apple watch ApplicationYour 1st Apple watch Application
Your 1st Apple watch Application
Ciklum Ukraine709 views
Test Driven DevelopmentTest Driven Development
Test Driven Development
Ciklum Ukraine887 views
Back to the future: ux trends 2015Back to the future: ux trends 2015
Back to the future: ux trends 2015
Ciklum Ukraine814 views
Developing high load systems using C++Developing high load systems using C++
Developing high load systems using C++
Ciklum Ukraine910 views
Collection view layoutCollection view layout
Collection view layout
Ciklum Ukraine2.1K views
Introduction to auto layoutIntroduction to auto layout
Introduction to auto layout
Ciklum Ukraine691 views
Groovy on AndroidGroovy on Android
Groovy on Android
Ciklum Ukraine1.2K views
Unit Testing: Special CasesUnit Testing: Special Cases
Unit Testing: Special Cases
Ciklum Ukraine1.2K views
Material designMaterial design
Material design
Ciklum Ukraine6.9K views
Kanban developmentKanban development
Kanban development
Ciklum Ukraine663 views
Mobile sketching Mobile sketching
Mobile sketching
Ciklum Ukraine736 views
More UX in our lifeMore UX in our life
More UX in our life
Ciklum Ukraine558 views
Unit Tesing in iOSUnit Tesing in iOS
Unit Tesing in iOS
Ciklum Ukraine1.6K views

Model-View-Controller: Tips&Tricks