Software methodology and snake oil

Similar documents
Object-Oriented Design

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

SDC Design patterns GoF

DESIGN PATTERN - INTERVIEW QUESTIONS

Using Design Patterns in Java Application Development

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Design Patterns. An introduction

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Object Oriented Paradigm

Design patterns. Jef De Smedt Beta VZW

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

1 Software Architecture

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Object-oriented Software Design Patterns

Information systems modelling UML and service description languages

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

Object-Oriented Oriented Programming

Application Architectures, Design Patterns

be 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


administrivia today UML start design patterns Tuesday, September 28, 2010

Object-Oriented Design

Applying the Observer Design Pattern

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

The Strategy Pattern Design Principle: Design Principle: Design Principle:

What is Design Patterns?

Tuesday, October 4. Announcements

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Design Patterns. (and anti-patterns)

Applying the Decorator Design Pattern

Topics in Object-Oriented Design Patterns

CS560. Lecture: Design Patterns II Includes slides by E. Gamma et al., 1995

Design Patterns: Structural and Behavioural

1993: renamed "Java"; use in a browser instead of a microwave : Sun sues Microsoft multiple times over Java

Design Patterns. "Gang of Four"* Design Patterns. "Gang of Four" Design Patterns. Design Pattern. CS 247: Software Engineering Principles

Design Patterns. CSC207 Fall 2017

CS 247: Software Engineering Principles. Design Patterns

needs to be reliable, easy to change, retarget efficiency is secondary implemented as interpreter, with virtual machine

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Software Engineering I (02161)

CPSC 310 Software Engineering. Lecture 11. Design Patterns

SOFTWARE PATTERNS. Joseph Bonello

Review Software Engineering October, 7, Adrian Iftene

CSC207H: Software Design Lecture 6

Design Patterns. CSC207 Winter 2017

An Introduction to Patterns

Design Patterns. Gunnar Gotshalks A4-1

Design patterns. OOD Lecture 6

An Introduction to Patterns

UNIT I Introduction to Design Patterns

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

Design Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000

Requirements and Design Overview

What is Design Patterns?

Introduction to Software Engineering: Object Design I Reuse & Patterns

Facade and Adapter. Comp-303 : Programming Techniques Lecture 19. Alexandre Denault Computer Science McGill University Winter 2004

3 Product Management Anti-Patterns by Thomas Schranz

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

MVC. Model-View-Controller. Design Patterns. Certain programs reuse the same basic structure or set of ideas

The GoF Design Patterns Reference

CHAPTER 6: CREATIONAL DESIGN PATTERNS

2.1 Design Patterns and Architecture (continued)

The Software Design Process. CSCE 315 Programming Studio, Fall 2017 Tanzir Ahmed

UNIT I Introduction to Design Patterns

CS 349 / SE 382 Design Patterns. Professor Michael Terry January 21, 2009

Brief Note on Design Pattern

Applying the Factory Method Design Pattern

The Design Patterns Matrix From Analysis to Implementation

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

Design Patterns. CSC207 Fall 2017

Design Pattern and Software Architecture: IV. Design Pattern

INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM

Software Design COSC 4353/6353 D R. R A J S I N G H

Software Engineering I (02161)

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Patterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides

DESIGNING, CODING, AND DOCUMENTING

As a programmer, you know how easy it can be to get lost in the details

2.1 Design Patterns and Architecture (continued)

A Rapid Overview of UML

Software Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns

Design Patterns (DP) In the beginning. It s not a course about DP (just a little) A lot of good design and efficient implementation is based on DP

CPS122 Lecture: Design Patterns Last revised March 7, 2017

CSE 70 Final Exam Fall 2009

DESIGN PATTERNS FOR MERE MORTALS

What is Design Patterns?

Design Patterns 2. Page 1. Software Requirements and Design CITS 4401 Lecture 10. Proxy Pattern: Motivation. Proxy Pattern.

Index Shalloway rev.qrk 9/21/04 5:54 PM Page 419. Index

Summary of the course lectures

CPS122 Lecture: Design Patterns Last revised April 22, 2010

Design pa*erns. Based on slides by Glenn D. Blank

1993: renamed "Java"; use in a browser instead of a microwave : Sun sues Microsoft multiple times over Java

CSE 403: Software Engineering, Winter courses.cs.washington.edu/courses/cse403/16wi/ Design Patterns. Emina Torlak

Topics. Software Process. Agile. Requirements. Basic Design. Modular Design. Design Patterns. Testing. Quality. Refactoring.

Transcription:

