SlideShare a Scribd company logo
1 of 27
Download to read offline
9-Oct-13 1Controller - K.INIYA CSE Prefinal Year
9-Oct-13 2
It is the first object beyond the UI Layer
responsible for receiving or handling a system
operation message.
The controller pattern assigns the
responsibility of dealing with system events to
a non class that represents the overall system
or a use case scenario.
Controller - K.INIYA CSE Prefinal Year
9-Oct-13 3
What first object beyond the UI layer receives
and coordinates a system operation?
Controller - K.INIYA CSE Prefinal Year
Assigning the responsibility to a class
representing one of the following option
1)representing the overall
system a root object, a device that the
software is running within or a major
subsystem. These are the variations of facade
controller.
9-Oct-13 4Controller - K.INIYA CSE Prefinal Year
2)Represents a Use Case Scenario
within which the system event occurs, often
named
<usecaseName> Handler, <usecaseName>
Coordinator, or <usecaseName> Session.
9-Oct-13 5Controller - K.INIYA CSE Prefinal Year
(a) Use the same controller class for all system
events in the same usecase scenario.
(b) Informally, a session is an instance of a
conversion with an actor. Sessions can be of
any length but are often organized in terms
of usecases (use case Sessions).
9-Oct-13 6Controller - K.INIYA CSE Prefinal Year
9-Oct-13 7
Some System Operations of
NextGen Pos Application
endsale()
enterItem()
makeNewSale()
makePayment()
…………………….
System
Controller - K.INIYA CSE Prefinal Year
9-Oct-13 8Controller - K.INIYA CSE Prefinal Year
ItemID
Quantity
ENTER SAVE
:SaleJFrame
:Regi st er
actionPerformed (actionEvent)
UI Layer
Domain
Layer
Presses Button
9-Oct-13 9
enterItem(itemID,qty)
System Operation
Messages
Controller
:Sale
1:makeLineitem(itemID,qty)
Desirable Coupling of UI to domain Layer
Controller - K.INIYA CSE Prefinal Year
Controller - K.INIYA CSE Prefinal Year
ItemID
Quantity
ENTER SAVE
:SaleJFrame
:Sal e
actionPerformed (actionEvent)
UI Layer
Domain
Layer
Presses Button
Sale Jframe should not
send this message
9-Oct-13 10
1:makeLineitem(itemID,qty)
Less Desirable Coupling of User Interface to domain
Layer
9-Oct-13 11
:Register
:ProcessSaleHandler
enterItem(id,quantity)
enterItem(id,quantity)
Controller - K.INIYA CSE Prefinal Year
System Operations
Discovered during system
behaviour analysis
Allocation of system
operations during design
using one façade controller
9-Oct-13 12
endsale()
enterItem()
makeNewSale()
makePayment()
makeNewReturn()
enterReturnItem()
…………………….
System
endsale()
enterItem()
makeNewSale()
makePayment()
makeNewReturn()
enterReturnItem()
…………………….
Register
……………………
………….
Controller - K.INIYA CSE Prefinal Year
UI Layer does not contain Application Logic
rather UI Layer Objects must delegate work
requests to another layer.
System receives external input events ,that
involves GUI operated by a Person.
1) Other inputs are external messages.
2) For example: in a call processing
telecommunications switch or signals from
sensors.
9-Oct-13 13Controller - K.INIYA CSE Prefinal Year
A controller then suffers from bad (low)
cohesion violating the principle of High
Cohesion.
Facade controller are suitable when there are
“too many” system events, or when the User
Interface (UI) cannot redirect system event
messages to alternating controllers, such as in
a message processing system.
9-Oct-13 14Controller - K.INIYA CSE Prefinal Year
Boundary, Entity, Control classes in UP.
(a)Boundary objects are abstractions of the
interfaces.
(b)Entity objects are the application
independent domain software objects.
(c)Control objects are use Case handlers as in
Controller Pattern.
9-Oct-13 15Controller - K.INIYA CSE Prefinal Year
Increased potential for reuse and pluggable
interfaces.
Opportunity to reason about the state of the
usecase.
9-Oct-13 16Controller - K.INIYA CSE Prefinal Year
Command- In a message handling system,
each message may be represented and
handled by a separate command object.
Façade- A façade controller is a kind façade.
Layers- Placing domain logic in the domain
Layer rather than the Presentation Layer is the
part of the Layers.
9-Oct-13 17Controller - K.INIYA CSE Prefinal Year
• Pure Fabrication- A use case Controller is a
kind of Pure Fabrication.
(Pure Fabrication is a class that
does not represent a concept in the problem
Domain, specially made up to achieve low
coupling, high cohesion and reuse potential)
9-Oct-13 18Controller - K.INIYA CSE Prefinal Year
Java Technologies are used for
implementation for the two reasons:
i. Rich Client in Java Swing.
ii. Web UI with struts on the Server.
9-Oct-13 19Controller - K.INIYA CSE Prefinal Year
Package.com.craiglarman.nextgen.ui.swing;
Public class ProcessSaleJFrame extends Jframe
{
Private Register register;
Public ProcessSaleJFrame(Register_register)
{
register=_register;
}
Private Jbutton BTN_ENTER_ITEM()
Private Jbutton getBTN_ENTER_ITEM()
{
If (BTN_ENTER_ITEM!=null)
return BTN_ENTER_ITEM;
else
9-Oct-13 20Controller - K.INIYA CSE Prefinal Year
BTN_ENTER_ITEM=new Jbutton();
BTN_ENTER_ITEM.setText(“ENTER”)
BTN_ENTER_ITEM.addActionListener(newActionListener()
{
Public void actionPerformed(ActionEvent e)
{
ItemID id=Transformer.toItemID(getTXT_ID().getText());
Int qty=Transformer.toInt(getTXT_QTY().getText());
register.enterItem(id,qty);
}
});
return BTN_ENTER_ITEM;
}
}
9-Oct-13 21Controller - K.INIYA CSE Prefinal Year
DEFINITION
Poorly designed, a controller class with have
low cohesion-unfocused and handling too
many areas of responsibility, this is called a
Bloated Controller.
9-Oct-13 22Controller - K.INIYA CSE Prefinal Year
There is only a Single Controller class
receiving all system events in the system. This
sometimes happens if a façade controller is
chosen.
The Controller itself performs many of the
tasks necessary to fulfill the system event. This
usually involves a violation of Information
Expert and High Cohesion.
9-Oct-13 23Controller - K.INIYA CSE Prefinal Year
A Controller has many attributes and it
maintains significant information about the
system or domain, which should have been
distributed to other objects, or it duplicates
information found elsewhere.
9-Oct-13 24Controller - K.INIYA CSE Prefinal Year
Among the cures for a bloated controller are
these two:
1)Add more controllers- a system does not have
to need only one.
For example:
consider the application with many system
events, such as an Airline Reservation System.
9-Oct-13 25Controller - K.INIYA CSE Prefinal Year
It may contain the following Controllers
2) Design the controller so that it primarily
delegates the fulfillment of each system
operation responsibility to other objects.
9-Oct-13 26
Use Case Controllers
Make Reservation Handler
Make Schedules Handler
Make Fares Handler
Controller - K.INIYA CSE Prefinal Year
9-Oct-13 27Controller - K.INIYA CSE Prefinal Year

