Week 5, Day 2: Decorator Decorators Muddiest Point Tomorrow: Quiz on lab reading: https://faculty- web.msoe.edu/hasker/se2811/labs/5/ SE-2811 Slide design:

Slides:



Advertisements
Similar presentations
SE2811 Week 8 Monday (last drop day) The Command Pattern Lambda Expressions SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr.
Advertisements

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.
CS2852 Week 8, Class 2 Today Tree terminology Non-Binary and Non-Search Trees Tree Traversals (Remaining slides not yet shown) Tomorrow: Quiz Implementing.
Week 5, Day 3: Observer Today Reducing coupling with the Observer The Observer pattern in Java APIs Posting events to a UI worker thread SE-2811 Slide.
SE-1021 Software Engineering II Week 5, Class SE-2811 Dr. Josiah Yoder Slide style: Dr. Hornick 1.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
SE2811 Week 7, Class 1 Composite Pattern Applications Conceptual form Class structure Coding Example Lab Thursday: Quiz SE-2811 Slide design: Dr. Mark.
Course Overview & Topics CSc 335: Object-Oriented Programming and Design © Rick Mercer 1.
SE-1021 Software Engineering II Week 8, Class 1 Return Exam Producing UML diagrams automatically in EA Poll Everywhere Files Tomorrow Week 6 HW due (if.
1-1 C Sc 335 Course Overview Object-Oriented Programming and Design Rick Mercer.
SE-1021 Software Engineering II Week 5, Class 2 Why my computer crashed Layouts Multiple action listeners Single actionPerformed method – distinguishing.
Week 2, Day 2: The Factory Method Pattern Other good design principles Cohesion vs. Coupling Implementing the Strategy Pattern Changing strategies (behaviors)
The Strategy Pattern SE-2811 Dr. Mark L. Hornick 1 Class 1-2.
Week 6, Class 1 & 2: Decorators Return Exam Questions about lab due tomorrow in class? Threads Locking on null object invokeLater & the squares example.
CS2910 Week 1, Class 2 Today Announce Prof. Michael Vieau’s S-341 6p Thurs Wk 2 Assignment for tomorrow Data Encoding, Part 1 Parsing Data Muddiest Point.
SE-2811 Software Component Design Week 1, Day 2 (and 1-3 and 2-1) SE-2811 Dr. Josiah Yoder Slide style: Dr. Hornick 1.
CS2852 Week 3, Class 2 Today Stacks Queues SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
The Strategy Pattern SE-2811 Dr. Mark L. Hornick 1.
SE1011 Week 6, Class 1 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) Muddiest Point Next Half Exam: Week 7, Monday SE-1011 Slide.
SE1011 Week 6, Class 2 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) UML class diagrams Muddiest Point Next Half Exam: Week 7, Monday.
CS2852 Week 6, Class 1 Today The run-time stack Writing and proving recursive methods SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 5, Class 2 Today Queue Applications Circular Queue Implementation Testing SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
SE1011 Week 6, Class 2 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) UML class diagrams Muddiest Point Next Half Exam: Week 7, Monday.
CS2852 Week 7, Class 1 Today Binary Search Tree Implementing add Implementing find Return Quiz 4 (second attempt) Both sections are graded SE-2811 Slide.
Week 3, Day 3: Singleton Pattern Quiz Status Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick.
Week 7, Day 3 Half-Exam 2 A New Pattern SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
CS2852 Week 6, Class 2 Today Class exercise: Implementing a recursive method Binary Search Trees Tomorrow: Quiz at start of lab Implementing a recursive.
SE-1021 Software Engineering II Week 9, Class 1 ByteBuffer Tomorrow Get quizzes back from last week… Wednesday Quiz at start of lab 1.
Week 5, Day 3: Decorator Decorators Muddiest Point Tomorrow: Quiz on lab reading: web.msoe.edu/hasker/se2811/labs/5/ SE-2811 Slide design:
CS2852 Week 3, Class 2 Today Big-O runtime analysis Linked Lists Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See next slide)
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.
Week 7, Class 1: The Command Pattern (cont.) Get Ready for Poll Everywhere Labs 2 & 3 returned Lab 7 due this evening at 11pm Quiz tomorrow at start of.
Slide design: Dr. Mark L. Hornick
Week 3, Day 2: Patterns Review & New Pattern Return Quiz 1 (I have it with me) Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr.
Week 10, Day 3 Review for the quarter SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
CS2910 Week 7, Class 1 Today Capturing SMTP with Thunderbird Tomorrow Extra office hour at 11 am (right after lab) Friday Office hour cancelled SE-2811.
Week 6, Class 3: Composite Swing composites File composites Computer composites SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
Week 4, Day 1: Singleton(s?) Singleton leftover Why singletons? How to make lazy initialization work multi- threaded? Observers Why observers? Class structure.
Week 5, Class 3: Decorators Lab questions? Example: Starbuzz coffee Basic Pattern More examples Design Principles Compare with alternatives SE-2811 Slide.
SE2811 Week 8 – Class 2 Re: Lab due tonight SE-2811 Slide design: Dr. Mark L. Hornick Much Content: Dr. Hornick Most Errors: Dr. Yoder 1.
The Decorator Pattern Decorators in Java I/O classes SE-2811 Dr. Mark L. Hornick 1.
CS 210 Introduction to Design Patterns September 14 th, 2006.
CS-2852 Data Structures Week 5, Class 3 – Testing and Recursion Queue Implementing finite queues Binary Search Recursion Tomorrow – Quiz, Lab demos, Lab.
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Slide style: Dr. Hornick
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Week 2, Day 1: The Factory Method Pattern
SE-2811 Software Component Design
SE-2811 Software Component Design
SE-1021 Software Engineering II
OO Design Patterns - Decorator
Week 7, Class 1: The Command Pattern (cont.)
SE-2811 Software Component Design
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
Polling vs. Interrupts CS2852 4/21/2019
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Week 8, Class 3: Model-View-Controller
SE-1021 Software Engineering II
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
SE-1021 Software Engineering II
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1021 Software Engineering II
Slide design: Dr. Mark L. Hornick
SE-1021 Software Engineering II
Presentation transcript:

