SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
CODING
THE HAPPY MEAL PART 2
What is MVC?
• Model View Controller
• Design pattern / Architecture
• Standard in the design of modern web applications
• Decouple Presentation from Data
• Separation of Concerns
What is a Framework
• …is an abstraction in which software providing generic
functionality can be selectively changed by user code,
thus providing application specific software. It is a
collection of software libraries providing a defined
application programming interface (API).
From wikipedia.org
What is a Framework
Allows designers and programmers to devote their time to
meeting software requirements rather than dealing with the
more standard low-level details of providing a working
system, thereby reducing overall development time
From wikipedia.org
Why?
• Structured and consistent
• Alleviates common tasks
• Makes things easy easier
• Makes you productive
• Makes teamwork easier
• Makes applications easier to support
• Makes applications easier to extend
What is MVC?
• Model
What is MVC?
• Model
• Your Data
• Business Logic
• Knows nothing about how the data will be presented to a user
What is MVC?
• Model
• View
What is MVC?
• Model
• View
• Presentation Layer
• HTML/CSS
• XML/JSON
• PDF
• Has no idea where the data came from
What is MVC?
• Model
• View
• Controller
What is MVC?
• Model
• View
• Controller
• Receives request from user
• Talks to the model to get any needed data
• Passes data to the view
What is MVC?
http://myapp.com/users
What is MVC?
http://myapp.com/users.xml
What is MVC?
http://myapp.com/users
What is MVC?
http://myapp.com/users
Happy Meals
• Happy Meal Domain
• Objects
• Composed of other Objects
• Composed of other Objects using Inheritance
• Composed of other Objects composed of other Objects
Happy Meals
• Happy Meal Domain
• Objects
• Composed of other Objects
• Composed of other Objects using Inheritance
• Composed of other Objects composed of other Objects
What about ordering a Happy Meal?
Ordering a Happy Meal
Question:
How inefficient would it be if every person who
worked at McDonalds took care of a single customer,
one at a time?
1. Greet customer
2. Take order
3. Go in the back and cook food
4. Package food up
5. Take food to customer
6. Take money
7. Greet next customer
Ordering a Happy Meal
Question:
How inefficient would it be if every person who
worked at McDonalds took care of a single customer,
one at a time?
Instead, there are cashiers and cooks. There are
managers.
They all have their specific role.
Cashiers do not need to learn to cook. Cooks do not need
to learn to smile.
Controllers
Controllers
“Hi. I would like to order a happy meal.
Can I have it with a sprite, a hamburger
With ONLY pickles and ketchup.
And fries.”
Controllers
You do not care about who cooks your
food.
You do not care (or try to avoid thinking
about) how the food gets cooked.
You don’t talk to the cook. Your interaction
is with the cashier.
Models
Models
What are these people doing?
Models
The cook does not care
about you.
The cook doesn’t even know
you exist.
The cook talks to the
cashier. And the cashier
tells the cook what to
make.
Cooks do not have to smile.
Views
This is what your order looks like
Views
And let’s be honest.
You don’t care about the
cashier or the cook, do
you?
All you care about is that
your food gets to you and
that it is super delicious.
Views
What about orders “To Go”?
Views
“To Go” orders only affect
how the meal is packaged.
The ordering process is
exactly the same. The
communication between
the cashier and the cook
is exactly the same.
The cook still prepares the
food the same way.
The cook still doesn’t care about you. You are still avoiding thinking about
how your food has been made.
What is MVC?
http://myapp.com/users
API Access to your Web App
Your boss has a great idea. You need to build a web
services layer. She wants you to allow API access to your
app for third parties to integrate.
This is going to be great! But is it going to be major work?
Are we going to have to rebuild our entire system?
API Access to your Web App

Contenu connexe

Similaire à MVC Explained

Not Just a Pretty Face: Combining Form and Function for Maximum Conversions
Not Just a Pretty Face: Combining Form and Function for Maximum ConversionsNot Just a Pretty Face: Combining Form and Function for Maximum Conversions
Not Just a Pretty Face: Combining Form and Function for Maximum ConversionsWP Engine
 
10 Best Practices for Magento Maintenance and Support
10 Best Practices for Magento Maintenance and Support10 Best Practices for Magento Maintenance and Support
10 Best Practices for Magento Maintenance and SupportAPPSeCONNECT
 
The Web Guidelines - A battle between project goals and procurement rules
The Web Guidelines - A battle between project goals and procurement rulesThe Web Guidelines - A battle between project goals and procurement rules
The Web Guidelines - A battle between project goals and procurement rulesBaris Wanschers
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017Innovation Studio
 
Data Modeling for MongoDB
Data Modeling for MongoDBData Modeling for MongoDB
Data Modeling for MongoDBMongoDB
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Software, Inc.
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Software, Inc.
 
Phabricator gdg presentation
Phabricator gdg presentationPhabricator gdg presentation
Phabricator gdg presentationNizameddin Ordulu
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiMaurice De Beijer [MVP]
 
Comprehensive Validation with Laravel 4
Comprehensive Validation with Laravel 4Comprehensive Validation with Laravel 4
Comprehensive Validation with Laravel 4Kirk Bushell
 
Adding Another "M" to MVC: MVCM
Adding Another "M" to MVC: MVCMAdding Another "M" to MVC: MVCM
Adding Another "M" to MVC: MVCMMario Vargas
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for LongevityMuleSoft
 
The Science of Website Redesign
The Science of Website RedesignThe Science of Website Redesign
The Science of Website RedesignHubSpot
 
The Science of Website Redesign
The Science of Website RedesignThe Science of Website Redesign
The Science of Website RedesignBui Truong
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC PresentationVolkan Uzun
 
