MSO Lecture 1. Wouter Swierstra (adapted by HP) September 11, 2017

Size: px
Start display at page:

Download "MSO Lecture 1. Wouter Swierstra (adapted by HP) September 11, 2017"

Transcription

1 1 MSO Lecture 1 Wouter Swierstra (adapted by HP) September 11, 2017

2 So you think you can program... 2

3 From nrc.nl 3

4 Question: why do ICT-projects fail so often? 4

5 5 Question: why do ICT-projects fail so often? Bad programmers? Bad management? Bad...?

6 Still you think you can program... 6

7 7 LEVELS OF ABSTRACTION You already know how to write individual lines of code: for(i=0; i<n; i++) Code is organized into methods: public bool isempty() Methods are organized into classes: public class Student...

8 8 BEYOND THE F O R LOOP In this course you will learn how to design great software:

9 9 BEYOND THE F O R LOOP In this course you will learn how to design great software: that is clearly structured;

10 10 BEYOND THE F O R LOOP In this course you will learn how to design great software: that is clearly structured; that is easy to modify and maintain;

11 11 BEYOND THE F O R LOOP In this course you will learn how to design great software: that is clearly structured; that is easy to modify and maintain; that makes your customers happy...

12 12 BEYOND THE F O R LOOP In this course you will learn how to design great software: that is clearly structured; that is easy to modify and maintain; that makes your customers happy which is not that obvious

13 13 Question: which phases may we identify in an ICT-project...?... and where could/will things go wrong?

14 14

15 15

16 16

17 But once I ve finished coding something, I m done. Right? 17

18 18

19 19

20 There is much more to software construction than just programming. 20

21 And it is hard to overestimate the volume and importance of maintenance. 21

22 22 MSO This course assumes you know about for-loops, assignments, methods, and objects; It will teach you to apply this knowledge to organize code into great software that makes your customers happy.

23 23 TOPICS MSO is a course shared by Information Science and Computer Science students. What should this course cover? Technical? Sociological? Programming? Modelling? Object oriented analysis and design.

24 REQUIREMENTS ENGINEERING 24

25 25 OBJECT ORIENTED ANALYSIS Before you start designing software, you need to determine what to build; Analysis is the process of discovering, documenting and maintaining the requirements of a software system Figuring out what the problem is. What does the customer want? How can I translate a customer s wishes to a software design?... By the way, who is the customer?

26 26 OBJECT ORIENTED ANALYSIS By the way, who is the customer in the case of the bevolkingsregister?

27 27 OBJECT ORIENTED ANALYSIS By the way, who is the customer in the case of the bevolkingsregister? The clerk?

28 28 OBJECT ORIENTED ANALYSIS By the way, who is the customer in the case of the bevolkingsregister? The clerk? The citizen?

29 29 OBJECT ORIENTED ANALYSIS By the way, who is the customer in the case of the bevolkingsregister? The clerk? The citizen? The municipal authorities?

30 30 OBJECT ORIENTED ANALYSIS By the way, who is the customer in the case of the bevolkingsregister? The clerk? The citizen? The municipal authorities? The national government?

31 31 OBJECT ORIENTED ANALYSIS By the way, who is the customer in the case of the bevolkingsregister? The clerk? The citizen? The municipal authorities? The national government?...?

32 32 OBJECT ORIENTED DESIGN How should I organize code into classes? Which classes are related? How are classes related? What are the properties of a good design?

33 33 ANALYSIS AND DESIGN This course teaches both analysis and design. Analysis is a soft skill talking to customers and figuring out what they want. Design is more technical figuring out the right high-level structure of your code.

34 34 Anonymous CS student: Why is this course interesting for me, all I want to do is program?

35 35 MSO FOR CS STUDENTS Weeks of programming can save you hours of planning Anon Learning about good software design will make you a better programmer. This course will train you to think about code at a high-level of abstraction; A good design results in better code.

36 36 Anonymous IS student: Why is this course interesting for me? As a project manager, I ll never have to program myself.

37 Close your eyes and picture your most beautiful memory. 37

38 Now imagine having to commission an artist to paint that memory... 38

39 To catch the atmosphere of that beautiful memory, you want an impressionist style painting... 39

40 40

41 So you will have to communicate with that artist... in French. 41

42 42 THE METAPHOR There is a huge difference between having a great idea for a software product and implementing it. The only way you will ever succeed in getting the implementation you want, is if you learn to communicate clearly with software developers. Communication requires speaking the same language and requires knowing the same concepts. This course offers a tremendous opportunity for cooperation between computer scientists and information scientists!

43 43 MSO FOR IS This course will teach you how to translate a customer s wishes to a concrete design that developers can implement. You will learn the language to communicate high-level ideas to developers. It will teach you what constitutes good design and help you identify good developers.