More Related Content

Similar to Controller pattern assigns responsibility for system events

Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.Ankita Tiwari
 
Threads handlers and async task, widgets - day8
Threads   handlers and async task, widgets - day8Threads   handlers and async task, widgets - day8
Threads handlers and async task, widgets - day8Utkarsh Mankad
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insTonny Madsen
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosicmfrancis
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMMario Fusco
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
Strategy Design Pattern
Strategy Design PatternStrategy Design Pattern
Strategy Design PatternGanesh Kolhe
 
Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...
Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...
Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...Toshihiko Yamakami
 
Not a Security Boundary: Bypassing User Account Control
Not a Security Boundary: Bypassing User Account ControlNot a Security Boundary: Bypassing User Account Control
Not a Security Boundary: Bypassing User Account Controlenigma0x3
 
Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...
Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...
Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...Tanja Mayerhofer
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonfNataliya Patsovska
 

Similar to Controller pattern assigns responsibility for system events (20)

Stuxnet dc9723
Stuxnet dc9723Stuxnet dc9723
Stuxnet dc9723
 
Auditing.ppt
Auditing.pptAuditing.ppt
Auditing.ppt
 
Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.Design the implementation of CDEx Robust DC Motor.
Design the implementation of CDEx Robust DC Motor.
 
Beat the Clock: Background Tasking in Windows 8
Beat the Clock: Background Tasking in Windows 8Beat the Clock: Background Tasking in Windows 8
Beat the Clock: Background Tasking in Windows 8
 
