Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session 2 23 September 2008.

Slides:



Advertisements
Similar presentations
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Exercise Session 1: Eiffel Introduction.
Advertisements

Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session November 2008.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
Computers in Principle & Practice I - V Deena Engel Computers in Principle and Practice I V , Sections 1 & 2 Fall, 2009 Deena Engel .
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 2: Dealing with Objects I.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 2: Dealing with Objects I.
CIS101 Introduction to Computing Week 05. Agenda Your questions Exam next week - Excel Introduction to the Internet & HTML Online HTML Resources Using.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Summer 2008 SimNet Student Walk-Through Cal Poly Pomona
COMS W1004 Introduction to Computer Science June 25, 2008.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 10: Project Presentation Ilinca.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session 3 29 September 2008.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session 1 22 September 2009.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class.
CS 410 Applied Algorithms Applied Algorithms Lecture #1 Introduction, class information, first problems.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
CIS101 Introduction to Computing Week 05 Spring 2004.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
CSE 115 / 503 Introduction to Computer Science For Majors I Carl Alphonce 219 Bell Hall.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Lecture 1 Introduction to Computers and Object-
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 7.
Monroe L. Weber-Shirk S chool of Civil and Environmental Engineering Laboratory Research in Environmental Engineering CEE 453 
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 9.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1 Introduction to Object-Oriented Programming.
CSE 115 / 503 Introduction to Computer Science I
Middle School Grades 6-8 Creating Calendars in Publisher.
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
Presented by Karen Porter UM School of Business Administration & ImpactOnlineMarketing.com Integrated Online Marketing: BMKT 420 – Course Overview.
Tonga Institute of Higher Education IT 141: Information Systems CS Students Lecture 2: Microsoft Word.
CS110/CS119 Introduction to Computing (Java)
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
Sign Up for an eFolio Account & Take the Tour In this session new users will create their account, select a design and become familiar with what is in.
INTRODUCTION TO FRONTPAGE. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features Features  Starting Front Page Starting Front Page  Components.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
BCS 2143 Introduction to Object Oriented and Software Development.
BIT 115: Introduction To Programming1 Sit in front of a computer Log in –Username: 230class –password: –domain: student Bring up the course web.
Java Language and SW Dev’t
ISP 1600 for Fall 2007 Web.Edu: How Internet Courses Work Fifth meeting October 7, 2007
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
CMPUT 412 Experimental Mobile Robotics Csaba Szepesvári University of Alberta.
PHYSICS 1P03 Introductory Mechanics Me: Dr. W. Okoń Office: ABB Office Hours: 4-5 pm 4-5 pm.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
1) What are the 2 rules for adding integers? Find the sum.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session October 2008.
CSE 1105 Week 1 CSE 1105 Course Title: Introduction to Computer Science & Engineering Classroom Lecture Times: Section 001 W 4:00 – 4:50, 202 NH Section.
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
ISP 1600 for Fall 2005 Web.Edu: How Internet Courses Work Fifth meeting October 8, 2005
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session October 2008.
Administrative Information SC/CSE SU10 -- Software Design.
BIT 143: Programming-Data Structures1 Before Class Begins: Sit in front of a computer Log in –IF you don’t yet have an account, you can use the guest account.
CS110 Introduction to Programming Lecture 1 January 27, 2004 Ethan Bolker Philosophy Bank: user interface, Java, object model Programming environment Homework.
1 Welcome Alireza Humber College Lecture 1 Game 540 Alireza
CSC 231: Introduction to Data Structures Python and Objects – Day 3 Dr. Curry Guinn.
Computer Science A-level
Object Oriented Programming
CIS 518 Teaching Effectively-- snaptutorial.com
Mr. Smith’s Schedule 1st Period Computer Science I
Einführung in die Programmierung Introduction to Programming Prof. Dr
CS 0007 Spring Lory Al Moakar.
Computer Science A-level
Lecturer: Geoff Hulten TAs: Alon Milchgrub, Andrew Wei
Presentation transcript:

Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session 2 23 September 2008

Chair of Software Engineering 2 Organizational  Assignments  One assignment per week  Will be put online on Friday (download it from the web site) ‏  Will be due on Thursday the next week  (Assignment 1 was an exception) ‏  Asking questions  Exercise sessions  /come to my office  Group mailing list  Is everybody subscribed?

Chair of Software Engineering 3 Today Purpose of the exercise session:  Give you the intuition behind object-oriented (OO) programming  Teach you about formatting your code  Get rolling with EiffelStudio & Traffic (Assignment 1)

Chair of Software Engineering Objects and classes  Classes are pieces of software code  One or several classes can make up a program  Objects are instances of classes  Classes define operations applicable to their instances Example: A class STUDENT can define operations applicable to all its instances, such as subscribing to a course, registering for an exam, etc. This means that all class STUDENT’s instances (such as the students Bob, Mike, Steve, etc.) will be able to subscribe themselves to a course, to register for an exam, etc.  Only operations defined in a class can be applied to its instances

Chair of Software Engineering 5 Calling a feature on an object (1)  next_message  send  computer  shut_down  telephone  ring Every operation applies to an object and may take arguments

Chair of Software Engineering 6 Calling a feature on an object (2)  next_message  send_to (recipient) ‏  computer  shut_down_after (3) ‏  telephone  ring_several (10, Loud) ‏ Every operation applies to an object and may take arguments

Chair of Software Engineering 7 Exercise: class BANK_ACCOUNT  Class BANK_ACCOUNT defines and implements the following operations:  deposit (i: INTEGER)  withdraw (i: INTEGER)  close  If b: BANK_ACCOUNT (b is an instance of class BANK_ACCOUNT) which of the following feature calls are possible:  b.deposit (10)  b.deposit  b.close  b.close (“Now”)  b.open  b.withdraw (100.50)  b.withdraw (0) Hands-On

Chair of Software Engineering 8 class PREVIEW inherit TOURISM feature explore is -- Show city info and route. do “To be filled in (by you!)” end A class text Softwar e machine Extend an existing class Operations Featur e name Commen t Keywords have a special meaning: class, inherit, feature, is, do, end. Feature declaratio n Pseudocod e

Chair of Software Engineering 9 Da style rules!  For indentation, use tabs, not spaces  Use this property to highlight the structure of the program, particularly through indentation CLASS NAMES: ALL UPPERCASE Period in feature call: no space before or after

Chair of Software Engineering 10 Exercise: format class bank_account feature deposit (sum: INTEGER) is -- Add `sum' to the account. do balance := balance + sum end balance: INTEGER end Hands-On

Chair of Software Engineering 11 Solution: format class BANK_ACCOUNT feature deposit (sum: INTEGER) is -- Add `sum' to the account. do balance := balance + sum end balance: INTEGER end Hands-On

Chair of Software Engineering Assignment 1 Take the remaining time to work on Assignment 1. Try to solve the tasks on your own. Ask me if you have any problems. (We’ll have such a session every week for each assignment.)