Software methodology and snake oil programming is hard programs are very expensive to create full of errors hard to maintain how can we design and program better? a fruitful area for people selling "methodologies" for at least 40 years each methodology has the germ of a useful idea each claims to solve major programming problems some are promoted with religious fervor in fact most don't seem to work well or don't seem to apply to all programs or can't be taught to others a few are genuinely useful and should be in everyone's repertoire

Examples... modularity, information hiding, coupling, cohesion structured programming (programming without goto's) top-down development, successive refinement chief programmer teams, egoless programming structured X: design, analysis, requirements, specification, walkthroughs... CASE tools (Computer Aided Software Engineering) UML (Unified Modeling Language), message sequence charts, state diagrams formal methods verification, validation, correctness proofs, model checking object-oriented programming CRC cards (Class, Responsibilities, and Collaborators) object-oriented everything design, analysis, requirements, specification, walkthroughs... RAD (rapid application development) components, COTS (Components off the Shelf) 4th generation languages, automatic programming, X by example, graphical programming extreme programming, refactoring, agile methods, pair programming,... aspect oriented programming design patterns patterns of everything

Design patterns "Design patterns... describe simple and elegant solutions to specific problems in object-oriented software design." Design Patterns: Elements of Reusable Object-Oriented Software, by Gamma, Helm, Johnson, Vlissides (the "Gang of Four"), 1995 "idioms for design" or program structure successful among broad group of programmers widely used to describe software structure three basic categories: creational: making things structural: organizing things behavioral: operating things

Bridge (or "handle/body") pattern "Decouple an abstraction from its implementation so that the two can vary independently" C++ string class: separate handle from body implementation can be changed without changing abstraction of "string" class String { private: Srep *p; public:... }; class Srep { char *sp; // data int n; // ref count... }; similar examples: FILE * in C stdio, RE * in regexpr interface, connection in MySQL interface change of implementation has no effect on client can even switch implementation at run time (in C and C++) hides implementation completely C: hidden behind opaque type; C++: implementation class is invisible can share implementation among multiple objects without revealing the sharing e.g., reference counting, sharing of open files in FILE*

Adapter (or Wrapper) pattern "Convert the interface of one class into another interface that clients expect" maps one interface into another more or less at the same level e.g., in the C stdio package: fread(buf, objsize, nobj, stream) fwrite(buf, objsize, nobj, stream) are wrappers around read(fd, buf, size) write(fd, buf, size)

Decorator pattern "Attach additional responsibilities to an object dynamically" decorator conforms to interface it decorates transparent to clients forwards some requests usually does some actions of its own before or after e.g., Java Swing JScrollPane class JTextArea tpay = new JTextArea(15, 45); JScrollPane jsp = new JScrollPane(tpay, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

Decorator pattern (2) FileInputStream fin = new FileInputStream(args[0]); FileOutputStream fout = new FileOutputStream(args[1]); BufferedInputStream bin = new BufferedInputStream(fin); BufferedOutputStream bout = new BufferedOutputStream(fout); responsibility for buffering attached dynamically interface remains unchanged transparent to clients

Creational patterns Abstract Factory: "Provide an interface for creating families of related or dependent objects." (also Builder and Factory) DOM and SAX builder factories Singleton: "Ensure a class only has one instance" Java System, Runtime, Math classes Prototype: "Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype." Javascript objects

Behavorial patterns Observer: "Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically" Java ActionListener mechanism: button.addactionlistener(this) tells button to notify this container when event happens usually called by container that contains object that will get the event can have more than one listener void actionperformed(actionevent e) { } called when event occurs determines type or instance that caused event handles it

Behavorial patterns (2) Iterator: "Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation" the basis of algorithms in C++ STL Map hs = new TreeMap(); for (Iterator it : hs.keyset()) { String n = (String) it.next(); Integer v = (Integer) hs.get(n);... Visitor: "Represent an operation to be performed on the elements of an object structure" almost any tree walk that does some evaluation at each node draw() where one kind of "Shape" is an entire picture made of Shapes Memento: "Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later" Java serialization, JSON,...

Behavioral patterns (3) Interpreter: "Given a language, define a representation for its grammar along with an interpreter that uses the presentation to interpret sentences in the language" regular expression processors eval( ) or execute( ) in many languages printf format strings? domain-specific / application-oriented languages JSON, XML, HTML, CSS, etc. Makefiles find command Shell, Awk,... AMPL, R,... TEX et al

Summary design patterns: a useful idea a way to think about, organize, talk about programming likely to still be around in 10 years worth knowing the idea worth recognizing some of the common ones will help you to look alert in an interview methodologies more broadly: usually a germ of a good idea enthusiasm, initial success in a small sample leads to unwarranted generalization thus oversold or hyped healthy skepticism is warranted