44 44 Anonymous GameTech student: Why is this course interesting for me? I just want to design computer games?

45 Suppose you just wrote Super Mario Brothers... 45

46 46... AND THEN THE FEEDBACK COMES IN. The characters are cute

47 47... AND THEN THE FEEDBACK COMES IN. The characters are cute I like the mushrooms and turtle shells.

48 48... AND THEN THE FEEDBACK COMES IN. The characters are cute I like the mushrooms and turtle shells. But the gameplay is no good.

49 49... AND THEN THE FEEDBACK COMES IN. The characters are cute I like the mushrooms and turtle shells. But the gameplay is no good.... and then your boss says

50 50... AND THEN THE FEEDBACK COMES IN. The characters are cute I like the mushrooms and turtle shells. But the gameplay is no good.... and then your boss says Maybe we should put the same characters in go karts...

51 51... AND THEN THE FEEDBACK COMES IN. The characters are cute I like the mushrooms and turtle shells. But the gameplay is no good.... and then your boss says Maybe we should put the same characters in go karts and add bananas.

52 52 MSO FOR GAMETECH The hardest part about building a game is getting the gameplay just right; This involves a lot of test-rewrite development iterations; Designing your game to be easy to adapt to these changes makes your life much easier!

53 53 COURSE ORGANIZATION Lectures theory Lab sessions practice Four small assignments deadlines online now; One large design project.

54 54 REGULAR ASSIGNMENTS: THE CARROT AND THE STICK I will set four exercises that you must submit. Each exercise will be marked on the scale: A; B; D; F. If you score AABB or better, you will receive an extra 0.5 on your final exam. If you score BBDD or worse, you will lose 0.5 on your final exam. If you fail an exercise (F), you will fail the course. If you fail one exercise, you will be given the opportunity to complete a remedial exercise ( herkansing ), provided your final mark for the whole course is at least a 6.

55 55 FINAL MARK One midterm exam (20%); Final exam (50%); Design project (30%)

56 56 MATERIAL Shalloway and Trott, Design Patterns Explained, 2nd edition, Addison Wesley; Code uses Java (but there is almost no code in the book); C# code available from the book s website. Larman, Applying UML and patterns, Prentice Hall. (slides and schedule refer to the second edition) Online resources will be added to the website. Slides and notes.

57 Who, what, when, where? 57

58 58 WHO Lecturers: Anna-Lena Lamprecht, Hans Philippi Lab leads: Nico Naus, Hans Philippi Lab assistants: David van der Sar, Lex de Kogel, Jelle Kroon, Iwan Boksebeld, Jasper Berends, Wessel Radstok

59 59 TOWARDS OBJECT-ORIENTED DESIGN Before talking about more about object oriented analysis and design, let s review some concepts: inheritance; subclass/superclass; polymorphism; abstract classes.

60 60 EXAMPLE: CIRCLE class Circle { protected float radius; public Circle (float r){ radius = r; } } public float Area () { return Math.PI * radius * radius; }...

61 61 CLASSES VS INSTANCES We distinguish between the type of integers int and a concrete integer Similarly, we should be careful to distinguish between the description of a class, such as the Circle class, and instances of this class, such as c = new Circle(3); Such instances are called objects.

62 62 EXTENDING CIRCLES What should I do if I want to have a new kind of circle, ColorCircle, that behaves just like a circle, but also has color information?

63 63 EXTENDING CIRCLES What should I do if I want to have a new kind of circle, ColorCircle, that behaves just like a circle, but also has color information? Copy the original Circle into a new ColorCircle class.

64 64 EXAMPLE: COLORCIRCLE class ColorCircle { protected float radius; protected Color color; public ColorCircle (float r, Color c) { radius = r; color = c; } } public float Area () { return Math.PI * radius * radius; }...

65 65 EXTENDING CIRCLES What should I do if I want to have a new kind of circle, ColorCircle, that behaves just like a circle, but also has color information? Copy the original Circle into a new ColorCircle class. But now suppose I want to change the type of Area() to double. Then I will need to change the code on two different places. And suppose I want to add a method Circumference(). Then I will have to add this code on two different places. This smells of bad design...

66 66 AN ALTERNATIVE SOLUTION INHERITANCE class ColorCircle : Circle { protected Color color;... }

67 67 AN ALTERNATIVE SOLUTION INHERITANCE class ColorCircle : Circle { protected Color color;... } This way, we declare that the class ColorCircle inherits the methods and variables of Circle class...

68 68 AN ALTERNATIVE SOLUTION INHERITANCE class ColorCircle : Circle { protected Color color;... } This way, we declare that the class ColorCircle inherits the methods and variables of Circle class only it also has color information.

