Your SlideShare is downloading. ×
0
Adapting View Models as a Means ForSharing User Interface Code Between OS Xand iOSDileepa JayathilakeSATURN 2013
BackgroundProblem IdentificationSolution OverviewImplementationDiscussionConclusion
Product for both OSX and iOSWith a significantpart in commonHow to reuse codemaximally?
Is it possible toshare UI code?
View Modelsimplementcommon partof UIView Modelsare sharedView hooks intoView ModelControllershold platformspecificsBidirec...
View Models contain view data and common UI behaviorModels are exposed to Views through View Models12
Common &Platform-specificcomponents of thesolution
Proof ofConcept:Book StoreApplication
Use of the solution in Book Storeapplication
Advantages• Improved code reuse• Better readability• Better Separation ofView Logic• Enhanced testabilityConcerns• Framewo...
CONCLUSIONView Models combined with traditionalMVC can improve code reusesignificantly while providing otheradvantages for...
QUESTIONS
Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS
Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS
Upcoming SlideShare
Loading in...5
×

Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

384

Published on

This work describes a solution to a costly problem that surfaces in software product engineering on Objective C technology stack. Particularly, it emerges when designing a software product targeting both OS X and iOS where a significant part of the functionality is common for both platforms. This brings in the question of how much code can be reused between the two implementations.

A multitude of concerns need to be probed and the solution domain can easily be a victim of combinatorial explosion. Like in many other cases, analysis in terms of design patterns can put things in perspective. Both Cocoa and Cocoa Touch (standard frameworks for application development in OS X and iOS respectively) highly encourage embracement of MVC as a design pattern. It is even a necessity for utilizing certain parts of the two frameworks. Therefore, it is wise to keep our solution inside the MVC design paradigm. Our exploration to the solution starts with a close examination of MVC and the role played by each component in the design pattern.

Controllers in both Cocoa and Cocoa Touch are responsible for managing views and responding to user actions, embracing Strategy pattern. They are tightly bound to the views they control and therefore are hardly useful outside the context of that particular view. At the same time views and controllers in OS X (based on NSView and NSViewController respectively) are disparate from views and controllers in iOS (based on UIView and UIViewController respectively). This is mostly due to differences between the two platforms. It inevitably confines cross-platform reusable space to model classes. On the other hand, it is not very unlikely to have certain views in the product that are supposed to appear and respond to user events in similar ways in the two platforms. Failure to exploit this cleverly in the architecture can lead to code replication causing less maintainability. It will also disrupt the homogeneity in user interface semantics of the application between the two platforms. Thereby strict adherence to traditional MVC hinders the architect from harnessing the power of this domain artifact.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
384
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS"

  1. 1. Adapting View Models as a Means ForSharing User Interface Code Between OS Xand iOSDileepa JayathilakeSATURN 2013
  2. 2. BackgroundProblem IdentificationSolution OverviewImplementationDiscussionConclusion
  3. 3. Product for both OSX and iOSWith a significantpart in commonHow to reuse codemaximally?
  4. 4. Is it possible toshare UI code?
  5. 5. View Modelsimplementcommon partof UIView Modelsare sharedView hooks intoView ModelControllershold platformspecificsBidirectionalbindings areplatform-specific
  6. 6. View Models contain view data and common UI behaviorModels are exposed to Views through View Models12
  7. 7. Common &Platform-specificcomponents of thesolution
  8. 8. Proof ofConcept:Book StoreApplication
  9. 9. Use of the solution in Book Storeapplication
  10. 10. Advantages• Improved code reuse• Better readability• Better Separation ofView Logic• Enhanced testabilityConcerns• Framework class usage• Bi-directional bindings
  11. 11. CONCLUSIONView Models combined with traditionalMVC can improve code reusesignificantly while providing otheradvantages for applications targetingboth OS X and iOS.
  12. 12. QUESTIONS
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×