CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 Before studying design patterns, many programmers solve a problem by starting.

Slides:



Advertisements
Similar presentations
CS 350 – Software Design The Bridge Pattern – Chapter 10 Most powerful pattern so far. Gang of Four Definition: Decouple an abstraction from its implementation.
Advertisements

The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
CHAPTER 10 Recursion. 2 Recursive Thinking Recursion is a programming technique in which a method can call itself to solve a problem A recursive definition.
C++ fundamentals.
Adding and Subtracting Integers.
Previously, we learned that adding two numbers together which have the same absolute value but are opposite in sign results in a value of zero. This can.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Multiplying Integers.
CS 350 – Software Design Abstract Factory Pattern – Chapter 11 Provides an interface for creating families of related or dependent objects without specifying.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
CS 350 – Software Design The Object Paradigm – Chapter 1 If you were tasked to write code to access a description of shapes that were stored in a database.
CS 350 – Software Design The Strategy Pattern – Chapter 9 Changes to software, like other things in life, often focus on the immediate concerns and ignore.
CS 350 – Software Design The Observer Pattern – Chapter 18 Let’s expand the case study to include new features: Sending a welcome letter to new customers.
Cohesion and Coupling CS 4311
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
3.7 Implicit Differentiation Objective: SWBAT find derivatives using implicit differentiation.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
CS 350 – Software Design Expanding Our Horizons – Chapter 8 The traditional view of objects is that they are data with methods. Sometimes objects could.
CS 350 – Software Design A Problem That Cries Out for Flexible Code – Chapter 3 Imagine you want to extract information from a CAD system to feed an expert.
Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Adding two numbers together which have the same absolute value but are opposite in sign results in a value of zero. This same principle can be applied.
Chapter Review Beat the Clock! 6k + 2 = 26 Distribute Moving equal sign Simplify Solve.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
CS 350 – Software Design The Facade Pattern – Chapter 6 Many design patterns are catalogued in the “Gang of Four” text. I find their definitions not to.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
GROUP MEMBERS AYAZ JAVED BITF06A002 SADAF SARFARAZ BITF06A003 SAMIN ATIQA BITF06A028 BILAL KHALID BITF06A042.
Reliability of Disk Systems. Reliability So far, we looked at ways to improve the performance of disk systems. Next, we will look at ways to improve the.
Coupling and Cohesion Schach, S, R. Object-Oriented and Classical Software Engineering. McGraw-Hill, 2002.
Year 9 Mathematics Algebra and Sequences
Multiplying and Dividing Integers
CSC317 Selection problem q p r Randomized‐Select(A,p,r,i)
Adding and Subtracting Integers (Positive and Negative Numbers)
Inheritance Based on slides by Ethan Apter
KS4 Mathematics A2 Linear equations.
CS 350 – Software Design The Strategy Pattern – Chapter 9
Adding Integers We are going to predict patterns and make rules based on what we notice. Then, we are going to simplify variable expressions.
Functions & Graphing.
Lesson 1-8 Properties of Real Numbers
Using Distributive Property
Lesson : Adding Integers Using Rules
CS 350 – Software Design The Facade Pattern – Chapter 6
PROGRAMME 4 DETERMINANTS.
Happy Monday!!! (Groundhog Day)
Introduction to Equations Cronnelly
Factoring Polynomials SUM AND PRODUCT
Multiplication and integers
Solving Equations with the Variable on Both Sides
Ch 6 Complex Numbers.
Lesson 16: Functions with Return Values
PROGRAMME 4 DETERMINANTS.
vms x Year 8 Mathematics Equations
EEL 3705 / 3705L Digital Logic Design
Introduction Solving inequalities is similar to solving equations. To find the solution to an inequality, use methods similar to those used in solving.
PASCAL’S TRIANGLE.
CS 350 – Software Design Principles and Strategies – Chapter 14
Adding and Subtracting Integers.
Subscript and Summation Notation
Isolating variation is a design philosophy.
Design Facts.
KS4 Mathematics A2 Linear equations.
LONG MULTIPLICATION is just multiplying two numbers.
- When you approach operating system concepts there might be several confusing terms that may look similar but in fact refer to different concepts:  multiprogramming, multiprocessing, multitasking,
Chapter 6 Orthographic Reading.
Review of Previous Lesson
Guest Lecturer: Justin Hsia
Software Engineering and Architecture
Subtracting integers without number line 3 digit.
Adding integers without number line 2 digit.
Object Oriented System Design Responsibilities
Presentation transcript:

CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 Before studying design patterns, many programmers solve a problem by starting with a general solution and refine it until you are ready to code (OK or you do not design at all) Specialization is often the intuitive answer. So to solve the problem. Think about each feature. For example, a Slot has two implementations. One for each CAD system. Therefore: A SlotFeature class could be implemented and you could have two derivations, one for each version of CAD.

CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 This is a simple and very straightforward solution. Indeed, it’s not even difficult to code. See how the simple idea is expanded to the other features:

CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 The previous solution was simplified. In reality, V1’s objects would need to access the V1CAD system and its associated functions. Meanwhile, V2’s objects would need to access their corresponding object in the V2CAD system. This is shown below:

CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 Look at the following code: Chapter4Code.txt Note the author doesn’t worry about polymorphism. This is because the expert system treats each feature as a specific type. It needs to know what type it is, because different types have different data. What he is trying to do here is handle the multiple CAD versions. However, his system is not good, because: Redundancy Among Methods: Many methods calling V1 are similar. i.e. V1GetX for a Slot is similar to V1getX for a Hole. Messy: When things are not clean, it’s usually a sign that your design is not ideal. Tight Coupling: features are indirectly linked. If a new cad system is added or an old one modified, then all the features need to be modified. This is bad. Weak Cohesion: Methods to perform core functions are scattered amongst classes.

CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 Let’s look to the future. What happens if we add a third CAD system? A combinatorial explosion! Look what we have now: There are 5 types of features Each type of feature has a pair of classes, one for each CAD system What happens if we add a 3rd system? We still have 5 types of features Now each type of feature has a three of classes, one for each CAD system In addition, if we add a feature we have to add as many classes as we have CAD systems. This is an n x m explosion. Not good!