69 69 AN ALTERNATIVE SOLUTION INHERITANCE class ColorCircle : Circle { protected Color color;... } This way, we declare that the class ColorCircle inherits the methods and variables of Circle class only it also has color information. A change to the original Circle class methods automatically propagates to the ColorCircle class.

70 70 TERMINOLOGY We say that ColorCircle is a subclass of Circle; Or that Circle is the superclass of ColorCircle.

71 71 POLYMORPHISM We have defined a method float Area() within the class Circle We can call this method on all kinds of circles: Circle mycircle1 = new Circle(4); Circle mycircle2 = new ColorCircle(6, Color.Red);... float area1 = mycircle1.area(); float area2 = mycircle2.area();

72 72 POLYMORPHISM We have defined a method float Area() within the class Circle We can call this method on all kinds of circles: Circle mycircle1 = new Circle(4); Circle mycircle2 = new ColorCircle(6, Color.Red);... float area1 = mycircle1.area(); float area2 = mycircle2.area(); We call this phenomenon polymorphism.

73 73 A PROBLEM Suppose you want to define objects to represent circles, squares, rectangles, and curves. A Square class could be a subclass of a Rectangle class. But what is a good choice of superclass for both the Rectangle and Circle classes?

74 74 ABSTRACT CLASS An abstract class is a class without instances. For example: abstract class Shape { } public abstract void draw() {... } This declares a dummy superclass, with a single method draw Individual subclasses, such as Circle, Square, Rectangle or Curve, should override the draw method with their own implementation.

75 75 ANOTHER PROBLEM Now suppose you want to draw various buttons and controls on a canvas. Finding a nice layout requires that you know the size of all these objects.... but they are not closely related enough to fall under a single superclass.

76 76 INTERFACES An interface is a signature describing a series of methods or properties; A class implements an interface if it defines these methods. interface IDimensions { float getlength(); float getwidth(); }

77 77 INTERFACES OR ABSTRACT CLASSES? Interfaces: A class may implement many interfaces. An interface only defines public methods properties. Used to organize objects the share some common property. Abstract classes: A class has one single superclass. An abstract class may also specify private methods and properties. Used to group closely related objects.

78 78 INTERFACES: TECHNICAL TERM The term interface can mean different things: Interface in the IDimension sense But we also talk about the interface of a system or class as what gets exposed to the outside world. When we talk about interfaces, we ll usually refer to the second notion.

79 79 HOW MUCH CODE? This course will not require a lot of coding...

80 80 HOW MUCH CODE? This course will not require a lot of coding but we will study programs.

81 81 HOW MUCH CODE? This course will not require a lot of coding but we will study programs. We will look at what code does and how it is structured, without worrying too much about how it is implemented exactly.

82 82 HOW MUCH CODE? This course will not require a lot of coding but we will study programs. We will look at what code does and how it is structured, without worrying too much about how it is implemented exactly. Is this program well designed? as opposed to The loop on line 325 of the Foo class is wrong.

83 83 OUTLINE OF THE COURSE First four sessions: focus on the analysis and design process, including UML

84 84 OUTLINE OF THE COURSE First four sessions: focus on the analysis and design process, including UML Later sessions: it is a good thing to learn from your failures...

85 85 OUTLINE OF THE COURSE First four sessions: focus on the analysis and design process, including UML Later sessions: it is a good thing to learn from your failures... but it is better to learn from other peoples failures: focus on design patterns

86 86 REFERENCES The following references can be helpful to refresh or extend your knowledge of C#: topics: inheritance, polymorphism, interfaces topics: inheritance, abstract classes

87 87 LABS Lab assistance starts on Thursday September 14

Abstract Classes. Abstract Classes a and Interfaces. Class Shape Hierarchy. Problem AND Requirements. Abstract Classes.

Abstract Classes. Abstract Classes a and Interfaces. Class Shape Hierarchy. Problem AND Requirements. Abstract Classes. a and Interfaces Class Shape Hierarchy Consider the following class hierarchy Shape Circle Square Problem AND Requirements Suppose that in order to exploit polymorphism, we specify that 2-D objects must

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

16 Multiple Inheritance and Extending ADTs

16 Multiple Inheritance and Extending ADTs Object-Oriented Design Lecture 16 CS 3500 Fall 2009 (Pucella) Tuesday, Nov 10, 2009 16 Multiple Inheritance and Extending ADTs We looked last time at inheritance and delegation as two ways to reuse implementation

More information

PREPARING FOR PRELIM 2

PREPARING FOR PRELIM 2 PREPARING FOR PRELIM 2 CS 1110: FALL 2012 This handout explains what you have to know for the second prelim. There will be a review session with detailed examples to help you study. To prepare for the

