TDDB84 Design Patterns Lecture 09. Interpreter, Facade

Size: px
Start display at page:

Download "TDDB84 Design Patterns Lecture 09. Interpreter, Facade"

Transcription

1 Lecture 09 Interpreter, Facade Peter Bunus Dept of Computer and Information Science Linköping University, Sweden Interpreter Peter Bunus 2 1

2 The Interpreter Non Software Example Musical Notation (Abstract Expression) Notes (Terminal Expression) Signatures # The Interpreter pattern defines a grammatical representation for a language and an interpreter to interpret the grammar. Musicians are examples of Interpreters. The pitch of a sound and its duration can be represented in musical notation on a staff Musicians playing the music from the score are able to reproduce the original pitch and duration of each sound represented Peter Bunus 3 The Interpreter Use the Interpreter to build and interpreter for a language Define a language grammar Each grammar rule is represented by a class Represent sentences Sentences within language can be represented by abstract syntax trees of instances of these classes Peter Bunus 4 2

3 The Interpreter How it Works We need to implement an educational tool for children to learn programming. Using our tool, each child gets to control Ugly Duckly with the help of a simple language. Here is a example of the language: right; while (daylight) fly; quack; Peter Bunus 5 The Ugly Dukly Language right; while (daylight) fly; quack; expression ::= <command> <sequence> <repetition> sequence ::= <expression> ; <expression> command ::= right quack fly repetition := while ( <variable> ) <expression> variable :=[A-Z,a-z]; We got the grammar, now all we need is a way to represent and interpret sentences in the grammar Peter Bunus 6 3

4 The Ugly Dukly Language Classes We define a class based representation for the grammar along with an interpreter to interpret the sentences expression ::= <command> <sequence> <repetition> sequence ::= <expression> ; <expression> command ::= right quack fly vepetition := while ( <variable> ) <expression> variable :=[A-Z,a-z]; Peter Bunus 7 Interpreter UML Builds abstract syntax tree representing a particular sentence in the language and invokes the interpret operation. Context Contains information that s global to the interpreter Declares an abstract Interpret operation that is common to all nodes in the abstract syntax tree. Client AbstractExpression Interpret(Context) TerminalExpression Interpret(Context) NonterminalExpression Interpret(Context) Implements an Interpret operation associated with terminal symbols in the grammar. Implements an Interpret operation for nonterminal symbols in the grammar. Peter Bunus 8 4

5 Interpreter Looks familiar? Context Client AbstractExpression Interpret(Context) TerminalExpression Interpret(Context) NonterminalExpression Interpret(Context) Peter Bunus 9 Composite (Structural Pattern) Client Component Operation() Leaf Operation() Composite Operation() Peter Bunus 10 5

6 Interpretor Advantages and Disadvantages Representing each grammar rule in a class makes the language easy to implement Because the grammar is represented by classes, you can easily change or extend the language By adding additional methods to the class structure, you can add new behaviors beyond interpretation (pretty printing) Use for scripting and programming languages Use Interpreter when you need to implement a simple language Appropriate when you have a simple grammar and simplicity is more important than efficiency It can become cumbersome when the number of grammar rule is large. In this cases a parser/compiler generator may be more appropriate. Peter Bunus 11 Facade Peter Bunus 12 6

7 Facade Non Software Example Peter Bunus 13 Joe installs a Home Theater Peter Bunus 14 7

8 Joe s Home Theater Amplifier -tuner -dvdplayer -cdplayer +on() +off() +setcd() +setdvd() +setstereosound() +setsurroundsound() +settuner() +setvolume() Tuner -amplifier +on() +off() +setam() +setfm() +setfrequency() Screen +up() +down() PoppcornPopper +on() +off() +pop() CDPlayer -amplifier +on() +off() +eject() +pause() +play() +stop() TheaterLights +on() +off() +dim() DvdPlayer -amplifier +on() +off() +eject() +pause() +play() +setsurroundaudio() +settwochannelaudio() +stop() Projector -dvdplayer +on() +off() +tvmode() +widescreenmode() Peter Bunus 15 Watching a movie Call the Waitress Turn on the popcorn popper Start the popper popping Dim the lights Put the screen down Turn the projector on Set the projector input to DVD Put the projector on wide-screen mode Turn the sound amplifier on Set the amplifier to DVD input Set the amplifier to surround sound Set the amplifier volume to medium Turn the DVD player on Start the DVD player playing Peter Bunus 16 8

