CSE 335 Homework 1
Objectives: Review fundamentals and design skills from CSE 231 and CSE 232. Specically: 1. Construction of Makeles to rebuild executables from source code. 2. Use of functional decomposition to design a complex function by inventing new
CSE 335 Fall 2009 Project 3 1 Objectives
1. Develop an application with a graphical user interface. 2. Work with the Adapter, Mediator, and Observer patterns.
In the last two projects, you designed programs to run on the command line. Such a
CSE 335 Fall 2009 Project 2 1 Objectives
1. Maintain and extend an existing class library. 2. Gain experience integrating third-party classes into your own project. 3. Exercise the Builder pattern.
In the previous assignment, you wrote a lib
CSE 335 Fall 2009 Project 1 1 Objectives
1. Develop a reusable class library. 2. Exercise the Composite pattern and the Visitor pattern.
In this assignment, you will develop a library to store an instance of the Document Object Model (DOM) i
CSE 335 Homework 7
Objectives: 1. Read and understand the code for an application that simulates concurrent control. 2. Become familiar with some of the abstractions and code that will be used in Project 3. Description: In this exercise, you are to take a
CSE 335 Homework 6
Objectives: 1. Redesign an existing collaboration to make one of the collaborators more reusable. 2. Design support classes that enable the separation of concerns in an existing class hierarchy. Description: This homework assignment inv
CSE 335 Homework 5
Objectives: 1. Continue to exercise the use of abstract classes and interfaces. 2. Design collaborations that involve stock widgets in a GUI toolkit. 3. Synthesize a composite collaboration from simpler ones. Description: The executable
CSE 335 Homework 4
Objectives: 1. Exercise use of abstract classes and interfaces. 2. Understand reasons for refactoring a set of classes in order to support various maintenance goals. Description: The les cse335/AlexLiu/HW/HW04/* comprise a small GUI app
CSE 335 Homework 3
Objectives: Implement class hierarchies using abstract classes and pure virtual functions. Description: In class, we discussed how to design a class hierarchy to implement arithmetic expression trees. For this exercise, you are to imple
CSE 335 Homework 2
Objective: Gain experience using inheritance and function over-riding. Description: Copy the les cse335/AlexLiu/HW/HW02/hw02.* into your account. These les dene a simple main() program that manipulates instances of a class Person, such
# -*- coding: utf-8 -*"
#cse231 section 730
sentence=input("Enter an english word changing into PigLatin: ").lower()
s = sentence.split(" ")
latin = "
for word in s:
if word in vowels:
latin += word + "w
#project number:Programming Project 04
#In this function, you are required to repeatedly prompt for the name
#of an input file until the user enters filename and the file can be
#opened for input. Return a f
# -*- coding: utf-8 -*#CSE231 Sec730
charList = ['R','Y','B','G','W','O']
counter = 0
guessRepeat = False
keyRepeat = False
print("Mastermind: your challenge is to guess the secret key."+"\n"+"There are
six colors with no repeats
' The basic process is this:
1) You create a Deck instance, which is filled (automatically) with 52 Card
2) You can deal those cards out of the deck into hands, each hand a list of
3) You then manipulate cards as you add/remov
(1) Add new operations without changing existing classes (which often form a
hierarchy that needs traversal).
(2) Adding new builders (e.g., textconverters) without changing the director class
(e g the parser)
(3) Making objects of two classes
* first_name : string last_name : string hire_date : Date department : short A.k.a. the is-a relation Relates class to one that is more general
Open arrow points to base class (i.e., the generalization) Derived clas
Motivation: Reasoning about a design
UML - Basic Class Modeling
Goal: Be able to reason about a design
i.e., understand designers intent Critique/improve the design
Claim: Source code not best medium for communication and comprehension
Lots of redunda
How to design the classes for line, rectangle, text, picture?
Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of obje
Designing composite collaborations
Model concrete interactions in the new collaboration using sketches
E.g., draw a sequence diagram illustrating what should happen when user drags the slider to new position In this co
Class Inheritance in C+
To prevent being included twice
#ifndef MY_HEADER #define MY_HEADER /your declarations #endif
#include <iostream> : search in include search path <iostream> search in include search path
Used for system header files
is-a cannot via private/protected
Case Study: Composite Pattern + Visitor Pattern
Will this compile?
#include <iostream> using namespace std; class A cfw_ private: int foo; public: A(int f) : foo(f) cfw_; void print() cfw_ cout < foo < endl; ; class B :
Recall: Abstract Factory Pattern
The factory only makes parts. The factory does not maintain any state information.
I dont remember which parts you have asked me to make.
But, sometimes it is desirable for the factory to remember state. T
Problem: How to reuse behavior
Suppose we want to design a GUI toolkit with widgets, such as Button, Slider, etc. Problem:
Pressing the button should cause some operation to be invoked on some other object But Button must kno