More information

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas What is this class about? While this class is called Design Patterns, there are many other items of critical

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 20, 2014 Abstract

More information

Object Oriented Programming. Java-Lecture 11 Polymorphism

Object Oriented Programming. Java-Lecture 11 Polymorphism Object Oriented Programming Java-Lecture 11 Polymorphism Abstract Classes and Methods There will be a situation where you want to develop a design of a class which is common to many classes. Abstract class

More information

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department 0901212 Python Programming 1 st Semester 2014/2015 Course Catalog This course introduces

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 21, 2013 Abstract

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

Design Patterns: State, Bridge, Visitor

Design Patterns: State, Bridge, Visitor Design Patterns: State, Bridge, Visitor State We ve been talking about bad uses of case statements in programs. What is one example? Another way in which case statements are sometimes used is to implement

More information

CS 142 Style Guide Grading and Details

CS 142 Style Guide Grading and Details CS 142 Style Guide Grading and Details In the English language, there are many different ways to convey a message or idea: some ways are acceptable, whereas others are not. Similarly, there are acceptable

More information

CSCI 355 Lab #2 Spring 2007

CSCI 355 Lab #2 Spring 2007 CSCI 355 Lab #2 Spring 2007 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation Object-Oriented Software Engineering Chapter 2: Review of Object Orientation 2.1 What is Object Orientation? Procedural paradigm: Software is organized around the notion of procedures Procedural abstraction

More information

INSTRUCTIONS TO CANDIDATES

INSTRUCTIONS TO CANDIDATES NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING MIDTERM ASSESSMENT FOR Semester 2 AY2017/2018 CS2030 Programming Methodology II March 2018 Time Allowed 90 Minutes INSTRUCTIONS TO CANDIDATES 1. This

More information

CS 116 Week 8 Page 1

CS 116 Week 8 Page 1 CS 116 Week 8: Outline Reading: 1. Dale, Chapter 11 2. Dale, Lab 11 Objectives: 1. Mid-term exam CS 116 Week 8 Page 1 CS 116 Week 8: Lecture Outline 1. Mid-term Exam CS 116 Week 8 Page 2 CS 116 Week 8:

More information

Polymorphism. Object Orientated Programming in Java. Benjamin Kenwright

Polymorphism. Object Orientated Programming in Java. Benjamin Kenwright Polymorphism Object Orientated Programming in Java Benjamin Kenwright Quizzes/Labs Every single person should have done Quiz 00 Introduction Quiz 01 - Java Basics Every single person should have at least

More information

CSCI 355 LAB #2 Spring 2004

CSCI 355 LAB #2 Spring 2004 CSCI 355 LAB #2 Spring 2004 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 2: Review of Object Orientation

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 2: Review of Object Orientation Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 2: Review of Object Orientation 2.1 What is Object Orientation? Procedural paradigm: Software is organized

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module

More information

Objects First with Java

Objects First with Java ^ Objects First with Java A Practical Introduction using BlueJ David J. Barnes and Michael Kolling Second edition PEARSON Prentice Hall Harlow, England London New York Boston San Francisco Toronto Sydney

More information

Credit: The lecture slides are created based on previous lecture slides by Dan Zingaro.

Credit: The lecture slides are created based on previous lecture slides by Dan Zingaro. CSC148 2018 Here 1 Credit: The lecture slides are created based on previous lecture slides by Dan Zingaro. 2 Larry Zhang Office: DH-3042 Email: ylzhang@cs.toronto.edu 3 The teaching team Dan Zingaro: LEC0103

More information

Relationships Between Real Things. CSE 143 Java. Common Relationship Patterns. Composition: "has a" CSE143 Sp Student.

Relationships Between Real Things. CSE 143 Java. Common Relationship Patterns. Composition: has a CSE143 Sp Student. CSE 143 Java Object & Class Relationships Inheritance Reading: Ch. 9, 14 Relationships Between Real Things Man walks dog Dog strains at leash Dog wears collar Man wears hat Girl feeds dog Girl watches

More information

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Inheritance Consider a new type Square. Following how we declarations for the Rectangle and Circle classes we could declare it as follows:

More information

CSCI 102 Fall 2010 Exam #1

CSCI 102 Fall 2010 Exam #1 Name: USC Username: CSCI 102 Fall 2010 Exam #1 Problems Problem #1 (14 points) Problem #2 (15 points) Problem #3 (20 points) Problem #4 (16 points) Problem #5 (35 points) Total (100 points) Problem 1 Short

More information

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Assignment 1: Turtle Graphics Page 1 600.112: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Peter H. Fröhlich phf@cs.jhu.edu Joanne Selinski joanne@cs.jhu.edu Due Date: Wednesdays

More information

Preface A Brief History Pilot Test Results