9 Watching a movie The Java Way popper.on(); popper.pop(); lights.dim(10); screen.down(); projector.on(); projector.setinput(); projector.widescreenmode(); amp.on(); amp.setdvd(dvd); amp.setsurroundsound(); amp.setvolume(); dvd.on(); dvd.play(movie); When the movie is over how do you turn everything off? If Joe decides to upgrade the system he will probably going to learn a slightly different procedure? What is the procedure when you only want to listen to the Radio or a CD. Peter Bunus 17 Time for Facade HomeTheaterFacade +watchmovie() +endmovie() +listentocd() +endcd() +listentoradio() +endradio() watchmovie() Peter Bunus 18 9

10 The Home Theater Facade public class HomeTheaterFacade { Amplifier amp; Tuner tuner; DvdPlayer dvd; CdPlayer cd; Projector projector; TheaterLights lights; Screen screen; PopcornPopper popper; public HomeTheaterFacade(Amplifier amp, Tuner tuner, DvdPlayer dvd, CdPlayer cd, Projector projector, Screen screen, TheaterLights lights, PopcornPopper popper){ this.amp = amp; this.tuner = tuner; this.dvd = dvd; this.cd = cd; this.projector = projector; this.screen = screen; this.lights = lights; this.popper = popper; Peter Bunus 19 The Home Theater Facade public void watchmovie(string movie) { System.out.println("Get ready to watch a movie..."); popper.on(); popper.pop(); lights.dim(10); screen.down(); projector.on(); projector.widescreenmode(); amp.on(); amp.setdvd(dvd); amp.setsurroundsound(); amp.setvolume(5); dvd.on(); dvd.play(movie); public void endmovie() { System.out.println("Shutting movie theater down..."); popper.off(); lights.on(); screen.up(); projector.off(); amp.off(); dvd.stop(); dvd.eject(); dvd.off(); Peter Bunus 20 10

11 Time to Watch a Movie public class HomeTheaterTestDrive { public static void main(string[] args) { Amplifier amp = new Amplifier("Top-O-Line Amplifier"); Tuner tuner = new Tuner("Top-O-Line AM/FM Tuner", amp); DvdPlayer dvd = new DvdPlayer("Top-O-Line DVD Player", amp); CdPlayer cd = new CdPlayer("Top-O-Line CD Player", amp); Projector projector = new Projector("Top-O-Line Projector", dvd); TheaterLights lights = new TheaterLights("Theater Ceiling Lights"); Screen screen = new Screen("Theater Screen"); PopcornPopper popper = new PopcornPopper("Popcorn Popper"); HomeTheaterFacade hometheater = new HomeTheaterFacade(amp, tuner, dvd, cd, projector, screen, lights, popper); hometheater.watchmovie("raiders of the Lost Ark"); hometheater.endmovie(); Peter Bunus 21 The Facade Pattern The Facade Pattern provides an unified interface to set of interfaces in a subystem. Facade defines a higher level interface that make the subsytem easier to use Peter Bunus 22 11

12 Design Principle Talk only to your immediate friends Peter Bunus 23 Principle of Least Knowledge What does it mean? When you designing a system, be careful on the number of classes it interacts with and how it comes to interact with thse classes When you build a lot of dependencies between many classes you are building a fragile system: changes in one part cascade in other part What I should do? It s easy. Invoke only methods that belong to: The object itself Objects passed in as parameters to the method Any object the method creates or instantiates Any components of the object Peter Bunus 24 12

13 Without The Principle Tone, What is the outside temperature now? Well Joe, I can give a thermometer and you can measure the temperature yourself? public float gettemperature(){ Thermometer thermometer = tone.getthermometer(); return thermometer.gettemperature(); Peter Bunus 25 Using The Principle of Least Knowledge Tone, What is the outside temperature now? It is 32 degrees Celsius? When we apply the principle, we add a method to Tone that makes the request to the thermometer for Joe. This reduces the number of classes Joe is dependent on public float gettemperature(){ return = tone.gettemperature(); Peter Bunus 26 13

14 Using The Principle of Least Knowledge public class Car{ Engine engine; // other instance variables public Car(){ // initialize engine, etc public void start(key key) { Doors doors = new Doors(); boolean authorized = key.turns(); if (authorized){ engine.start(); updatedashboearddisplay(); doors.lock(); public void updatedashboarddisplay(){ // update display Here s a component of this class. We can call its methods Here we are creating a new object, it s methods are legal You can call a method on an object passed as a parameter You can call a method on a component of the object You can call a local method within the object You can call a method on an object you create or instantiate Peter Bunus 27 The Constitution of Software Architects Encapsulate what varies. Program to an interface not to an implementation. Favor Composition over Inheritance. Classes should be open extension but closed for modification Don t call us, we ll call you A Class should have only one reason to change Depend upon abstractions. Do not depend upon concrete classes. Strive for loosely coupled designs between objects that interact Only talk to your friends Peter Bunus 28 14

15 Facade Compiler example Peter Bunus 29 Mediator versus Facade Façade Façade abstracts a subsystem of objects to provide a convenient interface. Unidirectional. Enables cooperative behaviour, that colleagues don t or can t provide. Multidirectional. Façade objects make requests of the subsystem, but not viceversa. Mediator Peter Bunus 30 15

07. ADAPTER AND FACADE PATTERNS. Being Adaptive

07. ADAPTER AND FACADE PATTERNS. Being Adaptive BIM492 DESIGN PATTERNS 07. ADAPTER AND FACADE PATTERNS Being Adaptive Adapters all around us Have you ever needed to use a US-made laptop in a European country?? Can you think different kinds of power

More information

Lecture 21: Design Patterns (Part 3)

Lecture 21: Design Patterns (Part 3) 1 Lecture 21: Design Patterns (Part 3) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2005 2 Credit where Credit is Due Some of the material for this lecture is taken

More information

Design Patterns (Part 2) CSCE Lecture 18-10/25/2016 (Partially adapted from Head First Design Patterns by Freeman, Bates, Sierra, and Robson)

Design Patterns (Part 2) CSCE Lecture 18-10/25/2016 (Partially adapted from Head First Design Patterns by Freeman, Bates, Sierra, and Robson) Design Patterns (Part 2) CSCE 740 - Lecture 18-10/25/2016 (Partially adapted from Head First Design Patterns by Freeman, Bates, Sierra, and Robson) Objectives for Today The point of OO: Separate what changes

More information

Structural Design Patterns. CSE260, Computer Science B: Honors Stony Brook University

Structural Design Patterns. CSE260, Computer Science B: Honors Stony Brook University Structural Design Patterns CSE260, Computer Science B: Honors Stony Brook University http://www.cs.stonybrook.edu/~cse260 Structural Design Patterns Design patterns that ease the design by identifying

More information

FACADE & ADAPTER CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 7 09/13/2011

FACADE & ADAPTER CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 7 09/13/2011 FACADE & ADAPTER CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 7 09/13/2011 1 Goals of the Lecture Introduce two design patterns Facade Adapter Compare and contrast the two patterns 2 Facade

More information

CS342: Software Design. Oct 9, 2017

CS342: Software Design. Oct 9, 2017 CS342: Software Design Oct 9, 2017 Outline Facade pattern Observer pattern Homework 1 classes Human player replaces a card 1. Main UserPlayer 2. Main ->CardPile 3. CardPile -> Card -> Main 4. Main

More information

Interpreter Pattern Behavioural!

Interpreter Pattern Behavioural! Interpreter Pattern Behavioural! Intent"» Given a language, define a representation for tis grammar along with an interpreter that uses the representation to interpret sentences in the language! Interpreter-1

More information

Interpreter Pattern Behavioural

Interpreter Pattern Behavioural Interpreter Pattern Behavioural Intent» Given a language, define a representation for tis grammar along with an interpreter that uses the representation to interpret sentences in the language Interpreter-1

More information

BFH/HTA Biel/DUE/Course 355/ Software Engineering 2

BFH/HTA Biel/DUE/Course 355/ Software Engineering 2 Interpreter [GoF] Intent Given a language, define a representation of its grammar along with an interpreter that uses the representation to interpret sentences in the language. Motivation Many problems

More information

TDDB84 Design Patterns Lecture 06

TDDB84 Design Patterns Lecture 06 Lecture 06 Mediator, Adapter, Bridge Peter Bunus Dept of Computer and Information Science Linköping University, Sweden petbu@ida.liu.se The Mediator Peter Bunus 2 1 Peter Bunus 3 The Mediator Non Software

More information

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

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011 Design Patterns Lecture 2 Manuel Mastrofini Systems Engineering and Web Services University of Rome Tor Vergata June 2011 Structural patterns Part 2 Decorator Intent: It attaches additional responsibilities

More information

CS342: Software Design. November 21, 2017

CS342: Software Design. November 21, 2017 CS342: Software Design November 21, 2017 Runnable interface: create threading object Thread is a flow of control within a program Thread vs. process All execution in Java is associated with a Thread object.

More information

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

The Strategy Pattern Design Principle: Design Principle: Design Principle: Strategy Pattern The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Design

More information

TDDB84 Design Patterns Lecture 05. Builder, Singleton, Proxy. pelab

TDDB84 Design Patterns Lecture 05. Builder, Singleton, Proxy. pelab Lecture 05 Builder, Singleton, Proxy Peter Bunus Dept of Computer and Information Science Linköping University, Sweden petbu@ida.liu.se The Constitution of Software Architects Encapsulate what varies.

More information

The Adapter Pattern. Interface with anything!

The Adapter Pattern. Interface with anything! The Adapter Pattern Interface with anything! Adapter in a Nutshell - An adapter takes an object with one interface, and changes the interface to make it look like something it s not. - Allows two objects

More information

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

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and

More information

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

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) Design Pattern CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) A. Design Pattern Design patterns represent the best practices used by experienced

More information

Information systems modelling UML and service description languages

Information systems modelling UML and service description languages Internet Engineering Tomasz Babczyński, Zofia Kruczkiewicz Tomasz Kubik Information systems modelling UML and service description languages Overview of design patterns for supporting information systems

More information

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive

More information

Controls Structure for Repetition

Controls Structure for Repetition Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power

More information

Interpreter Pattern Tutorial Written Date : October 14, 2009

Interpreter Pattern Tutorial Written Date : October 14, 2009 Written Date : October 14, 2009 This tutorial is aimed to guide the definition and application of Gang of Four (GoF) interpreter design pattern. By reading this tutorial, you will know how to develop a

More information

TDDB84 Design Patterns Lecture 09. State, Prototype, Visitor, Flyweight

TDDB84 Design Patterns Lecture 09. State, Prototype, Visitor, Flyweight TDDB84 Design Patterns Lecture 09 State, Prototype, Visitor, Flyweight Peter Bunus Department of Computer and Information Science Linköping University, Sweden peter.bunus@liu.se TDDB84 Design Patterns

More information

JAVA MOCK TEST JAVA MOCK TEST II

JAVA MOCK TEST JAVA MOCK TEST II http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your

More information

Applying the Observer Design Pattern

Applying the Observer Design Pattern Applying the Observer Design Pattern Trenton Computer Festival Professional Seminars Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S. in Computer Science Rutgers

More information

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester 2005 1 Design Pattern Space Creational patterns Deal with initializing and configuring

More information

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

As a programmer, you know how easy it can be to get lost in the details Chapter 1 Congratulations, Your Problem Has Already Been Solved In This Chapter Introducing design patterns Knowing how design patterns can help Extending object-oriented programming Taking a look at some

More information

Preview from Notesale.co.uk Page 3 of 36

Preview from Notesale.co.uk Page 3 of 36 all people who know the language. Similarly, programming languages also have a vocabulary, which is referred to as the set of keywords of that language, and a grammar, which is referred to as the syntax.

More information

TDDB84: Lecture 6. Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command. fredag 4 oktober 13

TDDB84: Lecture 6. Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command. fredag 4 oktober 13 TDDB84: Lecture 6 Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command Creational Abstract Factory Singleton Builder Structural Composite Proxy Bridge Adapter Template method Behavioral

More information

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico Modellistica Medica Maria Grazia Pia INFN Genova Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico 2002-2003 Lezione 9 OO modeling Design Patterns Structural Patterns Behavioural Patterns

More information

1. Write two major differences between Object-oriented programming and procedural programming?

1. Write two major differences between Object-oriented programming and procedural programming? 1. Write two major differences between Object-oriented programming and procedural programming? A procedural program is written as a list of instructions, telling the computer, step-by-step, what to do:

More information

Design Process Overview. At Each Level of Abstraction. Design Phases. Design Phases James M. Bieman

Design Process Overview. At Each Level of Abstraction. Design Phases. Design Phases James M. Bieman CS314, Colorado State University Software Engineering Notes 4: Principles of Design and Architecture for OO Software Focus: Determining the Overall Structure of a Software System Describes the process

More information

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

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and

More information

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

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar Design Patterns MSc in Communications Software Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

BEHAVIORAL DESIGN PATTERNS

BEHAVIORAL DESIGN PATTERNS BEHAVIORAL DESIGN PATTERNS BEHAVIORAL DESIGN PATTERNS Identifies common communication patterns between objects that realize these patterns Describes the objects and classes interact and divide responsibilities

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information

Object- Oriented Design with UML and Java Part I: Fundamentals

Object- Oriented Design with UML and Java Part I: Fundamentals Object- Oriented Design with UML and Java Part I: Fundamentals University of Colorado 1999-2002 CSCI-4448 - Object-Oriented Programming and Design These notes as free PDF files: http://www.softwarefederation.com/cs4448.html

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Chapter 1 Objectives Overview of computer hardware and software, programs and compilers the Java programming language Example program Hardware and Software Computer systems

More information

Topics in Object-Oriented Design Patterns

Topics 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 information

Superclasses / subclasses Inheritance in Java Overriding methods Abstract classes and methods Final classes and methods

Superclasses / subclasses Inheritance in Java Overriding methods Abstract classes and methods Final classes and methods Lecture 12 Summary Inheritance Superclasses / subclasses Inheritance in Java Overriding methods Abstract classes and methods Final classes and methods Multiplicity 1 By the end of this lecture, you will

More information

Little Language [Grand]

Little Language [Grand] Little Language [Grand] Intent Given the grammar of a simple language, provide a parser. Motivation Many problems can be expressed using small grammars. Applications then must provide a parser that, for

More information

Inheritance and Polymorphism

Inheritance and Polymorphism Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg

More information

TDDB84: Lecture 7. State, Visitor, Interpreter, DSL. fredag 4 oktober 13

TDDB84: Lecture 7. State, Visitor, Interpreter, DSL. fredag 4 oktober 13 TDDB84: Lecture 7 State, Visitor, Interpreter, DSL Creational Prototype SOLID Structural Facade Flyweight Behavioral State Visitor Interpreter Summary The exam LE7 LE8 LE9 Several different patterns GUI

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Chapter 1 Objectives Overview of computer hardware and software, programs and compilers Introduce program design and objectoriented programming Overview of the Java programming

More information

SDC Design patterns GoF

SDC Design patterns GoF SDC Design patterns GoF Design Patterns The design pattern concept can be viewed as an abstraction of imitating useful parts of other software products. The design pattern is a description of communicating

More information

Semantic Analysis. Lecture 9. February 7, 2018

Semantic Analysis. Lecture 9. February 7, 2018 Semantic Analysis Lecture 9 February 7, 2018 Midterm 1 Compiler Stages 12 / 14 COOL Programming 10 / 12 Regular Languages 26 / 30 Context-free Languages 17 / 21 Parsing 20 / 23 Extra Credit 4 / 6 Average

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Adding content to your Blackboard 9.1 class

Adding content to your Blackboard 9.1 class Adding content to your Blackboard 9.1 class There are quite a few options listed when you click the Build Content button in your class, but you ll probably only use a couple of them most of the time. Note

More information

How to make a "hello world" program in Java with Eclipse *

How to make a hello world program in Java with Eclipse * OpenStax-CNX module: m43473 1 How to make a "hello world" program in Java with Eclipse * Hannes Hirzel Based on How to make a "hello world" program in Java. by Rodrigo Rodriguez This work is produced by

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm Ming-Hwa Wang, Ph.D. Department of Computer Engineering Santa Clara University Object Oriented Paradigm/Programming (OOP) similar to Lego, which kids build new toys from assembling

More information

Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently.

Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. Project 1 Computer Science 2334 Spring 2016 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple movie data system. Milestones: 1. Use

More information

Rules and syntax for inheritance. The boring stuff

Rules and syntax for inheritance. The boring stuff Rules and syntax for inheritance The boring stuff The compiler adds a call to super() Unless you explicitly call the constructor of the superclass, using super(), the compiler will add such a call for

More information

Object-Oriented Oriented Programming

Object-Oriented Oriented Programming Object-Oriented Oriented Programming Composite Pattern CSIE Department, NTUT Woei-Kae Chen Catalog of Design patterns Creational patterns Abstract Factory, Builder, Factory Method, Prototype, Singleton

More information

Define an object that encapsulates how a set of objects interact.

Define an object that encapsulates how a set of objects interact. MEDIATOR Presented By: Mallampati Bhava Chaitanya Intent Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable? Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration

More information

Design patterns. Jef De Smedt Beta VZW

Design patterns. Jef De Smedt Beta VZW Design patterns Jef De Smedt Beta VZW Who Beta VZW www.betavzw.org Association founded in 1993 Computer training for the unemployed Computer training for employees (Cevora/Cefora) 9:00-12:30 13:00-16:00

More information

Object-Oriented Concepts and Design Principles

Object-Oriented Concepts and Design Principles Object-Oriented Concepts and Design Principles Signature Specifying an object operation or method involves declaring its name, the objects it takes as parameters and its return value. Known as an operation

More information

C++ Important Questions with Answers

C++ Important Questions with Answers 1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children

More information

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

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and

More information

Lecture 10: building large projects, beginning C++, C++ and structs

Lecture 10: building large projects, beginning C++, C++ and structs CIS 330: / / / / (_) / / / / _/_/ / / / / / \/ / /_/ / `/ \/ / / / _/_// / / / / /_ / /_/ / / / / /> < / /_/ / / / / /_/ / / / /_/ / / / / / \ /_/ /_/_/_/ _ \,_/_/ /_/\,_/ \ /_/ \ //_/ /_/ Lecture 10:

More information

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in

More information

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class 1 2 3 4 5 6 Walter Savitch Frank M. Carrano Introduction to Computers and Java Chapter 1 ISBN 0136130887 2007 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved 7 Hardware and Software

More information

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

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator. Comparative Study In Utilization Of Creational And Structural Design Patterns In Solving Design Problems K.Wseem Abrar M.Tech., Student, Dept. of CSE, Amina Institute of Technology, Shamirpet, Hyderabad

More information

Parsing II Top-down parsing. Comp 412

Parsing II Top-down parsing. Comp 412 COMP 412 FALL 2018 Parsing II Top-down parsing Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled

More information

THE CONCEPT OF OBJECT

THE CONCEPT OF OBJECT THE CONCEPT OF OBJECT An object may be defined as a service center equipped with a visible part (interface) and an hidden part Operation A Operation B Operation C Service center Hidden part Visible part

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Aggregation. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos.

Aggregation. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos. Aggregation Thursday, July 6 2006 CSE 1020, Summer 2006, Overview (1): Before We Begin Some administrative details Some questions to consider Aggregation Overview / Introduction The aggregate s constructor

More information

The GoF Design Patterns Reference

The GoF Design Patterns Reference The GoF Design Patterns Reference Version.0 / 0.0.07 / Printed.0.07 Copyright 0-07 wsdesign. All rights reserved. The GoF Design Patterns Reference ii Table of Contents Preface... viii I. Introduction....

More information

Introduction to Computers and Java

Introduction to Computers and Java Walter Savitch Frank M. Carrano Introduction to Computers and Java Chapter 1 Objectives Overview computer hardware and software Introduce program design and objectoriented programming Overview the java

More information

Sample Examination Paper Programming and Software Development

Sample Examination Paper Programming and Software Development THE UNIVERSITY OF MELBOURNE DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Sample Examination Paper 2008 433-520 Programming and Software Development Exam Duration: 2 hours Total marks for this

More information

BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING SECTION A

BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING SECTION A BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING Monday 26 th September 2016 - Afternoon Answer any FOUR questions out of SIX.

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 17 Inheritance Overview Problem: Can we create bigger classes from smaller ones without having to repeat information? Subclasses: a class inherits

More information

Home Concert Xtreme 3 for ios User Guide

Home Concert Xtreme 3 for ios User Guide Home Concert Xtreme 3 for ios User Guide Copyright 2014, 2017 TimeWarp Technologies Inc. All rights reserved worldwide. No part of this publication may be reproduced, stored in a retrieval system, or transmitted,

More information

Character Stream : It provides a convenient means for handling input and output of characters.

Character Stream : It provides a convenient means for handling input and output of characters. Be Perfect, Do Perfect, Live Perfect 1 1. What is the meaning of public static void main(string args[])? public keyword is an access modifier which represents visibility, it means it is visible to all.

More information

The Lorax Programming Language

The Lorax Programming Language The Lorax Programming Language Doug Bienstock, Chris D Angelo, Zhaarn Maheswaran, Tim Paine, and Kira Whitehouse dmb2168, cd2665, zsm2103, tkp2108, kbw2116 Programming Translators and Languages, Department

More information

Lecture: Design Patterns

Lecture: Design Patterns Software Engineering Lecture: Design Patterns Thomas Fritz & Martin Glinz Many thanks to Philippe Beaudoin, Gail Murphy, David Shepherd, Neil Ernst and Meghan Allen Reading! For this lecture: (all required)

More information

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern Think of drawing/diagramming editors ECE450 Software Engineering II Drawing/diagramming editors let users build complex diagrams out of simple components The user can group components to form larger components......which

More information

Design of Embedded Systems

Design of Embedded Systems Design of Embedded Systems José Costa Software for Embedded Systems Departamento de Engenharia Informática (DEI) Instituto Superior Técnico 2015-01-02 José Costa (DEI/IST) Design of Embedded Systems 1

More information

Design Patterns Reid Holmes

Design Patterns Reid Holmes Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

More information

Home Concert Xtreme for ios User Guide

Home Concert Xtreme for ios User Guide Home Concert Xtreme for ios User Guide Copyright 2014, 2017 TimeWarp Technologies Inc. All rights reserved worldwide. No part of this publication may be reproduced, stored in a retrieval system, or transmitted,

More information

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Design 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 information

Using Design Patterns in Java Application Development

Using Design Patterns in Java Application Development Using Design Patterns in Java Application Development ExxonMobil Research & Engineering Co. Clinton, New Jersey Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S.

More information

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP OOP Object oriented programming Polymorphism Encapsulation Inheritance OOP Class concepts Classes can contain: Constants Delegates Events Fields Constructors Destructors Properties Methods Nested classes

More information

TDDB84 Design Patterns Lecture 02. Factory Method, Decorator

TDDB84 Design Patterns Lecture 02. Factory Method, Decorator Lecture 02 Factory Method, Decorator Peter Bunus Dept of Computer and Information Science Linköping University, Sweden petbu@ida.liu.se Factory Method Pattern Peter Bunus 2 1 Time for Lunch Joe, with the

More information

Lecture 20: Design Patterns II

Lecture 20: Design Patterns II Lecture 20: Design Patterns II Software System Design and Implementation ITCS/ITIS 6112/8112 001 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte Nov.

More information

Software Engineering Chap.7 - Design and Implementation

Software Engineering Chap.7 - Design and Implementation Software Engineering Chap.7 - Design and Implementation Simão Melo de Sousa RELEASE (UBI), LIACC (Porto), CCTC (Minho) Computer Science Department University of Beira Interior, Portugal Eng.Info./TSI,

More information

Design Patterns Revisited

Design Patterns Revisited CSC 7322 : Object Oriented Development J Paul Gibson, A207 paul.gibson@int-edu.eu http://www-public.it-sudparis.eu/~gibson/teaching/csc7322/ Design Patterns Revisited /~gibson/teaching/csc7322/l13-designpatterns-2.pdf

More information

Digital Storytelling with Photo Story 3

Digital Storytelling with Photo Story 3 Digital Storytelling with Photo Story 3 Before you begin, upload your digital images and save them into an easily identifiable folder in a convenient location on your hard drive eg. the my pictures directory.

More information

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

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011 Design Patterns Lecture 1 Manuel Mastrofini Systems Engineering and Web Services University of Rome Tor Vergata June 2011 Definition A pattern is a reusable solution to a commonly occurring problem within

More information

02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211

02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211 02 Features of C#, Part 1 Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211 Module Overview Constructing Complex Types Object Interfaces and Inheritance Generics Constructing

More information

TDDB84 Design Patterns Lecture 10. Prototype, Visitor

TDDB84 Design Patterns Lecture 10. Prototype, Visitor Lecture 10 Prototype, Visitor Peter Bunus Dept of Computer and Information Science Linköping University, Sweden petbu@ida.liu.se Prototype Peter Bunus 2 Prototype Non Software Example Peter Bunus 3 Motivational

More information

TDDB84 Design Patterns Lecture 10. Prototype, Visitor

TDDB84 Design Patterns Lecture 10. Prototype, Visitor Lecture 10 Prototype, Visitor Peter Bunus Dept of Computer and Information Science Linköping University, Sweden petbu@ida.liu.se Prototype Peter Bunus 2 1 Prototype Non Software Example Peter Bunus 3 Motivational

More information

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST II

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST II http://www.tutorialspoint.com DESIGN PATTERNS MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Design Patterns Framework. You can download these sample

More information

The Unified Modeling Language. Asst.Prof.Dr. Supakit Nootyaskool IT-KMITL

The Unified Modeling Language. Asst.Prof.Dr. Supakit Nootyaskool IT-KMITL The Unified Modeling Language Asst.Prof.Dr. Supakit Nootyaskool IT-KMITL UML: requirement VS. Design models Identify 2 All the classes or things Elementary business process Necessary step to carry out

More information

Using Windows Explorer and Libraries in Windows 7

Using Windows Explorer and Libraries in Windows 7 Using Windows Explorer and Libraries in Windows 7 Windows Explorer is a program that is used like a folder to navigate through the different parts of your computer. Using Windows Explorer, you can view

More information

COMP 250 Winter 2011 Reading: Java background January 5, 2011

COMP 250 Winter 2011 Reading: Java background January 5, 2011 Almost all of you have taken COMP 202 or equivalent, so I am assuming that you are familiar with the basic techniques and definitions of Java covered in that course. Those of you who have not taken a COMP

More information

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich. Introduction to Computers and Java Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch 2008 W. Savitch, F.M. Carrano, Pearson Prentice Hall Objectives! Overview computer

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch 2008 W. Savitch, F.M. Carrano, Pearson Prentice Hall Objectives! Overview computer

More information