0% found this document useful (0 votes)
7 views12 pages

Week7_Part2_MVC-pattern

MVC pattern

Uploaded by

a.hamoud6161
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

Week7_Part2_MVC-pattern

MVC pattern

Uploaded by

a.hamoud6161
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Compound Patterns?

• What is a compound pattern?


• Patterns of patterns
• Let us meet the Model-View-Controller ….

Copyright © 2011 Soha Makady. All rights reserved 1


Model-View-Controller
• Model:
• The model is the programmatic representation
of the application's data.
• While the model does not typically know how to
display itself, it often contains functionality for
persisting (and loading) itself from permanent
storage.

Copyright © 2011 Soha Makady. All rights reserved 2


Model-View-Controller
• View:
• The View is primarily responsible for rendering
the Model for presentation to the user.
• Users interact with and manipulate the view in
order to change the model.
• The view does not itself store data or maintain
state and is often updated independently from
the Controller or the Model.
• Views often declare an interface allowing
different Views to work for the same task (e.g., a
DesktopView and a MobileView).

Copyright © 2011 Soha Makady. All rights reserved 3


Model-View-Controller
• Controller:
• The Controller contains the main application logic
for the system and binds the View to the Model.
• The Controller mediates how the Model is updated
when the user performs actions in the View.
• Controllers are typically tightly bound to the View
interface.

Copyright © 2011 Soha Makady. All rights reserved 4


Meet the Model-View-Controller

Copyright © 2011 Soha Makady. All rights reserved 5


Model-View-Controller Tradeoffs
• Pros
• Support multiple views
• Enhanced testability (how?)
• Enhanced maintainability (how?)

Copyright © 2011 Soha Makady. All rights reserved 6


Model-View-Controller Tradeoffs
• Cons
• Application logic within views?
• Model updates?
• Size of controllers?

Copyright © 2011 Soha Makady. All rights reserved 7


Looking at MVC through patterns-colored glasses

Copyright © 2011 Soha Makady. All rights reserved 8


Looking at MVC through patterns-colored glasses

Copyright © 2011 Soha Makady. All rights reserved 9


Looking at MVC through patterns-colored glasses

Copyright © 2011 Soha Makady. All rights reserved 10


Looking at MVC through patterns-colored glasses

Copyright © 2011 Soha Makady. All rights reserved 11


References
• The material in slides 2 to 7 is retrieved
from a software engineering course
offering by Dr. Reid Holmes
https://github.com/ubccpsc/310/blob/main/
resources/readings/MVStar.md
• The material in slides 8 to 11 is retrieved
from Head First Design Patterns, Chapter
12.

Copyright © 2011 Soha Makady. All rights reserved 12

You might also like