Preface A Brief History Pilot Test Results Preface A Brief History In Fall, 2005, Wanda Dann and Steve Cooper, originators of the Alice approach for introductory programming (in collaboration with Randy Pausch), met with Barb Ericson and Mark Guzdial,

More information

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance

More information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 Print Your Name: Page 1 of 8 Signature: Aludra Loginname: CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 (10:00am - 11:12am, Wednesday, October 5) Instructor: Bill Cheng Problems Problem #1 (24

More information

Chapter 3: Inheritance and Polymorphism

Chapter 3: Inheritance and Polymorphism Chapter 3: Inheritance and Polymorphism Overview Inheritance is when a child class, or a subclass, inherits, or gets, all the data (properties) and methods from the parent class, or superclass. Just like

More information

CSSE 220 Day 15. Inheritance. Check out DiscountSubclasses from SVN

CSSE 220 Day 15. Inheritance. Check out DiscountSubclasses from SVN CSSE 220 Day 15 Inheritance Check out DiscountSubclasses from SVN Discount Subclasses Work in pairs First look at my solution and understand how it works Then draw a UML diagram of it DiscountSubclasses

More information

Chapter 10 Classes Continued. Fundamentals of Java

Chapter 10 Classes Continued. Fundamentals of Java Chapter 10 Classes Continued Objectives Know when it is appropriate to include class (static) variables and methods in a class. Understand the role of Java interfaces in a software system and define an

More information

TIETS14 Introduction to Formal Specification

TIETS14 Introduction to Formal Specification TIETS14 Introduction to Formal Specification 5 ECTS Teacher: Timo Nummenmaa timo.nummenmaa@staff.uta.fi Executable Formal Specifications in Game Development: Design, Validation and Evolution Teaching times:

More information

Chapter 14 Abstract Classes and Interfaces

Chapter 14 Abstract Classes and Interfaces Chapter 14 Abstract Classes and Interfaces 1 What is abstract class? Abstract class is just like other class, but it marks with abstract keyword. In abstract class, methods that we want to be overridden

More information

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount

More information

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently. User Request: Create a simple magazine data system. Milestones:

More information

5.6.1 The Special Variable this

5.6.1 The Special Variable this ALTHOUGH THE BASIC IDEAS of object-oriented programming are reasonably simple and clear, they are subtle, and they take time to get used to And unfortunately, beyond the basic ideas there are a lot of

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner

University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner Inheritance II Lecture 23, Thu Mar 30 2006 based on slides by Kurt Eiselt http://www.cs.ubc.ca/~tmm/courses/cpsc111-06-spr

More information

PRINCIPLES OF SOFTWARE BIM209DESIGN AND DEVELOPMENT 00. WELCOME TO OBJECTVILLE. Speaking the Language of OO

PRINCIPLES OF SOFTWARE BIM209DESIGN AND DEVELOPMENT 00. WELCOME TO OBJECTVILLE. Speaking the Language of OO PRINCIPLES OF SOFTWARE BIM209DESIGN AND DEVELOPMENT 00. WELCOME TO OBJECTVILLE Speaking the Language of OO COURSE INFO Instructor : Alper Bilge TA : Gökhan Çıplak-Ahmet Alkılınç Time : Tuesdays 2-5pm Location

More information

Survey #2. Assignment #3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Static Interface Types.

Survey #2. Assignment #3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Static Interface Types. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Static Interface Types Lecture 19 Readings This Week: Ch 8.3-8.8 and into Ch 9.1-9.3 (Ch 9.3-9.8 and Ch 11.1-11.3 in old 2 nd ed)

More information

Logistics. Final Exam on Friday at 3pm in CHEM 102

Logistics. Final Exam on Friday at 3pm in CHEM 102 Java Review Logistics Final Exam on Friday at 3pm in CHEM 102 What is a class? A class is primarily a description of objects, or instances, of that class A class contains one or more constructors to create

More information

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics Zarqa University Faculty: Information Technology Department: Computer Science Course title: Programming LAB 1 (1501111) Instructor: Lecture s time: Semester: Office Hours: Course description: This introductory

More information

CSC207 Week 3. Larry Zhang

CSC207 Week 3. Larry Zhang CSC207 Week 3 Larry Zhang 1 Announcements Readings will be posted before the lecture Lab 1 marks available in your repo 1 point for creating the correct project. 1 point for creating the correct classes.

More information

Revising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Linux Lab Swansea, December 13, 2011.

Revising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Linux Lab Swansea, December 13, 2011. Computer Science Department Swansea University Linux Lab Swansea, December 13, 2011 How to use the revision lecture The purpose of this lecture (and the slides) is to emphasise the main topics of this

More information

More on Objects in JAVA TM

