CS112 Lecture: Reuse, Packages, Patterns
|
|
- Myles Blankenship
- 5 years ago
- Views:
Transcription
1 CS112 Lecture: Reuse, Packages, Patterns Revised 4/20/05 Objectives: 1. To introduce the idea of re-use 2. To introduce some characteristics that make classes re-usable 3. To introduce Java packages. 4. To introduce the notion of patterns 5. To introduce the MVC Architectural pattern and the Observer Design pattern Materials: 1. Javadoc of javax.swing.joptionpane to project 2. Project 4 web site 3. MVC Spreadsheet Example 4. Gang of Four book I. Introduction A. One of the key ideas in modern software engineering is the idea of re-use - rather than building every software system from scratch, making as much use as possible of work that has been done previously. 1. This is quite common in other fields a) Example: when an architect designs a building, the overall structure of the building may be unique, but it makes use of standard components such as doors, windows, heating units, floor coverings, ceiling tiles, roof designs, etc. b) Example: mechanical engineers seldom design screws and nuts as part of systems they develop - they make use of existing off the shelf components. 2. Historically, this has not been nearly as typical of software. Many software systems are designed almost entirely from scratch.. a) Obviously, this results in increased costs and longer project times. b) It also results in decreased reliability, because software that is re-used typically has already had many of the errors in it discovered and corrected. 1
2 B. In OO systems, the basic unit of re-use is the class. We want to design our classes in such a way as to maximize the possibility of re-using them in other systems. Today, we will look at some factors that contribute to reusability of classes. II. Generality A. One thing that increases the likelihood of being able to re-use a class is giving some attention to making it as general as possible when it is first designed. B. Frequently, this takes the form of incorporating key values as settable instance variables, rather than wiring them in. EXAMPLE: The showconfirmdialog() method of JOptionPane, which allows you to specify how many buttons you want and what their labels should be. SHOW Javadoc documentation 1. In Project 4, when you implement the dodelete() method of AddressBookController, you will want to use the 2 button version when asking the user to confirm deletion ( Yes or No ) 2. When you implement the dooffersavechanges() method, you will need to use the 3 button version ( Yes meaning to save changes, then perform the operation; No meaning to not save changes but perform the operation nonetheless - thus effectively discarding the changes; Cancel meaning don t do the original operation at all). C. It is also desirable to provide methods that provide flexibility to a user of the class. EXAMPLE: Again, the various show... Dialog methods of JOptionPane come in a number of different flavors. SHOW in Javadoc 1. Note that it is possible for a Java class to have two or more methods (including constructors) with the same name provided each has a different signature. a) The signature of a method consists of its name and the number and 2
3 types of its parameters (but not any modifiers or the names of the parameters or the type of the return value) (1) EXAMPLE: The following are different methods because they have different signatures: foo(int x) foo(float x) foo(int x, int y) (2) EXAMPLE: The following are not different methods: public int foo(int x) private int foo(int x) static int foo(int x) int foo(int y) float foo(int x) As a result, at most one of them could appear in a given class. (3) The term prototype is used to refer to the complete specification of the method - its modifiers, return type, and signature. EXAMPLE: Each of the above has a distinct prototype b) Note that the rule that two methods with the same name must have different signatures applies to methods of the same class. Two different classes may have methods with the same signature without problem. c) When a class has two methods with the same name but different signatures, we say that the method is overloaded. EXAMPLE: In the JOptionPane class, the constructor is overloaded, as is the showconfirmdialog() method. (Show in Javadoc) 2. Another example: the MultiInputPane class given to you for Project 4. a) Discuss various methods in Javadoc b) Show how they are implemented by projecting code - note how the 3
4 various convenience methods call the one basic method, and how the basic method is implemented. III. Cohesion and Coupling A. Two characteristics of a class that help to make it re-usable are that it has high cohesion internally and low coupling to other classes. B. A class has high cohesion when every feature of the class contributes to a single clearly defined purpose. (Wu calls this the STO - Single Task Object - principle). 1. It is tempting to design classes which perform multiple tasks. In such cases, the quality of the design - and the potential for re-use - can be increased by factoring the class into two or more classes, each of which has a single task. 2. EXAMPLE: The JList class in Swing. Every JList object is associated with another object - called its model - that contains the information it displays. SHOW: Code variables for AddressBookGUI for Project 4 - distinct variables for the list and its model. This distinction is made (in the design of Swing) because: a) If there are a lot of items, then at any given time, only a portion of the items are visible in the list - so there is a need to distinguish between the items that are displayed and the items that are present. Various operations (e.g. changing the size of the window or scrolling the list) affect what items are actually displayed, with no impact on the overall list itself. b) Changing the list of items in the model may or may not have any impact on the visible display - depending on whether or not the item that is changed is currently visible. c) The displayed list supports capabilities like size adjustment, scrolling, selecting an item etc, which are conceptually distinct from holding a list of items. C. Two classes exhibit high coupling when one one class depends on the other in such a way that changing one class requires changes to the other as well. What we want, of course, is low coupling, not high coupling. 4
5 1. Obviously, it is not possible, or desirable, to eliminate all coupling between classes - otherwise they could not work together at all. Some coupling between classes is inherent in their need to work together on a common task. However, unnecessary coupling is a barrier to re-use. 2. What we try to do is to achieve a controlled form of coupling that minimizes the inter-dependency D. One factor that contributes to producing classes with high cohesion and low coupling - and thus candidates that have a good chance of being reusable - is to recognize that objects in a program play different roles, and we should generally avoid asking an object to play several different roles. We discussed this earlier, but it is good to review it now. 1. An entity object is used to model a thing in (concrete or abstact) in the domain of the program, with methods providing operations on it. EXAMPLE: What kind(s) of objects fulfill this function in Project 4? ASK a) Person b) AddressBook c) Within the GUI, the namelistmodel Entity objects are excellent candidates for re-use - if a given class is a good model of a particular type of real-world entity, then it is a candidate for re-use in any program that deals with that entity. 2. A boundary object is used to manage interaction between the program and the outside world (human user or another system). EXAMPLE: The GUI for Project 4. Overall, it is a boundary object that is actually composed of many widgets, which are themselves boundary objects. (Specifically, the list of names is a JList; there are 5 buttons; there is a File menu with6 options (8 objects in all including the menu and the menubar). Individual component parts of a GUI are good candidates for re-use (e.g. 5
6 IV. Packages the various kinds of Component/JComponent in awt and Swing). The GUI as a whole, however, may be necessarily tied so closely to a given application as to not be re-usable. (That s ok, as long as we build it out of reusable components.) 3. A control object is used to manage the flow of computation, using the other objects. EXAMPLE: The AddressBookController object for Project 4 fulfills this role. A control object is usually so tied to the requirements of a particular application as to not be re-usable. Therefore, we try to factor as much as possible of the re-usable part of a task out of a controller to make it as small as possible. EXAMPLE: In Project 4, the controller has methods for sorting the AddressBook by name and by zip; but the actual logic for doing the sorting is in the AddressBook class, not the controller class, because these operations might prove useful in some other context where the AddressBook class is re-used. The logic in the controller object basically hands off the work to the entity object. SHOW in sequence diagram. 4. SHOW special symbols used in Analysis Class Diagram on web site 5. Note: Wu uses a slightly different categorization into user interface objects, controller objects, application logic objects, and storage objects. A. Ideally, we try to maximize the cohesion of classes we create and minimize their coupling to other classes. Sometimes, though there are groups of classes that work together so closely that a high degree of coupling is unavoidable and not really undesirable. EXAMPLE: The AddressBook and Person classes are like this. Some of the methods in AddressBook depend on knowing the specific kinds of information stored in a Person object. This is a perfectly reasonable and proper form of coupling. 6
7 B. When we have a group of classes that are closely related to one another - and cohesive among themselves as a group - we can put them in their own Java package. 1. We have already made extensive use of packages of classes - e.g. kareltherobot, javax.swing, and the various java. packages. 2. It is possible to create one s own package by including a package statement as the first statement in the source file for each class in it: package mypackage; import... Note: if you create your own packages, you should avoid names that can be confused with standard packages - e.g. your packages should never have names like java.anything. Commercial packages produced by various companies typically have names like com.company.something - e.g. the AddressBookApplication class uses some Macintosh-specific classes in the package com.apple.eawt. SHOW code for AddressBookApplication 3. The Java system requires that the package structure be mirrored by the directory structure, both for source files and for class files - e.g. a class Foo in package mypackage.stuff must have a source file called Foo.java and will produce a class file called Foo.class, both of which must reside in a folder called stuff in a folder called mypackage. package mypackage.stuff;... public class Foo... implies 7
8 mypackage stuff Foo. java Foo. class (Actually, you could use two separate folder hierarchies having the same structure - one for the sources and one for the classes.) C. Classes belonging to the same package have certain privileges with regard to one another. V. Patterns 1. A feature that has no visibility specified is accessible only to the class in which it occurs and other classes in the same package. 2. To be accessible to classes in a different package, a feature must have public visibility. 3. Note that a class that does not have a package statement is considered to belong to a top-level, unnamed package. Thus all classes that are not declared as being in a package effectively belong to the same package - the package that has no name. A. One idea that has gotten a lot of attention in recent years is the notion of patterns. Basically, a pattern represents the structure of a good solution to a commonly-occurring problem. What is re-used is not the specifics of some particular solution, but the overall structure of the solution. B. We have already met the notion of patterns at one level - the level of code patterns. Where have we seen these? ASK 8
9 When we talked about loops, we looked at several patterns - e.g. the priming the pump pattern, the input validation pattern. 1. Let s look again at the priming the pump pattern. 2. The basic problem this pattern addresses is the following: we have to process an unknown number of items. The last item is followed by a phony item called the sentinel, which is not to be processed, but rather serves as an indicator that all the real items have been seen. 3. This problem is tricky because we need to use a loop to process all the items. Inside the loop, we need to read an item before we can decide whether it is a real item or the sentinel, but we don t want to process it if it is the sentinel. 4. The solution is to read one item before entering the loop ( priming the pump ) and to read the next item at the end of the loop. read first item while (the item just read is not the sentinel) { process the item must read; read another item; } This gives us the desired behavior - we read one more item than we actually process (the sentinel), and the item we skip processing is the last item we read 5. Note that the pattern has a distinctive name ( priming the pump ) which allows us to talk about it. If you use this name in a conversation with any knowledgeable person, he/she will immediately know what you mean. C. But patterns can be used at other levels of design as well. Patterns that affect the overall structure of a system are often called Architectural patterns, and patterns that affect interaction between objects within a system are often called design patterns. Like code patterns, patterns at other levels tend to have a well-known name (or, unfortunately, sometimes several of them), which facilitates talking about them. D. An example of an architectural pattern: Model-View-Controller 1. The MVC pattern describes the overall structure of a system. It has three kinds of component part (each of which may involve multiple 9
10 objects/classes). a) The model part represents the information that is stored/manipulated by the system. Typically, the model is stored long-term. (1) Example: In Project 4, the address book is the model. It is composed of a single AddressBook object which typically contains multiple Person objects. (2) Example: in a spreadsheet program, the spreadsheet itself is the model. It is conceptually a two dimensional array of cells, each of which is either empty or is of one of several types (text, number, formula) Thus, we might have a class Spreadsheet and a base class Cell, with subclasses like TextCell, NumberCell, and FormulaCell. We might also have various graphs as part of the model. The specifications for each graph (what cells it includes, what its labels are, etc.) might be represented by an object of a class like GraphSpecifications. (3) Typically, the model is largely constructed from objects that belong to various entity classes. b) A view is a way of looking at the information that is presented to the user. (1) Example: In Project4, the GUI is the one and only view. It typically presents only a potion of the model (if there are more people than the name list can display). The portion that is displayed can be changed by scrolling the list. (2) Often, an application will provide multiple simultaneous views of the same model. The views are all linked to the same model, so that any change to the model will be reflected in all the (relevant) views. Example: MVC Example SS - showing a model plus three views - raw data, two graphs. Note how changing an item of raw data that appears in all views changes all three views; but if an item is not reflected in a particular view, then that view is unaffected. c) The controller part allows a user gesture in a view to impact the underlying model appropriately, which in turn may result in the view 10
11 being updated to reflect the changes to the model (1) Example: In Project 4, a user gesture such as clicking a button or choosing a menu option can result in a change to the model such as adding or removing a person, sorting the people, or creating an empty address book or opening an existing one. All of the above have an impact on the model. A user gesture can also initiate editing of a person, which has no direct impact on the view (since the person s name cannot be edited. (2) Example: in the spreadsheet, only the raw data view allows editing of data. But any change to the raw data can affect other views as well. (3) The reason distinguishing the controller from the views becomes more apparent in situation where it is possible to change the underlying model through more than one view - with the changes being reflected in all the views. Example: System Preferences / Appearance / Highlight color - choose other to get color picker. Note various views the color picker supports (though not simultaneously), and how a change to the color in one view affects all the others. (Set highlight color back to light blue at end!) (4) Not surprisingly, the controller portion of an application is generally constructed using control classes (plus sometimes entities as well.) 2. The MVC architectural pattern is appropriate to many applications, though certainly not all. Because is it so pervasive, the Java API includes some direct support for it, which we will discuss shortly. The API also itself uses this paradigm: for example, the relationship between the visible display of a list and the underlying model reflected in the design of the Swing class JList. E. By far the most common level at which patterns are found is at the Design Level - hence Design Patterns. There are scores of well-known patterns. We will look at only one here, which is very relevant to the MVC architecture and is used in your project 4. (We talk about others in CS211). 1. The standard book on Design Patterns is a book titled Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson, and Vlissides (colliquially called the Gang of Four book ). In 11
12 the introduction, the authors describe the notion of a design pattern this way: Design patterns capture solutions that have developed and evolved over time. Hence they aren t the designs people tend to generate initially. They reflect untold redesign and recoding as developers have struggled for greater reuse and flexibility in their software. Design patterns capture these solutions in a succinct and easily applied form. (page xi) 2. When describing a design pattern, it is common to introduce it in terms of its Motivation (what problem it is intended to solve). The example pattern we will discuss is one called the Observer Pattern. The Gang of four book introduces it with the following Motivation: A common side effect of partitioning a system into a collection of cooperating classes is the need to maintain consistency between related objects You don t want to achieve consistency by making the classes tightly coupled, because that reduces their reusability. For example, many graphical user interface toolkits separate the presentational aspect of the user interface [ called the view in MVC ] from the underlying application data [ called the model in MVC ]... (page 293) The Observer pattern describes how to establish these relationships. The key objects in this pattern are the subject and the observer. A subject may have any number of dependent observers. All observers are notified whenever the subject undergoes a change of state. In response, each observer will query the subject to synchronize its state with the subject s state. (page 294) 3. Java provides support for this pattern in the form of the class java.util.observable (which is used for what the description I just read called the subject) and the interface java.util.observer. The subject class extends java.util.observable. The observer class implements java.util.observable. a) An Observer registers itself with an Observable by calling the addobserver() method of the Observable. SHOW in code for AddressBookGUI, method setaddressbook(). This registers a desire on the observer s part to be notified whenever the subject changes. (The observer will then query the subject to find out about its new state in order to update its own state appropriately.) 12
13 b) Whenever the subject undergoes a change, it calls the methods setchanged() and notifyobservers(). This requirement is behind the note in the project handout that asks you to add code to these call these methods to the setfile() and setchangedsincelastsaved() methods of class AddressBook. c) This method (which is inherited from the base class java.util.observable then causes the update() method of each registered observer to be called. SHOW in code for AddressBookGUI, method update(). NOTE that this method updates the grayed out status of the Save menu option, and the title displayed in the title bar of the window. (They are always updated, even though they may not have changed - there is no simple way to know what s changed.) d) In this particular example, we are not using this mechanism to handle changes to the actual content or ordering of the address book. Instead, we are using it with the namelistmodel that is behind the list. SHOW in code for AddressBookGUI, methods corresponding to the add, delete, and sort buttons. (The pattern is used internally by the Swng classes JList and ListModel.) 13
CPS122 Lecture: Design Patterns Last revised March 20, 2012
CPS122 Lecture: Design Patterns Last revised March 20, 2012 Objectives 1. To introduce and illustrate the idea of design patterns 2. To introduce some key design patterns students have used or will use:
More informationCPS122 Lecture: Design Patterns Last revised March 7, 2017
CPS122 Lecture: Design Patterns Last revised March 7, 2017 Objectives 1. To introduce and illustrate the idea of design patterns 2. To introduce some key design patterns students have used or will use:
More informationCPS122 Lecture: Design Patterns Last revised April 22, 2010
CPS122 Lecture: Design Patterns Last revised April 22, 2010 Objectives 1. To introduce and illustrate the idea of design patterns 2. To introduce some key design patterns students have used or will use:
More informationCOSC 3351 Software Design. An Introduction to UML (III)
COSC 3351 Software Design An Introduction to UML (III) This lecture is based on an example from http://www.cs.gordon.edu/courses/cs211/addressbookexample/index.html Spring 2008 Goal Design an address book
More informationCS211 Lecture: Design Patterns Last revised November 30, 2007
CS211 Lecture: Design Patterns Last revised November 30, 2007 Objectives 1. To introduce and illustrate the idea of design patterns 2. To introduce some key design patterns students have used or will use:
More informationCS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class
CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount
More informationCS112 Lecture: Defining Instantiable Classes
CS112 Lecture: Defining Instantiable Classes Last revised 2/3/05 Objectives: 1. To describe the process of defining an instantiable class 2. To discuss public and private visibility modifiers. Materials:
More informationOrganization of User Interface Software
Organization of User Interface Software Administration Questions about assignments due and assignments assigned 2 What we will talk about Ways to organize UI code Different models of user interfaces as
More informationCS211 Lecture: Design Quality; Cohesion and Coupling; Packages
CS211 Lecture: Design Quality; Cohesion and Coupling; Packages Objectives: Last revised October 4, 2004 1. To introduce the notion of design quality, tradeoffs, and some principles of quality design 2.
More informationSoftware Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.
Software Design Patterns Jonathan I. Maletic, Ph.D. Department of Computer Science Kent State University J. Maletic 1 Background 1 Search for recurring successful designs emergent designs from practice
More informationCPS221 Lecture: Threads
Objectives CPS221 Lecture: Threads 1. To introduce threads in the context of processes 2. To introduce UML Activity Diagrams last revised 9/5/12 Materials: 1. Diagram showing state of memory for a process
More informationINTERNAL ASSESSMENT TEST III Answer Schema
INTERNAL ASSESSMENT TEST III Answer Schema Subject& Code: Object-Oriented Modeling and Design (15CS551) Sem: V ISE (A & B) Q. No. Questions Marks 1. a. Ans Explain the steps or iterations involved in object
More informationCPS122 Lecture: Detailed Design and Implementation
CPS122 Lecture: Detailed Design and Implementation Objectives: Last revised March 3, 2017 1. To introduce the use of a complete UML class box to document the name, attributes, and methods of a class 2.
More informationDesign Patterns. CSC207 Fall 2017
Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the
More informationDesign Patterns. CSC207 Winter 2017
Design Patterns CSC207 Winter 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe
More informationDesign Patterns Design patterns advantages:
Design Patterns Designing object-oriented software is hard, and designing reusable object oriented software is even harder. You must find pertinent objects factor them into classes at the right granularity
More informationCase studies: Outline Case Study: Noughts and Crosses
I. Automated Banking System Case studies: Outline Case Study: Noughts and Crosses II. III. Library Noughts and Crosses Definition of the problem Game played on a 3x3 square board between two players. The
More informationbe used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate
UNIT 4 GRASP GRASP: Designing objects with responsibilities Creator Information expert Low Coupling Controller High Cohesion Designing for visibility - Applying GoF design patterns adapter, singleton,
More informationCS122 Lecture: Reuse, Components, Frameworks and APIs
Objectives: CS122 Lecture: Reuse, Components, Frameworks and APIs 1. To introduce the basic concept of re-use 2. To introduce the notion of component-based software engineering 3. To introduce the notion
More informationTuesday, October 4. Announcements
Tuesday, October 4 Announcements www.singularsource.net Donate to my short story contest UCI Delta Sigma Pi Accepts business and ICS students See Facebook page for details Slide 2 1 Design Patterns Design
More informationOutline. Design Patterns. Observer Pattern. Definitions & Classifications
Outline Design Patterns Definitions & Classifications Observer Pattern Intent Motivation Structure Participants Collaborations Consequences Implementation 1 What is a Design Pattern describes a problem
More informationCS 349 / SE 382 Custom Components. Professor Michael Terry February 6, 2009
CS 349 / SE 382 Custom Components Professor Michael Terry February 6, 2009 Today s Agenda Midterm Notes A2 Scroll XOR demo A3 super special sneak preview Clarifications on Fitt s Law Undo Custom components
More informationCS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output
CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables
More informationWe will talk about Alt-Tab from the usability perspective. Think about: - Is it learnable? - Is it efficient? - What about errors and safety?
1 This lecture s candidate for the Hall of Fame & Shame is the Alt-Tab window switching interface in Microsoft Windows. This interface has been copied by a number of desktop systems, including KDE, Gnome,
More informationDesign Patterns. CSC207 Fall 2017
Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the
More informationModel-View-Controller (MVC) Architecture
JOHN DEACON Computer Systems Development, Consulting & Training Model-View-Controller (MVC) Architecture Author: John Deacon Synopsis: Although the MVC architecture (or pattern or idiom) has been around
More informationObject Relationships
Object Relationships Objects can work together in three different types of relationships: Uses: An object can use another to do some work (association). Composition: A complex object may be composed of
More informationCISC 323 Intro to Software Engineering
CISC 323 Intro to Software Engineering Topic 6: Design Patterns Readings in Custom Courseware, taken from Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson, Vlissides
More informationResponsibilities. Using several specific design principles to guide OO design decisions.
Designing Objects with Responsibilities Using several specific design principles to guide OO design decisions. Challenge Old-school advice on OOD After identifying i your requirements and creating a domain
More informationBasics of Object Oriented Programming. Visit for more.
Chapter 4: Basics of Object Oriented Programming Informatics Practices Class XII (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra,
More informationObjectives: 1. Introduce the course. 2. Define programming 3. Introduce fundamental concepts of OO: object, class
CS112 Lecture: Course Introduction Last revised 1/3/06 Objectives: 1. Introduce the course. 2. Define programming 3. Introduce fundamental concepts of OO: object, class Materials: 1. Questionnaire 2. Syllabi
More informationCS112 Lecture: Working with Numbers
CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations
More informationDESIGN PATTERN - INTERVIEW QUESTIONS
DESIGN PATTERN - INTERVIEW QUESTIONS http://www.tutorialspoint.com/design_pattern/design_pattern_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Design Pattern Interview Questions
More informationCSCU9T4: Managing Information
CSCU9T4: Managing Information CSCU9T4 Spring 2016 1 The Module Module co-ordinator: Dr Gabriela Ochoa Lectures by: Prof Leslie Smith (l.s.smith@cs.stir.ac.uk) and Dr Nadarajen Veerapen (nve@cs.stir.ac.uk)
More informationSoftware Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software
Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software Chapter 9 Introduction to Design Patterns Copy Rights Virtual University of Pakistan 1 Design
More informationEINDHOVEN UNIVERSITY OF TECHNOLOGY
EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)
More informationLecture 9: UI Software Architecture. Fall UI Design and Implementation 1
Lecture 9: UI Software Architecture Fall 2003 6.893 UI Design and Implementation 1 UI Hall of Fame or Shame? Source: Interface Hall of Shame Fall 2003 6.893 UI Design and Implementation 2 Today s hall
More informationDesign Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1
What is a Design Pattern? Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights and other writers rarely
More informationCSE 331 Software Design and Implementation. Lecture 17 Events, Listeners, Callbacks
CSE 331 Software Design and Implementation Lecture 17 Events, Listeners, Callbacks Zach Tatlock / Winter 2016 The limits of scaling What prevents us from building huge, intricate structures that work perfectly
More informationCHAPTER 1 COPYRIGHTED MATERIAL. Finding Your Way in the Inventor Interface
CHAPTER 1 Finding Your Way in the Inventor Interface COPYRIGHTED MATERIAL Understanding Inventor s interface behavior Opening existing files Creating new files Modifying the look and feel of Inventor Managing
More informationCHAPTER 5 GENERAL OOP CONCEPTS
CHAPTER 5 GENERAL OOP CONCEPTS EVOLUTION OF SOFTWARE A PROGRAMMING LANGUAGE SHOULD SERVE 2 RELATED PURPOSES : 1. It should provide a vehicle for programmer to specify actions to be executed. 2. It should
More informationCocoa Design Patterns. Erik M. Buck October 17, 2009
Cocoa Design Patterns Erik M. Buck October 17, 2009 Topics n What is a design pattern? n Why Focus on design patterns? n What is the Model View Controller design pattern? n Using MVC n When wouldn t you
More informationGoals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming
Goals of Lecture Lecture 27: OO Design Patterns Cover OO Design Patterns Background Examples Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2001 April 24, 2001 Kenneth
More informationMore on Design. CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson
More on Design CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson Outline Additional Design-Related Topics Design Patterns Singleton Strategy Model View Controller Design by
More informationCS 4300 Computer Graphics
CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture 8 September 22, 2011 GUIs GUIs in modern operating systems cross-platform GUI frameworks common GUI widgets event-driven programming Model-View-Controller
More informationLecture 13: Design Patterns
1 Lecture 13: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2005 2 Pattern Resources Pattern Languages of Programming Technical conference on Patterns
More informationCSE 331 Software Design and Implementation. Lecture 16 Callbacks and Observers
CSE 331 Software Design and Implementation Lecture 16 Callbacks and Observers Leah Perlmutter / Summer 2018 Announcements Announcements Quiz 6 due Thursday 8/2 Homework 7 due Thursday 8/2 Callbacks The
More informationCS112 Lecture: Loops
CS112 Lecture: Loops Objectives: Last revised 3/11/08 1. To introduce some while loop patterns 2. To introduce and motivate the java do.. while loop 3. To review the general form of the java for loop.
More informationCS211 Lecture: Modeling Dynamic Behaviors of Systems; Interaction Diagrams and Statecharts Diagrams in UML
CS211 Lecture: Modeling Dynamic Behaviors of Systems; Interaction Diagrams and Statecharts Diagrams in UML Objectives: 1. To introduce the notion of dynamic analysis 2. To show how to create and read Sequence
More informationSummary of the course lectures
Summary of the course lectures 1 Components and Interfaces Components: Compile-time: Packages, Classes, Methods, Run-time: Objects, Invocations, Interfaces: What the client needs to know: Syntactic and
More informationChapter 5 Object-Oriented Programming
Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares
More informationBack to ObjectLand. Contents at: Chapter 5. Questions of Interest. encapsulation. polymorphism. inheritance overriding inheritance super
korienekch05.qxd 11/12/01 4:06 PM Page 105 5 Back to ObjectLand Contents at: Chapter 5 #( encapsulation polymorphism inheritance overriding inheritance super learning the class hierarchy finding classes
More informationObjects and Classes. Amirishetty Anjan Kumar. November 27, Computer Science and Engineering Indian Institue of Technology Bombay
Computer Science and Engineering Indian Institue of Technology Bombay November 27, 2004 What is Object Oriented Programming? Identifying objects and assigning responsibilities to these objects. Objects
More informationEducational Fusion. Implementing a Production Quality User Interface With JFC
Educational Fusion Implementing a Production Quality User Interface With JFC Kevin Kennedy Prof. Seth Teller 6.199 May 1999 Abstract Educational Fusion is a online algorithmic teaching program implemented
More information1. BlueJ bank example with subclasses of BankAccount 2. Transparency of UML diagram for BankAccount class hierarchy
CS112 Lecture: Fundamental Concepts of Object-Oriented Software Development Last revised 1/13/04 Objectives: 1. To review/introduce key concepts of object-orientation: object, class, data members (class
More informationCS211 Lecture: Relationships Between Classes: Dependency, Inheritance, and Realization
CS211 Lecture: Relationships Between Classes: Dependency, Inheritance, and Realization Objectives: last revised July 21, 2003 1. To introduce the dependency relationship between classes 2. To review the
More informationAttaching Codesoft 6 to an ODBC Database
Attaching Codesoft 6 to an ODBC Database 1. From your Main Menu Options, go into Merge then Create ODBC query. The following Dialog Box will appear. 2. Select the button with 3 dots ( ) on it. 3. The Data
More informationCSE wi Final Exam 3/12/18. Name UW ID#
Name UW ID# There are 13 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationCS112 Lecture: Exceptions and Assertions
Objectives: CS112 Lecture: Exceptions and Assertions 1. Introduce the concepts of program robustness and reliability 2. Introduce exceptions 3. Introduce assertions Materials: 1. Online Java documentation
More informationThe Software Design Process. CSCE 315 Programming Studio, Fall 2017 Tanzir Ahmed
The Software Design Process CSCE 315 Programming Studio, Fall 2017 Tanzir Ahmed Outline Challenges in Design Design Concepts Heuristics Practices Challenges in Design A problem that can only be defined
More informationThe Design Patterns Matrix From Analysis to Implementation
The Design Patterns Matrix From Analysis to Implementation This is an excerpt from Shalloway, Alan and James R. Trott. Design Patterns Explained: A New Perspective for Object-Oriented Design. Addison-Wesley
More informationObject-Oriented Software Engineering Practical Software Development using UML and Java
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes Lecture 5 5.1 What is UML? The Unified Modelling Language is a standard graphical
More informationInheritance. EEC 521: Software Engineering. Dealing with Change. Polymorphism. Software Design. Changing requirements Code needs to be flexible
Inheritance EEC 521: Software Engineering Software Design Design Patterns: Decoupling Dependencies 10/15/09 EEC 521: Software Engineering 1 Inheritance is the mechanism by which one class can acquire properties/responsibilities
More informationimplementation support
Implementation support chapter 8 implementation support programming tools levels of services for programmers windowing systems core support for separate and simultaneous usersystem activity programming
More informationOutline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations
Outline Computer Science 331 Data Structures, Abstract Data Types, and Their Implementations Mike Jacobson 1 Overview 2 ADTs as Interfaces Department of Computer Science University of Calgary Lecture #8
More informationCS221 Lecture: Java Database Connectivity (JDBC)
CS221 Lecture: Java Database Connectivity (JDBC) Objectives: 1. To introduce using JDBC to access a SQL database revised 10/20/14 Materials: 1. Projectable of registration system architecture. 2. JDBC
More information3. UML Class Diagrams Page 1 of 15
3. UML Class Diagrams Page 1 of 15 The UML Class Diagram: Part 1 In the last article, we saw what use cases were, and how to identify and create use cases. Taking the series ahead, in this article, we
More informationObject-Oriented Design
Object-Oriented Design Lecturer: Raman Ramsin Lecture 20: GoF Design Patterns Creational 1 Software Patterns Software Patterns support reuse of software architecture and design. Patterns capture the static
More informationTO DO: Create a new class which adds statistics to the dice. NOTE: Don t forget to run regression tests
TO DO: Create a new class which adds statistics to the dice This class should add functionality to store the roll frequencies. You should implement a validation test (as well as running unit tests) as
More informationPlan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?
Plan Design principles: laughing in the face of change Perdita Stevens School of Informatics University of Edinburgh What are we trying to achieve? Review: Design principles you know from Inf2C-SE Going
More informationCIS Component-Based Software Design BAPTISM BY FIRE AN INTRODUCTION TO COURSE ESSENTIALS. Suggestions on the Design of Your Game of Nim Project
CIS 3309 Component-Based Software Design BAPTISM BY FIRE AN INTRODUCTION TO COURSE ESSENTIALS Suggestions on the Design of Your Game of Nim Project Work Requirements: Fall Semester 2017 (ver 1.0 July 4,
More informationHigh Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore
High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No # 09 Lecture No # 40 This is lecture forty of the course on
More informationPattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository
Pattern Resources Lecture 25: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Pattern Languages of Programming Technical conference on Patterns
More informationPatterns of learning
Design patterns Patterns of learning Suppose we want to learn how to play chess. First, we need to learn the basic rules. Then we need to learn the basic strategy/ principles (value of pieces, etc.). To
More informationTopics in Object-Oriented Design Patterns
Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;
More informationCS352 Lecture: Database System Architectures last revised 11/22/06
CS352 Lecture: Database System Architectures last revised 11/22/06 I. Introduction - ------------ A. Most large databases require support for accesing the database by multiple users, often at multiple
More informationPROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7
PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,
More informationIdioms and Design Patterns. Martin Skogevall IDE, Mälardalen University
Idioms and Design Patterns Martin Skogevall IDE, Mälardalen University 2005-04-07 Acronyms Object Oriented Analysis and Design (OOAD) Object Oriented Programming (OOD Software Design Patterns (SDP) Gang
More informationA few important patterns and their connections
A few important patterns and their connections Perdita Stevens School of Informatics University of Edinburgh Plan Singleton Factory method Facade and how they are connected. You should understand how to
More informationPlan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade
Plan A few important patterns and their connections Perdita Stevens School of Informatics University of Edinburgh Singleton Factory method Facade and how they are connected. You should understand how to
More information6.001 Notes: Section 6.1
6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of
More informationDevelopment and Implementation of Workshop Management System Application to Explore Combing Multiple Design Patterns
St. Cloud State University therepository at St. Cloud State Culminating Projects in Computer Science and Information Technology Department of Computer Science and Information Technology 5-2015 Development
More informationA Design Recovery View - JFace vs. SWT. Abstract
A Design Recovery View - JFace vs. SWT Technical Report 2009-564 Manar Alalfi School of computing- Queen s University Kingston, Ontario, Canada alalfi@cs.queensu.ca Abstract This paper presents an experience
More informationAn Introduction to Patterns
An Introduction to Patterns Robert B. France Colorado State University Robert B. France 1 What is a Pattern? Patterns are intended to capture the best available software development experiences in the
More informationPatterns. Giovanni Sakti. in Software Engineering. Starqle
Patterns in Software Engineering Giovanni Sakti Starqle What is Patterns? Patterns Patterns describes a problem, which occurs over and over again in our environment and then desribes the core of the solution
More informationDesign Patterns. Definition of a Design Pattern
Design Patterns Barbara Russo Definition of a Design Pattern A Pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem,
More informationCreating a Lattix Dependency Model The Process
Creating a Lattix Dependency Model The Process Whitepaper January 2005 Copyright 2005-7 Lattix, Inc. All rights reserved The Lattix Dependency Model The Lattix LDM solution employs a unique and powerful
More informationHuman Computer Interaction Lecture 08 [ Implementation Support ] Implementation support
Human Computer Interaction Lecture 08 [ Implementation Support ] Imran Ihsan Assistant Professor www.imranihsan.com aucs.imranihsan.com HCI08 - Implementation Support 1 Implementation support programming
More informationFrom Design Patterns: Elements of Reusable Object Oriented Software. Read the sections corresponding to patterns covered in the following slides.
From Design Patterns: Elements of Reusable Object Oriented Software Read the sections corresponding to patterns covered in the following slides. DESIGN PRINCIPLES Modularity Cohesion Coupling Separation
More informationSoftware Design COSC 4353/6353 D R. R A J S I N G H
Software Design COSC 4353/6353 D R. R A J S I N G H Design Patterns What are design patterns? Why design patterns? Example DP Types Toolkit, Framework, and Design Pattern A toolkit is a library of reusable
More informationPatterns for polymorphic operations
Patterns for polymorphic operations Three small object structural patterns for dealing with polymorphism Alexander A. Horoshilov hor@epsylontech.com Abstract Polymorphism is one of the main elements of
More informationClient Code - the code that uses the classes under discussion. Coupling - code in one module depends on code in another module
Basic Class Design Goal of OOP: Reduce complexity of software development by keeping details, and especially changes to details, from spreading throughout the entire program. Actually, the same goal as
More informationJava Programming Lecture 7
Java Programming Lecture 7 Alice E. Fischer Feb 16, 2015 Java Programming - L7... 1/16 Class Derivation Interfaces Examples Java Programming - L7... 2/16 Purpose of Derivation Class derivation is used
More information2 Getting Started. Getting Started (v1.8.6) 3/5/2007
2 Getting Started Java will be used in the examples in this section; however, the information applies to all supported languages for which you have installed a compiler (e.g., Ada, C, C++, Java) unless
More informationAfter a lecture on cosmology and the structure of the solar system, William James was accosted by a little old lady.
Introduction After a lecture on cosmology and the structure of the solar system, William James was accosted by a little old lady. Your theory that the sun is the centre of the solar system, and the earth
More informationCSE 401/M501 Compilers
CSE 401/M501 Compilers ASTs, Modularity, and the Visitor Pattern Hal Perkins Autumn 2018 UW CSE 401/M501 Autumn 2018 H-1 Agenda Today: AST operations: modularity and encapsulation Visitor pattern: basic
More informationCPS122 Lecture: Cohesion and Coupling. 1. To introduce cohesion and coupling as criteria for evaluating designs
CPS122 Lecture: Cohesion and Coupling Objectives: Last revised March 27, 2015 1. To introduce cohesion and coupling as criteria for evaluating designs Materials: 1. Cohesion/coupling worksheet + projectable
More informationCS112 Lecture: Exceptions. Objectives: 1. Introduce the concepts of program robustness and reliability 2. Introduce exceptions
CS112 Lecture: Exceptions Objectives: 1. Introduce the concepts of program robustness and reliability 2. Introduce exceptions Materials: 1. Online Java documentation to project 2. ExceptionDemo.java to
More information340 Review Fall Midterm 1 Review
340 Review Fall 2016 Midterm 1 Review Concepts A. UML Class Diagrams 1. Components: Class, Association (including association name), Multiplicity Constraints, General Constraints, Generalization/Specialization,
More informationCSE 70 Final Exam Fall 2009
Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15
More information