SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.

Slides:



Advertisements
Similar presentations
SE2811 Week 7, Class 2 The Gang of Four and more … Lab Thursday: Quiz SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder.
Advertisements

SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Design Patterns Yes, they are important Robert Cotton April 23, 2009.
Object-Oriented Design. Method for designing computer programs Consider “objects” interacting in the program –Example: a zoo.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Design Patterns Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson,Ralph Johnson and John Vlissides (The Gang of.
Adapters Presented By Zachary Dea. Definition A pattern found in class diagrams in which you are able to reuse an ‘adaptee’ class by providing a class,
Object-Oriented Design Patterns CSC 335: Object-Oriented Programming and Design.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
BTS530: Major Project Planning and Design The Composite Pattern All References and Material From: Design Patterns,by (GOF!) E.Gamma, R.Helm, R.Johnson,
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
January 12, Introduction to Design Patterns Tim Burke References: –Gamma, Erich, et. al. (AKA, The Gang of Four). Design Patterns: Elements of Reusable.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
CS 325: Software Engineering February 12, 2015 Applying Responsibility-Assignment Patterns Design Patterns Situation-Specific Patterns Responsibility-Assignment.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Design Patterns Introduction to Design Patterns Eriq Muhammad Adams J. Mail : | Blog :
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Mohammed Al-Dhelaan CSci 253 Object Oriented Design Instructor: Brad Taylor 06/02/2009 Factory Method Pattern.
CS 160: Software Engineering October 22 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style ADVANCED PROGRAMMING PRACTICES Model View.
Seung Ha.  Façade is generally one side of the exterior of a building, especially the front.  Meaning “frontage” or “face”  In software architecture,
Week 6, Day 3 The Gang of Four and more … A new design pattern SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
1 Lecture Material Design Patterns Visitor Client-Server Factory Singleton.
Introduction To Design Patterns
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
Design Patterns: MORE Examples
Software Design Refinement Using Design Patterns
Unit II-Chapter No. : 5- design Patterns
Factory Method Pattern
MPCS – Advanced java Programming
Interfaces.
COMP280:Introduction to Software Development, Week 9, Lecture 27
Instructor: Dr. Hany H. Ammar
Section 11.1 Class Variables and Methods
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Interfaces.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Introduction To Design Patterns
Composite Design Pattern By Aravind Reddy Patlola.
Presentation transcript:

SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin

Agenda – Lecture 11a Review & renew. GoF Solutions to Exercise Set 9: PC-V-TS-G + Helper Solution to Exercise Set 8. GoF Composite, a second look. 8/20/2019 SOEN 343, © P.Chalin,

Redesigning Do-it-all TS (4 classes) Presentation Do-it-all Transaction Script Page Controller Template View redesign Transaction Script Domain Gateway Data Source 8/20/2019 SOEN 343, © P.Chalin,

Hello.jsp <%@ page contentType=“…" import=“…" %> <html> <% String fullName = (String) request.getAttribute("fullName"); %> <head><title>Hello</title></head> <body> <h1>Hello <%= fullName %>!</h1> </body> </html> 8/20/2019 SOEN 343, © P.Chalin,

Page Controller The doGet for this lecture’s solution is like the one presented last class except for: doGet(…) { … String fullName = GetNameTS.execute(ln); request.setAttribute(“fullName”, fullName); forward(“Hello.jsp”, request, response); } 8/20/2019 SOEN 343, © P.Chalin,

Using a Helper Class Why? Can hold several pieces of information to be used by the View. Can help decouple the View from, e.g. RDG. … 8/20/2019 SOEN 343, © P.Chalin,

Exercise Set 8 (for Igar et. al.) 8/20/2019 SOEN 343, © P.Chalin,

Relevant Code ViewTaskList processRequest(…) helper = new TaskListHelper(); ViewTaskListTS.execute(helper); request.setAttribute("helper", helper); forward("TaskManager.jsp", …); ViewTaskListTS execute(…) helper.setTaskList(TaskRDG.findAll()); 8/20/2019 SOEN 343, © P.Chalin,

ViewTaskList processRequest(…) TaskListHelper helper = new TaskListHelper(); try { ViewTaskListTS.execute(helper); } catch (Exception e) { helper.appendStatus(e.toString()); } if (helper.getTaskList() == null) { … } else { request.setAttribute("helper", helper); forward("TaskManager.jsp", request, response); 8/20/2019 SOEN 343, © P.Chalin,

ViewTaskListTS public static void execute(TaskListHelper helper) throws Exception { String msgHeader = "Total number of tasks: "; helper.setTaskList(TaskRDG.findAll()); DbRegistry.closeDbConnection(); helper.appendStatus(msgHeader + helper.getTaskList().size()); } 8/20/2019 SOEN 343, © P.Chalin,

Gang Of Four Gamma, Helm, Johnson, Vlissides SOEN 343, © P.Chalin, Erich 8/20/2019 SOEN 343, © P.Chalin,

Composite (Larman Section. 23.7) Context/problem How do you treat a group or composite structure of objects the same way (polymorphically) as a non-composite (atomic) object? Solution Define classes for composite and atomic objects so that they implement the same interface. 8/20/2019 SOEN 343, © P.Chalin,

Composite: Ex. Objects 8/20/2019 SOEN 343, © P.Chalin,

Composite: Ex. Class Diagram 8/20/2019 SOEN 343, © P.Chalin,

Must “add” be implemented by Line? In C++ add declared virtual; subclass need not implement it. In Java if add is abstract, then subclasses must implement it. String add(Graphic g) { throw new UnsupportedOperationException(); } Can you think of a better solution? 8/20/2019 SOEN 343, © P.Chalin,

Composite (Larman Section. 23.7) Context/problem How do you treat a group or composite structure of objects the same way (polymorphically) as a non-composite (atomic) object? Solution Define classes for composite and atomic objects so that they implement the same interface. 8/20/2019 SOEN 343, © P.Chalin,

Composite: Clients point-of-view 8/20/2019 SOEN 343, © P.Chalin,

Composite Pricing Strategies Interface Realization 8/20/2019 SOEN 343, © P.Chalin,

Composite 8/20/2019 SOEN 343, © P.Chalin,