More on Objects in JAVA TM More on Objects in JAVA TM Inheritance : Definition: A subclass is a class that extends another class. A subclass inherits state and behavior from all of its ancestors. The term superclass refers to a

More information

CS 111: Programming Fundamentals II

CS 111: Programming Fundamentals II CS 111: Programming Fundamentals II Summer 2016 Home Syllabus Schedule Exams Project Meeting Times: 111-001: Lectures: 10:50 am - 12:15 pm Mon, Tue, Wed HB 112 Labs: 10:50 am - 12:15 pm Thu, HB 206, 207

More information

CS Week 15 Page 1

CS Week 15 Page 1 Reading: 1. Deitel & Deitel, Chapters 10 Objectives: 1. Continue discussing Object Oriented Programming 2. Final Exam Review Concepts: 1. More About Polymorphism References: 1. http://www.prenhall.com/deitel/

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II 1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 8(a): Abstract Classes Lecture Contents 2 Abstract base classes Concrete classes Dr. Amal Khalifa, 2014 Abstract Classes and Methods

More information

Last class. -More on polymorphism -super -Introduction to interfaces

Last class. -More on polymorphism -super -Introduction to interfaces Last class -More on polymorphism -super -Introduction to interfaces Interfaces Sometimes in Java, we will have 2 classes that both share a similar structure, but neither of them is clearly the parent or

More information

San José State University Department of Computer Science CS151, Object Oriented Design, Section 04, Fall, 2016 (42968)

San José State University Department of Computer Science CS151, Object Oriented Design, Section 04, Fall, 2016 (42968) San José State University Department of Computer Science CS151, Object Oriented Design, Section 04, Fall, 2016 (42968) Course and Contact Information Instructor: Office Location: Vidya Rangasayee MH229

More information

Relationships Between Real Things CSE 143. Common Relationship Patterns. Employee. Supervisor

Relationships Between Real Things CSE 143. Common Relationship Patterns. Employee. Supervisor CSE 143 Object & Class Relationships Inheritance Reading: Ch. 9, 14 Relationships Between Real Things Man walks dog Dog strains at leash Dog wears collar Man wears hat Girl feeds dog Girl watches dog Dog

More information

Inf1-OP. Inf1-OP Exam Review. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 20, School of Informatics

Inf1-OP. Inf1-OP Exam Review. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 20, School of Informatics Inf1-OP Inf1-OP Exam Review Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics March 20, 2017 Overview Overview of examinable material: Lectures Week 1

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

Object-Oriented Analysis and Design

Object-Oriented Analysis and Design 0. Object Orientation: An Subject/Topic/Focus: over this lecture Summary: Lecturer, lecture, rooms, assistants, lab classes, credit points... Need for systems analysis and software engineers Literature

More information

CS 251, Intermediate Programming Midterm Exam October 9, 2013

CS 251, Intermediate Programming Midterm Exam October 9, 2013 CS 251, Intermediate Programming Midterm Exam October 9, 2013 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1,2 and 3, Spring 2017

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1,2 and 3, Spring 2017 San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1,2 and 3, Spring 2017 Course and Contact Information Instructor: Dr. Kim Office Location:

More information

Back to ObjectLand. Contents at: Chapter 5. Questions of Interest. encapsulation. polymorphism. inheritance overriding inheritance super

Back to ObjectLand. Contents at: Chapter 5. Questions of Interest. encapsulation. polymorphism. inheritance overriding inheritance super korienekch05.qxd 11/12/01 4:06 PM Page 105 5 Back to ObjectLand Contents at: Chapter 5 #( encapsulation polymorphism inheritance overriding inheritance super learning the class hierarchy finding classes

More information

Design Patterns: Composite, Memento, Template Method, Decorator, Chain of Responsibility, Interpreter

Design Patterns: Composite, Memento, Template Method, Decorator, Chain of Responsibility, Interpreter Design Patterns: Composite, Memento, Template Method, Decorator, Chain of Responsibility, Interpreter Composite Outline for Week 14 [Skrien 8.7] We need to allow users to group figures together to make

More information

CS 134 Programming Exercise 3:

CS 134 Programming Exercise 3: CS 134 Programming Exercise 3: Repulsive Behavior Objective: To gain experience implementing classes and methods. Note that you must bring a program design to lab this week! The Scenario. For this lab,

More information

CS107 Handout 37 Spring 2007 May 25, 2007 Introduction to Inheritance

CS107 Handout 37 Spring 2007 May 25, 2007 Introduction to Inheritance CS107 Handout 37 Spring 2007 May 25, 2007 Introduction to Inheritance Handout written by Julie Zelenski, updated by Jerry. Inheritance is a language property most gracefully supported by the object-oriented

More information

CS 101: Computer Programming and Utilization. Abhiram Ranade