Week 5, Day 2: Decorator Decorators Muddiest Point Tomorrow: Quiz on lab reading: web.msoe.edu/hasker/se2811/labs/5/ SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1

Coffee Inheritance Model Design Review Any potential changes? Keep current design? SE-2811 Dr. Mark L. Hornick 2

Time for Coffee 2.0 Want to be able to add, Whip, Mocha, DarkRoast, etc. to our coffee Exercise: With your team, create a design to include these “decorators” and have the cost function return their cost SE-2811 Dr. Mark L. Hornick 3

One approach: Inheritance SE-2811 Dr. Mark L. Hornick 4

Cleaned up with decorator pattern SE-2811 Dr. Mark L. Hornick 5

Cost of DarkRoast with Whip and Mocha SE-2811 Dr. Mark L. Hornick 6 Whip Mocha DarkRoast cost() $1.29

General Pattern SE-2811 Dr. Mark L. Hornick Wikipedia 7

Example 2: Byte Input Streams SE-2811 Dr. Mark L. Hornick 8

Ex 3: Bikes SE-2811 Dr. Mark L. Hornick 9

Ex 4: Employees SE-2811 Dr. Mark L. Hornick 10

Design Principles Reduce coupling Increase cohesion Encapsulate what varies Favor composition over inheritance Program to interfaces, not implementations Classes should be open for extension but closed for modification Which of these are met? SE-2811 Dr. Mark L. Hornick 11

Downsides What are the disadvantages of decorators? SE-2811 Dr. Mark L. Hornick 12

SE-2811 Dr. Mark L. Hornick 13

Knowing that the input stream classes are based on the Decorator pattern can make things easier SE-2811 Dr. Mark L. Hornick 14 >

The Decorator pattern applied to output streams SE-2811 Dr. Mark L. Hornick 15 (with other Variables…)

Threading Muddiest Point [To be revisited in a future lecture] All lambda examples the same code? Lambda examples When would you use a Lambda expression over an anonymous class and vice versa? Lambda vs. Anon inner syntax The Lambda is a Java thing, not an intelliJ thing right?Java 8 whens the next quiz?Quiz Agree Lambda examples More examples of using lambdas (didn't get exposure in software dev 2) Lambda examples Effectively Final? "Effectively Final" SE-2811 Dr. Mark L. Hornick 16

Patterns Muddiest Point [To be revisited in a future leture] We really didn't cover any sorting algorithms and what each's benefits are Can we do an example??? Related to the quiz for below question Do we need to implement code versions of the strategy and factory method patterns?? If so how extensive and will it be similar to how we implemented in class? Implementing the methods needed for the factory method pattern. Is there a flowchart/checklist to determine which pattern is more appropriate to use? Choosing the correct design pattern What are Coupling and Cohesion and is it better to have high or low coupling or cohesion? On a quiz/test would you ask us to draw the uml of a particular general pattern, or would you just ask us to write the code? Why would we use Factory Pattern? How do you know when to use what pattern to solve a problem? Diagrams High/Low Cohesion/Coupling Class Diagram for Factory Design Pattern Nothing 17