This document discusses two design patterns: MVC and Facade. It describes the MVC pattern as separating an application into three roles - model, view, and controller. The model manages the data, the view displays it, and the controller handles user input and updates the model and view. It then provides an example using a student model, view, and controller. It also describes the Facade pattern as providing a simplified interface to a complex subsystem, hiding its internal complexity. It gives an example using shapes and a facade class to delegate to concrete shape classes.
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 ratings0% found this document useful (0 votes)
51 views
Design Patterns
This document discusses two design patterns: MVC and Facade. It describes the MVC pattern as separating an application into three roles - model, view, and controller. The model manages the data, the view displays it, and the controller handles user input and updates the model and view. It then provides an example using a student model, view, and controller. It also describes the Facade pattern as providing a simplified interface to a complex subsystem, hiding its internal complexity. It gives an example using shapes and a facade class to delegate to concrete shape classes.
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/ 16
Design Patterns
MVC Pattern stands for Model-View-Controller
Pattern. Separate application's concerns. Model - Model represents an object carrying data and to update controller. View - View represents visualization of the data that model contains. Controller - Controller acts on both model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps view and model separate. We are going to create a Student object acting as a model. StudentView will be a view class which can print student details on console and StudentController is the controller class responsible to store data in Student object and update view StudentView accordingly. MVCPatternDemo, our demo class, will use StudentController to demonstrate use of MVC pattern Facade pattern hides the complexities of the system and provides an interface to the client using which the client can access the system. This type of design pattern comes under structural pattern as this pattern adds an interface to existing system to hide its complexities. This pattern involves a single class which provides simplified methods required by client Delegates calls to methods of existing system classes. We are going to create a Shape interface and concrete classes implementing the Shape interface. A facade class ShapeMaker is defined as a next step. ShapeMaker class uses the concrete classes to delegate user calls to these classes. FacadePatternDemo, our demo class, will use ShapeMaker class to show the results. Bernd Bruegge & Alllen H. Dutoit- Object Oriented Software Engineering- Using UML, Patterns and Java