2.5 gui
2.5 gui2.5 gui
2.5 gui
 
Threads handlers and async task, widgets - day8
Threads   handlers and async task, widgets - day8Threads   handlers and async task, widgets - day8
Threads handlers and async task, widgets - day8
 
Vista uipi.ppt (1)
Vista uipi.ppt (1)Vista uipi.ppt (1)
Vista uipi.ppt (1)
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
Reactive Data System
Reactive Data SystemReactive Data System
Reactive Data System
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
Strategy Design Pattern
Strategy Design PatternStrategy Design Pattern
Strategy Design Pattern
 
Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...
Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...
Device Stand-by Management Scheme of IoT: A Framework for Dealing with Real-w...
 
Not a Security Boundary: Bypassing User Account Control
Not a Security Boundary: Bypassing User Account ControlNot a Security Boundary: Bypassing User Account Control
Not a Security Boundary: Bypassing User Account Control
 
Activity 5
Activity 5Activity 5
Activity 5
 
Java Programming Projects
Java Programming ProjectsJava Programming Projects
Java Programming Projects
 
Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...
Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...
Towards the Semantic Integration of Plant Behavior Models with AutomationML’s...
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
 
Struts by l n rao
Struts by l n raoStruts by l n rao
Struts by l n rao
 

More from Iniya Kannan

Telephone conversation iniya 14mba002
Telephone conversation iniya 14mba002Telephone conversation iniya 14mba002
Telephone conversation iniya 14mba002Iniya Kannan
 
Mobile App for Booking Movie Ticket
Mobile App for Booking Movie TicketMobile App for Booking Movie Ticket
Mobile App for Booking Movie TicketIniya Kannan
 
Mobile App for Movie Ticket Booking Screenshots
Mobile App for Movie Ticket Booking ScreenshotsMobile App for Movie Ticket Booking Screenshots
Mobile App for Movie Ticket Booking ScreenshotsIniya Kannan
 
Converting agricultural waste for useful purposes
Converting agricultural waste for useful purposesConverting agricultural waste for useful purposes
Converting agricultural waste for useful purposesIniya Kannan
 
Probabilistic reasoning
Probabilistic reasoningProbabilistic reasoning
Probabilistic reasoningIniya Kannan
 
16-Queen's Problem
16-Queen's Problem16-Queen's Problem
16-Queen's ProblemIniya Kannan
 

More from Iniya Kannan (13)

Event iniya
Event iniyaEvent iniya
Event iniya
 
Telephone conversation iniya 14mba002
Telephone conversation iniya 14mba002Telephone conversation iniya 14mba002
Telephone conversation iniya 14mba002
 
Mobile App for Booking Movie Ticket
Mobile App for Booking Movie TicketMobile App for Booking Movie Ticket
Mobile App for Booking Movie Ticket
 
Mobile App for Movie Ticket Booking Screenshots
Mobile App for Movie Ticket Booking ScreenshotsMobile App for Movie Ticket Booking Screenshots
Mobile App for Movie Ticket Booking Screenshots
 
9 creations
9 creations9 creations
9 creations
 
Converting agricultural waste for useful purposes
Converting agricultural waste for useful purposesConverting agricultural waste for useful purposes
Converting agricultural waste for useful purposes
 