MaGIC Academy Symposium 2015
MaGIC Academy Symposium 2015MaGIC Academy Symposium 2015
MaGIC Academy Symposium 2015Nadhir Ashafiq
 

Similaire à MVC Explained (20)

Not Just a Pretty Face: Combining Form and Function for Maximum Conversions
Not Just a Pretty Face: Combining Form and Function for Maximum ConversionsNot Just a Pretty Face: Combining Form and Function for Maximum Conversions
Not Just a Pretty Face: Combining Form and Function for Maximum Conversions
 
Magento maintenance
Magento maintenanceMagento maintenance
Magento maintenance
 
10 Best Practices for Magento Maintenance and Support
10 Best Practices for Magento Maintenance and Support10 Best Practices for Magento Maintenance and Support
10 Best Practices for Magento Maintenance and Support
 
The Web Guidelines - A battle between project goals and procurement rules
The Web Guidelines - A battle between project goals and procurement rulesThe Web Guidelines - A battle between project goals and procurement rules
The Web Guidelines - A battle between project goals and procurement rules
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 
Data Modeling for MongoDB
Data Modeling for MongoDBData Modeling for MongoDB
Data Modeling for MongoDB
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
 
Relax, it's spa time
Relax, it's spa timeRelax, it's spa time
Relax, it's spa time
 
Phabricator gdg presentation
Phabricator gdg presentationPhabricator gdg presentation
Phabricator gdg presentation
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapi
 
Comprehensive Validation with Laravel 4
Comprehensive Validation with Laravel 4Comprehensive Validation with Laravel 4
Comprehensive Validation with Laravel 4
 
Adding Another "M" to MVC: MVCM
Adding Another "M" to MVC: MVCMAdding Another "M" to MVC: MVCM
Adding Another "M" to MVC: MVCM
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for Longevity
 
MVVM & RxSwift
MVVM & RxSwiftMVVM & RxSwift
MVVM & RxSwift
 
The Science of Website Redesign
The Science of Website RedesignThe Science of Website Redesign
The Science of Website Redesign
 
The Science of Website Redesign
The Science of Website RedesignThe Science of Website Redesign
The Science of Website Redesign
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
MaGIC Academy Symposium 2015
MaGIC Academy Symposium 2015MaGIC Academy Symposium 2015
MaGIC Academy Symposium 2015
 
Mvc part 1
Mvc part 1Mvc part 1
Mvc part 1
 

Dernier

Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 

Dernier (20)

Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

MVC Explained

  • 2. What is MVC? • Model View Controller • Design pattern / Architecture • Standard in the design of modern web applications • Decouple Presentation from Data • Separation of Concerns
  • 3. What is a Framework • …is an abstraction in which software providing generic functionality can be selectively changed by user code, thus providing application specific software. It is a collection of software libraries providing a defined application programming interface (API). From wikipedia.org
  • 4. What is a Framework Allows designers and programmers to devote their time to meeting software requirements rather than dealing with the more standard low-level details of providing a working system, thereby reducing overall development time From wikipedia.org
  • 5. Why? • Structured and consistent • Alleviates common tasks • Makes things easy easier • Makes you productive • Makes teamwork easier • Makes applications easier to support • Makes applications easier to extend
  • 7. What is MVC? • Model • Your Data • Business Logic • Knows nothing about how the data will be presented to a user
  • 8. What is MVC? • Model • View
  • 9. What is MVC? • Model • View • Presentation Layer • HTML/CSS • XML/JSON • PDF • Has no idea where the data came from
  • 10. What is MVC? • Model • View • Controller
  • 11. What is MVC? • Model • View • Controller • Receives request from user • Talks to the model to get any needed data • Passes data to the view
  • 16. Happy Meals • Happy Meal Domain • Objects • Composed of other Objects • Composed of other Objects using Inheritance • Composed of other Objects composed of other Objects
  • 17. Happy Meals • Happy Meal Domain • Objects • Composed of other Objects • Composed of other Objects using Inheritance • Composed of other Objects composed of other Objects What about ordering a Happy Meal?
  • 18. Ordering a Happy Meal Question: How inefficient would it be if every person who worked at McDonalds took care of a single customer, one at a time? 1. Greet customer 2. Take order 3. Go in the back and cook food 4. Package food up 5. Take food to customer 6. Take money 7. Greet next customer
  • 19. Ordering a Happy Meal Question: How inefficient would it be if every person who worked at McDonalds took care of a single customer, one at a time? Instead, there are cashiers and cooks. There are managers. They all have their specific role. Cashiers do not need to learn to cook. Cooks do not need to learn to smile.
  • 21. Controllers “Hi. I would like to order a happy meal. Can I have it with a sprite, a hamburger With ONLY pickles and ketchup. And fries.”
  • 22. Controllers You do not care about who cooks your food. You do not care (or try to avoid thinking about) how the food gets cooked. You don’t talk to the cook. Your interaction is with the cashier.
  • 24. Models What are these people doing?
  • 25. Models The cook does not care about you. The cook doesn’t even know you exist. The cook talks to the cashier. And the cashier tells the cook what to make. Cooks do not have to smile.
  • 26. Views This is what your order looks like
  • 27. Views And let’s be honest. You don’t care about the cashier or the cook, do you? All you care about is that your food gets to you and that it is super delicious.
  • 28. Views What about orders “To Go”?
  • 29. Views “To Go” orders only affect how the meal is packaged. The ordering process is exactly the same. The communication between the cashier and the cook is exactly the same. The cook still prepares the food the same way. The cook still doesn’t care about you. You are still avoiding thinking about how your food has been made.
  • 31. API Access to your Web App Your boss has a great idea. You need to build a web services layer. She wants you to allow API access to your app for third parties to integrate. This is going to be great! But is it going to be major work? Are we going to have to rebuild our entire system?
  • 32. API Access to your Web App