CS 101: Computer Programming and Utilization. Abhiram Ranade CS 101: Computer Programming and Utilization Abhiram Ranade CS 101: Computer Programming and Utilization Abhiram Ranade Course Overview How to represent problems on a computer and solve them Programming

More information

CS 11 java track: lecture 3

CS 11 java track: lecture 3 CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces

More information

2. The object-oriented paradigm

2. The object-oriented paradigm 2. The object-oriented paradigm Plan for this section: Look at things we have to be able to do with a programming language Look at Java and how it is done there Note: I will make a lot of use of the fact

More information

Outline EXPERIENCE WITH TWO OOP LANGUAGES IN ONE COURSE. HISTORY Methodology and learning design of the course Experience from classes

Outline EXPERIENCE WITH TWO OOP LANGUAGES IN ONE COURSE. HISTORY Methodology and learning design of the course Experience from classes EXPERIENCE WITH TWO OOP LANGUAGES IN ONE COURSE Ana Madevska Bogdanova, FCSE, Skopje, Macedoia Outline HISTORY Methodology and learning design of the course Experience from classes Lectures exercises Questionnaire

More information

MSO Lecture 6. Wouter Swierstra (adapted by HP) September 28, 2017

MSO Lecture 6. Wouter Swierstra (adapted by HP) September 28, 2017 1 MSO Lecture 6 Wouter Swierstra (adapted by HP) September 28, 2017 2 LAST LECTURE Case study: CAD/CAM system What are design patterns? Why are they important? What are the Facade and Adapter patterns?

More information

Relationships Between Real Things CSC 143. Common Relationship Patterns. Composition: "has a" CSC Employee. Supervisor

Relationships Between Real Things CSC 143. Common Relationship Patterns. Composition: has a CSC Employee. Supervisor CSC 143 Object & Class Relationships Inheritance Reading: Ch. 10, 11 Relationships Between Real Things Man walks dog Dog strains at leash Dog wears collar Man wears hat Girl feeds dog Girl watches dog

More information

Making Inheritance Work: C++ Issues

Making Inheritance Work: C++ Issues Steven Zeil September 19, 2013 Contents 1 Base Class Function Members 2 2 Assignment and Subtyping 3 3 Virtual Destructors 5 4 Virtual Assignment 9 5 Virtual constructors 11 51 Cloning 13 6 Downcasting

More information

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1 CS250 Intro to CS II Spring 2017 CS250 - Intro to CS II 1 Topics Virtual Functions Pure Virtual Functions Abstract Classes Concrete Classes Binding Time, Static Binding, Dynamic Binding Overriding vs Redefining

More information

Making Inheritance Work: C++ Issues

Making Inheritance Work: C++ Issues Steven Zeil September 19, 2013 Contents 1 Base Class Function Members 2 2 Assignment and Subtyping 3 3 Virtual Destructors 4 4 Virtual Assignment 7 5 Virtual constructors 9 51 Cloning 11 6 Downcasting

More information

You do not have to memorize methods from the Java API. You should know how to use String,

You do not have to memorize methods from the Java API. You should know how to use String, Com S 227 Spring 2017 Topics and review problems for Final Exam Monday, May 1, 7:00-9:00 pm. Locations: Last name A-G: LeBaron 1210 Last name H-M: Kildee 0125 Last name N-Z: Troxel 1001 ** You must bring

More information

Lecture #2 on Object-Oriented Modeling

Lecture #2 on Object-Oriented Modeling Outline Lecture #2 on Object-Oriented Modeling Thierry Géraud EPITA Research and Development Laboratory (LRDE) 2006 Thierry Géraud Lecture #2 on Object-Oriented Modeling EPITA-LRDE 2006 1 / 38 Outline

More information

CSC324 Principles of Programming Languages

CSC324 Principles of Programming Languages CSC324 Principles of Programming Languages http://mcs.utm.utoronto.ca/~324 November 14, 2018 Today Final chapter of the course! Types and type systems Haskell s type system Types Terminology Type: set

More information

Student Performance Q&A:

Student Performance Q&A: Student Performance Q&A: 2004 AP Computer Science A Free-Response Questions The following comments on the 2004 free-response questions for AP Computer Science A were written by the Chief Reader, Chris

More information

Soda Machine Laboratory

Soda Machine Laboratory Soda Machine Laboratory Introduction This laboratory is intended to give you experience working with multiple queue structures in a familiar real-world setting. The given application models a soda machine

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

EEC-484/584 Computer Networks

EEC-484/584 Computer Networks EEC-484/584 Computer Networks Lecture 1 Wenbing Zhao wenbing@ieee.org (Lecture nodes are based on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) What is Computer Network? A group of

More information

