210 likes | 293 Views
Designer’s Challenge. Preparing Applications for the Future Using MVC Concepts. By Don Bakke President, SRP Computer Solutions, Inc. What is MVC?. At the very least it’s just another computer acronym…Model-View-Controller It might be new to you but it’s been around for 30 years
E N D
Designer’s Challenge Preparing Applications for the Future Using MVC Concepts By Don Bakke President, SRP Computer Solutions, Inc.
What is MVC? • At the very least it’s just another computer acronym…Model-View-Controller • It might be new to you but it’s been around for 30 years • In varying degrees it is probably something you are already doing but didn’t know it • But before we explain MVC any further…
Audience Poll • Who here already has been or will plan to integrate an OpenInsight application with an alternative visual interface and/or with an alternative database server? • If you answered “yes” to this question then MVC should be of interest to you…
Model-View-Controller – A Bit of History • Architectural pattern for designing software where an application is described in and designed in three separate layers: • Model = Relates to the application’s database and business logic • View = Relates to the application’s presentation of the data • Controller = Relates to the application’s flow and ties the other layers together • Generally assumes that application layers are loosely connected
Model-View-Controller – A Bit of History • Coined in the late 70’s and made popular in the early 80’s with Smalltalk • Developed with Object Oriented technology in mind • Early versions assumed dumb clients • Spin-off versions include Model-View-Presenter, Model-View-Template, and Model-View-ViewModel
Who Needs to Know MVC? • Anyone who needs to substitute or allow for alternative layers with minimal code rewrite • Presentation layer - WPF, Flex, HTML, iPhone, webOS • Data layer - SQL, U2, AmazonS3, Google App Engine (e.g. Cloud resources – Tom Wilson) • Leverage existing resources – Tom Wilson • Anyone who wants easier code management and documentation • Anyone who develops with teams who are focused on a specific layer of the application
Who Needs to Know MVC? • Anyone who wants better unit testing of their code • Anyone who wants more reusability of their code • Anyone who wants more scalability in their application • Ask a Java, PHP, Ruby, .NET, or Cocoa developer
Who Doesn’t Need to Know MVC? • Anyone who prefers a ‘git-r-done’ approach • Anyone who never intends to work outside of OpenInsight
Model-View-Controller – A Closer Look • Disclaimers • I am not an MVC purist or expert • Much of what I am presenting is a “work-in-progress” effort • While MVC philosophy is always the same, pundits will differ on how to apply it
Model-View-Controller – A Closer Look • Separation of Concerns (Layers) • Model • View • Controller API Events Requests Notifications API Results Responses Notifications • View • Model • Controller • Presents Data to User • Handles Event Processing • Receivers User Inputs • Calls Appropriate Resources • Handles Data • Handles Business Logic
Model-View-Controller vs. n-Tier Architecture • View • Presentation Tier • Controller • Logic Tier • Model • Business Logic • Physical Data • Data Tier MVC n-Tier
Flex - Form Design Courtesy of Clay Borne
Calculate Shipping - Flowchart Start Have Zipcode? No Yes Shipping Logic Set “Missing Zipcode” Error Return Shipping Costs Display Error Display Shipping Cost (Color Red if too much) End
MVC Examples – Side by Side Comparison Flex / OI HTML / OI OI/ SQL Basic MVC Pure OI • View • HTML • Javascript • Flex/Flash • ActionScript • OI Form • Basic+ (Commuter) • OI Form • Basic+ (Commuter) • In Process Engine • Basic + • OECGI/2 • Basic+ • Controller • In Process Engine • Basic + • OECGI/2 • Basic+ • Linear Hash • Basic+ (MFS) • Linear Hash • Basic+ (MFS) • Linear Hash • Basic+ (MFS) • SQL • Basic+ or Direct • Model
Final Thoughts • Don’t swallow the elephant • Take one bite at a time • Translation: Don’t force yourself to convert everything to MVC. Ease into it • Don’t force a square peg in a round hole • Build a framework and standards to make this easier
Thank you Any Questions?