Cmp
CmpCmp
Cmp
 
Probabilistic reasoning
Probabilistic reasoningProbabilistic reasoning
Probabilistic reasoning
 
Long run
Long runLong run
Long run
 
Ray tracing
Ray tracingRay tracing
Ray tracing
 
Web mining
Web miningWeb mining
Web mining
 
Tsunami
TsunamiTsunami
Tsunami
 
16-Queen's Problem
16-Queen's Problem16-Queen's Problem
16-Queen's Problem
 

Recently uploaded

Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Comparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptxComparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptxAvaniJani1
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 

Recently uploaded (20)

Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
CARNAVAL COM MAGIA E EUFORIA _
CARNAVAL COM MAGIA E EUFORIA            _CARNAVAL COM MAGIA E EUFORIA            _
CARNAVAL COM MAGIA E EUFORIA _
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Comparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptxComparative Literature in India by Amiya dev.pptx
Comparative Literature in India by Amiya dev.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 

Controller pattern assigns responsibility for system events

  • 1. 9-Oct-13 1Controller - K.INIYA CSE Prefinal Year
  • 2. 9-Oct-13 2 It is the first object beyond the UI Layer responsible for receiving or handling a system operation message. The controller pattern assigns the responsibility of dealing with system events to a non class that represents the overall system or a use case scenario. Controller - K.INIYA CSE Prefinal Year
  • 3. 9-Oct-13 3 What first object beyond the UI layer receives and coordinates a system operation? Controller - K.INIYA CSE Prefinal Year
  • 4. Assigning the responsibility to a class representing one of the following option 1)representing the overall system a root object, a device that the software is running within or a major subsystem. These are the variations of facade controller. 9-Oct-13 4Controller - K.INIYA CSE Prefinal Year
  • 5. 2)Represents a Use Case Scenario within which the system event occurs, often named <usecaseName> Handler, <usecaseName> Coordinator, or <usecaseName> Session. 9-Oct-13 5Controller - K.INIYA CSE Prefinal Year
  • 6. (a) Use the same controller class for all system events in the same usecase scenario. (b) Informally, a session is an instance of a conversion with an actor. Sessions can be of any length but are often organized in terms of usecases (use case Sessions). 9-Oct-13 6Controller - K.INIYA CSE Prefinal Year
  • 7. 9-Oct-13 7 Some System Operations of NextGen Pos Application endsale() enterItem() makeNewSale() makePayment() ……………………. System Controller - K.INIYA CSE Prefinal Year
  • 8. 9-Oct-13 8Controller - K.INIYA CSE Prefinal Year
  • 9. ItemID Quantity ENTER SAVE :SaleJFrame :Regi st er actionPerformed (actionEvent) UI Layer Domain Layer Presses Button 9-Oct-13 9 enterItem(itemID,qty) System Operation Messages Controller :Sale 1:makeLineitem(itemID,qty) Desirable Coupling of UI to domain Layer Controller - K.INIYA CSE Prefinal Year
  • 10. Controller - K.INIYA CSE Prefinal Year ItemID Quantity ENTER SAVE :SaleJFrame :Sal e actionPerformed (actionEvent) UI Layer Domain Layer Presses Button Sale Jframe should not send this message 9-Oct-13 10 1:makeLineitem(itemID,qty) Less Desirable Coupling of User Interface to domain Layer
  • 12. System Operations Discovered during system behaviour analysis Allocation of system operations during design using one façade controller 9-Oct-13 12 endsale() enterItem() makeNewSale() makePayment() makeNewReturn() enterReturnItem() ……………………. System endsale() enterItem() makeNewSale() makePayment() makeNewReturn() enterReturnItem() ……………………. Register …………………… …………. Controller - K.INIYA CSE Prefinal Year
  • 13. UI Layer does not contain Application Logic rather UI Layer Objects must delegate work requests to another layer. System receives external input events ,that involves GUI operated by a Person. 1) Other inputs are external messages. 2) For example: in a call processing telecommunications switch or signals from sensors. 9-Oct-13 13Controller - K.INIYA CSE Prefinal Year
  • 14. A controller then suffers from bad (low) cohesion violating the principle of High Cohesion. Facade controller are suitable when there are “too many” system events, or when the User Interface (UI) cannot redirect system event messages to alternating controllers, such as in a message processing system. 9-Oct-13 14Controller - K.INIYA CSE Prefinal Year
  • 15. Boundary, Entity, Control classes in UP. (a)Boundary objects are abstractions of the interfaces. (b)Entity objects are the application independent domain software objects. (c)Control objects are use Case handlers as in Controller Pattern. 9-Oct-13 15Controller - K.INIYA CSE Prefinal Year
  • 16. Increased potential for reuse and pluggable interfaces. Opportunity to reason about the state of the usecase. 9-Oct-13 16Controller - K.INIYA CSE Prefinal Year
  • 17. Command- In a message handling system, each message may be represented and handled by a separate command object. Façade- A façade controller is a kind façade. Layers- Placing domain logic in the domain Layer rather than the Presentation Layer is the part of the Layers. 9-Oct-13 17Controller - K.INIYA CSE Prefinal Year
  • 18. • Pure Fabrication- A use case Controller is a kind of Pure Fabrication. (Pure Fabrication is a class that does not represent a concept in the problem Domain, specially made up to achieve low coupling, high cohesion and reuse potential) 9-Oct-13 18Controller - K.INIYA CSE Prefinal Year
  • 19. Java Technologies are used for implementation for the two reasons: i. Rich Client in Java Swing. ii. Web UI with struts on the Server. 9-Oct-13 19Controller - K.INIYA CSE Prefinal Year
  • 20. Package.com.craiglarman.nextgen.ui.swing; Public class ProcessSaleJFrame extends Jframe { Private Register register; Public ProcessSaleJFrame(Register_register) { register=_register; } Private Jbutton BTN_ENTER_ITEM() Private Jbutton getBTN_ENTER_ITEM() { If (BTN_ENTER_ITEM!=null) return BTN_ENTER_ITEM; else 9-Oct-13 20Controller - K.INIYA CSE Prefinal Year
  • 21. BTN_ENTER_ITEM=new Jbutton(); BTN_ENTER_ITEM.setText(“ENTER”) BTN_ENTER_ITEM.addActionListener(newActionListener() { Public void actionPerformed(ActionEvent e) { ItemID id=Transformer.toItemID(getTXT_ID().getText()); Int qty=Transformer.toInt(getTXT_QTY().getText()); register.enterItem(id,qty); } }); return BTN_ENTER_ITEM; } } 9-Oct-13 21Controller - K.INIYA CSE Prefinal Year
  • 22. DEFINITION Poorly designed, a controller class with have low cohesion-unfocused and handling too many areas of responsibility, this is called a Bloated Controller. 9-Oct-13 22Controller - K.INIYA CSE Prefinal Year
  • 23. There is only a Single Controller class receiving all system events in the system. This sometimes happens if a façade controller is chosen. The Controller itself performs many of the tasks necessary to fulfill the system event. This usually involves a violation of Information Expert and High Cohesion. 9-Oct-13 23Controller - K.INIYA CSE Prefinal Year
  • 24. A Controller has many attributes and it maintains significant information about the system or domain, which should have been distributed to other objects, or it duplicates information found elsewhere. 9-Oct-13 24Controller - K.INIYA CSE Prefinal Year
  • 25. Among the cures for a bloated controller are these two: 1)Add more controllers- a system does not have to need only one. For example: consider the application with many system events, such as an Airline Reservation System. 9-Oct-13 25Controller - K.INIYA CSE Prefinal Year
  • 26. It may contain the following Controllers 2) Design the controller so that it primarily delegates the fulfillment of each system operation responsibility to other objects. 9-Oct-13 26 Use Case Controllers Make Reservation Handler Make Schedules Handler Make Fares Handler Controller - K.INIYA CSE Prefinal Year
  • 27. 9-Oct-13 27Controller - K.INIYA CSE Prefinal Year