CSE 70 Final Exam Fall 2009

CSE 70 Final Exam Fall 2009 Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15

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

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

Survey #2. Variable Scope. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Scope Static.

Survey #2. Variable Scope. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Scope Static. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Scope Static Readings This Week: Ch 8.3-8.8 and into Ch 9.1-9.3 (Ch 9.3-9.8 and Ch 11.1-11.3 in old 2 nd ed) (Reminder: Readings

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

An Introduction to Subtyping

An Introduction to Subtyping An Introduction to Subtyping Type systems are to me the most interesting aspect of modern programming languages. Subtyping is an important notion that is helpful for describing and reasoning about type

More information

Compulsory course in Computer Science

Compulsory course in Computer Science Compulsory course in Computer Science University of Macau Faculty of Science and Technology Department of Computer and Information Science SFTW241 Programming Languages Architecture I Syllabus 2 nd Semester

More information

17 Multiple Inheritance and ADT Extensions

17 Multiple Inheritance and ADT Extensions Object-Oriented Design Lecture 17 CS 3500 Spring 2010 (Pucella) Friday, Mar 19, 2010 17 Multiple Inheritance and ADT Extensions We looked last time at inheritance and delegation as two ways to reuse implementation

More information

Slide 1 CS 170 Java Programming 1

Slide 1 CS 170 Java Programming 1 CS 170 Java Programming 1 Objects and Methods Performing Actions and Using Object Methods Slide 1 CS 170 Java Programming 1 Objects and Methods Duration: 00:01:14 Hi Folks. This is the CS 170, Java Programming

More information

CS 520 Theory and Practice of Software Engineering Fall 2018

CS 520 Theory and Practice of Software Engineering Fall 2018 Today CS 520 Theory and Practice of Software Engineering Fall 2018 Object Oriented (OO) Design Principles September 13, 2018 Code review and (re)design of an MVC application (and encapsulation) Polymorphism

More information

The Essence of OOP using Java, Nested Top-Level Classes. Preface

The Essence of OOP using Java, Nested Top-Level Classes. Preface The Essence of OOP using Java, Nested Top-Level Classes Baldwin explains nested top-level classes, and illustrates a very useful polymorphic structure where nested classes extend the enclosing class and

More information

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10 Mathematics/Science Department Kirkwood Community College Course Syllabus Computer Science CSC142 Bob Driggs Dean Cate Sheller Instructor 1/10 Computer Science (CSC142) Course Description Introduces computer

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2018 Lecture 7b Andrew Tolmach Portland State University 1994-2018 Dynamic Type Checking Static type checking offers the great advantage of catching errors early And

More information

An approach to introductory programming

An approach to introductory programming An approach to introductory programming Abhiram Ranade April 21, 2014 What should you teach in an introductory programming course? What should you teach in an introductory programming course? Some simple

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 4: OO Principles - Polymorphism http://courses.cs.cornell.edu/cs2110/2018su Lecture 3 Recap 2 Good design principles.

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

Programming 2. Outline (112) Lecture 0. Important Information. Lecture Protocol. Subject Overview. General Overview.

Programming 2. Outline (112) Lecture 0. Important Information. Lecture Protocol. Subject Overview. General Overview. Programming 2 (112) Lecture 0 College of Computer Science and Engineering Taibah University S2, 1439 Outline Important Information Lecture Protocol Subject Overview General Overview Course Objectives Studying

More information

Object typing and subtypes

Object typing and subtypes CS 242 2012 Object typing and subtypes Reading Chapter 10, section 10.2.3 Chapter 11, sections 11.3.2 and 11.7 Chapter 12, section 12.4 Chapter 13, section 13.3 Subtyping and Inheritance Interface The

More information

MSO Lecture 6. Wouter Swierstra. September 24, 2015

MSO Lecture 6. Wouter Swierstra. September 24, 2015 1 MSO Lecture 6 Wouter Swierstra September 24, 2015 2 LAST LECTURE Case study: CAD/CAM system What are design patterns? Why are they important? What are the Facade and Adapter patterns? 3 THIS LECTURE

More information

CSE351 Winter 2016, Final Examination March 16, 2016

CSE351 Winter 2016, Final Examination March 16, 2016 CSE351 Winter 2016, Final Examination March 16, 2016 Please do not turn the page until 2:30. Rules: The exam is closed-book, closed-note, etc. Please stop promptly at 4:20. There are 125 (not 100) points,

More information

CS 4349 Lecture October 18th, 2017

CS 4349 Lecture October 18th, 2017 CS 4349 Lecture October 18th, 2017 Main topics for #lecture include #minimum_spanning_trees. Prelude Homework 6 due today. Homework 7 due Wednesday, October 25th. Homework 7 has one normal homework problem.

More information