1 Bertrand Meyer About me 7 8 At ETH for four years In industry - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 Bertrand Meyer About me 7 8 At ETH for four years In industry - - PDF document

German version of lecture slides 1 2 Folien fr diese und alle weiteren Vorlesungseinheiten werden von nun an auch in Deutsch verfgbar sein. Introduction to Programming Sie knnen die deutschen Folien auf der Webseite der Vorlesung


slide-1
SLIDE 1

1

I ntro – Lecture 1 1 Chair of Softw are Engineering

Introduction to Programming

Bertrand Meyer

ETH Zurich, October 2005– February 2006

I ntro – Lecture 1 2 Chair of Softw are Engineering

German version of lecture slides

Folien für diese und alle weiteren Vorlesungseinheiten werden von nun an auch in Deutsch verfügbar sein. Sie können die deutschen Folien auf der Webseite der Vorlesung finden.

I ntro – Lecture 1 3 Chair of Softw are Engineering

Language

Das war die erste deutsche Folie dieser Vorlesung. Das ist die letzte deutsche Folie dieser Vorlesung.

I ntro – Lecture 1 4 Chair of Softw are Engineering

Choose your language

Exercise sessions (Übungsgruppen) are available in German (5) and English (3). Choose an exercise session (i.e. an assistant) in your preferred language. Languages spoken by assistants: German (several varieties), English, French, some Italian.

I ntro – Lecture 1 5 Chair of Softw are Engineering

Goals of the course

After successfully taking this course, you will: Know the key concepts of programming. Understand basic hardware and software tools. Master your first programming language: Eiffel. Know basic concepts of design, implementation and maintenance of large software systems (“software engineering”).

I ntro – Lecture 1 6 Chair of Softw are Engineering

Teaching staff & Practical information

slide-2
SLIDE 2

2

I ntro – Lecture 1 7 Chair of Softw are Engineering

Bertrand Meyer

E-mail: Bertrand.Meyer@inf.ethz.ch Office: RZ J22 Secretary: Claudia Günthart, 044 632 83 46 Office: RZ J7

I ntro – Lecture 1 8 Chair of Softw are Engineering

About me

At ETH for four years In industry for most of my career Founded Eiffel Software in Santa Barbara, California, in 1985. Still “Chief Architect” of the company. Published a number of books, in particular Object- Oriented Software Construction (2nd edition: 1997) Plan: help the industry build the best software possible

I ntro – Lecture 1 9 Chair of Softw are Engineering

Schedule

Lectures: Monday, 13:00 – 15:00, HG E7 Tuesday, 8:00 – 10:00, HG F1 Exercise sessions: Monday, 15:00 – 16:00, various rooms Tuesday, 13:00 – 15:00, various rooms

  • r (for one group)

Monday, 14:00 – 15:00, IFW B42 Wednesday, 14:00 – 16:00, HG E1.1

I ntro – Lecture 1 10 Chair of Softw are Engineering

Choosing an exercise group

Registration lists are available during the break. Choose your group according to Preferred language Your schedule constraints Availability We may have to reassign students to a different group to keep the numbers balanced The first exercise session takes place this afternoon!

I ntro – Lecture 1 11 Chair of Softw are Engineering

Lab Sessions

(Optional) Lab Sessions Fridays 12:00 – 14:00 IFW D31 If you need Help (Programming etc.) 2 assistants will be in the lab to answer your questions

I ntro – Lecture 1 12 Chair of Softw are Engineering

The assistants

Stephanie Balzer Ilinca Ciupa Raphael Mack Michela Pedroni Ursina Caluori Andreas Leitner Piotr Nienaltowski Sebastien Vaucouleur

slide-3
SLIDE 3

3

I ntro – Lecture 1 13 Chair of Softw are Engineering

Stephanie Balzer

  • E-mail: Stephanie.Balzer@inf.ethz.ch
  • Language: German
  • Office: RZ J9
  • Phone: 044 632 02 80
  • Rooms:

Monday: ML J37.1 (15:00 – 16:00) Tuesday: ETZ E9 (13:00 – 15:00)

Mailing list: lovelace@se.inf.ethz.ch

I ntro – Lecture 1 14 Chair of Softw are Engineering

Ursina Caluori

  • E-mail: ucaluori@student.ethz.ch
  • Language: German
  • Rooms:

Tuesday: IFW B42 (14:00 – 15:00) Wednesday: HG E1.1 (14:00 – 16:00)

Mailing list: goldberg@se.inf.ethz.ch

I ntro – Lecture 1 15 Chair of Softw are Engineering

Ilinca Ciupa

  • E-mail: Ilinca.Ciupa@inf.ethz.ch
  • Office: RZ J4
  • Phone: 044 632 44 49
  • Language: English
  • Room:

Monday: IFW A32.1(15:00 – 16:00) Tuesday: ETZ K91 (13:00 – 15:00)

Mailing list: nygaard@se.inf.ethz.ch

I ntro – Lecture 1 16 Chair of Softw are Engineering

Andreas Leitner

  • E-mail: Andreas.Leitner@inf.ethz.ch
  • Language: German
  • Office: RZ J4
  • Phone: 044 632 30 21
  • Rooms:

Monday: IFW A 36 (15:00 – 16:00) Tuesday: LEC C14 (13:00 – 15:00)

Mailing list: knuth@se.inf.ethz.ch

I ntro – Lecture 1 17 Chair of Softw are Engineering

Raphael Mack

  • E-mail: rmack@student.ethz.ch
  • Language: German
  • Rooms:

Monday: ML H37.1 (15:00 – 16:00) Tuesday: LFW C5 (13:00 – 15:00)

Mailing list: torvalds@se.inf.ethz.ch

I ntro – Lecture 1 18 Chair of Softw are Engineering

Piotr Nienaltowski

  • E-mail: Piotr.Nienaltowski@inf.ethz.ch
  • Language: English
  • Office: RZ J3
  • Phone: 044 632 44 68
  • Rooms:

Monday: ML H34.3 (15:00 – 16:00) Tuesday: HG F3 (13:00 – 15:00)

Mailing list: dijkstra@se.inf.ethz.ch

slide-4
SLIDE 4

4

I ntro – Lecture 1 19 Chair of Softw are Engineering

Michela Pedroni

  • E-mail: Michela.Pedroni@inf.ethz.ch
  • Office: RZ J8
  • Phone: 044 632 76 84
  • Language: German
  • Rooms:

Monday: ML J43.1 (15:00 – 16:00) Tuesday: HG F5 (13:00 – 15:00)

Mailing list: liskov@se.inf.ethz.ch

I ntro – Lecture 1 20 Chair of Softw are Engineering

Sebastien Vaucouleur

  • E-mail: Sebastien.Vaucouleur@inf.ethz.ch
  • Office: RZ J3
  • Phone: 044 632 74 09
  • Language: English
  • Rooms:

Monday: ML F39 (15:00 – 16:00) Tuesday: LEC C18 (13:00 – 15:00)

Mailing list: wirth@se.inf.ethz.ch

I ntro – Lecture 1 21 Chair of Softw are Engineering
  • Course page:

http://se.inf.ethz.ch/teaching/ws2005/0001/index.html Check it at least twice a week English version available, but German more up to date

  • Lecture material:

Lecture slides Textbook: Touch of Class (draft) Available electronically from course page

  • Exercise material:

Exercise sheets Master solutions

Video recording of lectures!

Your most important URL for next 4 months

I ntro – Lecture 1 22 Chair of Softw are Engineering

The textbook (in progress)

I ntro – Lecture 1 23 Chair of Softw are Engineering

Electronic forums

Discussion forums:

  • Help forum for the whole course:

http://forum.vis.ethz.ch/

  • Mailing list for each group

Advice and rules:

  • Use the forums and mailing lists! Learning to program is hard: take

advantage of every help you can get.

  • Don’t be shy. There are no stupid questions.
  • Criticism welcome, but always be polite to every participant and
  • bserve the etiquette.

To email the whole teaching team (professor and assistants): eprog-assi@se.inf.ethz.ch

I ntro – Lecture 1 24 Chair of Softw are Engineering

If you need a laptop…

ETH has really good prices NEPTUN program Several brands You choose your OS: Windows, Linux, MacOS Limited time only: see http://www.neptun.ethz.ch

slide-5
SLIDE 5

5

I ntro – Lecture 1 25 Chair of Softw are Engineering

Exercises, “Testat” regulations

  • “Testat”: Needed for admittance to fall exam.
  • Exercises:

7 weekly assignments 3 classroom exercises 1 project exercise

  • To get the “Testat” you need to have done at least:

5 weekly assignments 2 classroom exercises 1 project exercise Must show serious effort to address the questions Must have filled out questionnaire

  • Military services or illness contact your assistant.
I ntro – Lecture 1 26 Chair of Softw are Engineering

The software

The exercises rely on the TRAFFIC and Flat Hunt software Application domain: Transportation system in a city EiffelStudio download: http://www.eiffel.com/downloads/

I ntro – Lecture 1 27 Chair of Softw are Engineering

You’ll discover Flat Hunt

I ntro – Lecture 1 28 Chair of Softw are Engineering

Behind the software

Patrick Schoenbach Michela Pedroni Till Bay (EiffelMedia library) Numerous ETH students including Marcel Kessler, Sibylle Aregger, Rolf Bruderer, Ursina Caluori, Roger Küng…

I ntro – Lecture 1 29 Chair of Softw are Engineering

Warning

Not everything will be perfect from our side. The software (TRAFFIC, Flat Hunt) probably has mistakes (“bugs”), and the textbook too. BUT: We will correct our mistakes, as quickly as we can. If you try something, don’t blame the software first. It may be doing just what you told it to.

I ntro – Lecture 1 30 Chair of Softw are Engineering

Why this approach?

Many software issues become really tough for big systems With other approaches, in an introductory course, you’ll only see small programs We give you a considerable amount of existing software; you can use it as model and inspiration You learn to use software through abstract interfaces (also known as contracts) You go from consumer to producer: outside-in TRAFFIC and Flat Hunt are graphical and fun! You should at the end be able to understand all! Then you can participate too!

slide-6
SLIDE 6

6

I ntro – Lecture 1 31 Chair of Softw are Engineering

Topics

What is software? Objects and programs Interfaces and the notion of class Logic and contracts The run-time model:

  • bject creation,

references Describing syntax Control structures Inheritance Genericity Recursive reasoning and recursive programming Container data structures Event-driven programming & agents Topological sort Introduction to software engineering

I ntro – Lecture 1 32 Chair of Softw are Engineering

The basic advice

Attend all lectures Read material (when available) before lecture Attend all exercise sessions Do all exercises & the project (you’ll need them for the “Testat”) If you don’t understand, ask (again: there are no stupid questions) If you have already programmed, take advantage of it, but take a fresh look at the material; explore the TRAFFIC and Flat Hunt software If you are new to programming, don’t panic, it can be tough at the beginning

I ntro – Lecture 1 33 Chair of Softw are Engineering

Lecture 1: The industry of pure ideas

I ntro – Lecture 1 34 Chair of Softw are Engineering

Software engineers build machines

You can’t touch, kick or drop our machines: they’re immaterial But they are machines anyway We call them programs or systems To operate (or run or execute) a program you need a physical machine: a computer Computers and related devices: hardware Programs and associated intellectual value: software

I ntro – Lecture 1 35 Chair of Softw are Engineering

Software everywhere

Banking: manage millions of account Trading: decide to sell or buy Transportation: control trains, track planes... Today’s cars have millions of lines of program code Travel: air, train, hotel reservations Communication: phones, Internet, … Government: manage taxes, track laws... Health care: keep health record, control devices Education Entertainment Information etc.

I ntro – Lecture 1 36 Chair of Softw are Engineering

Computers

Computers are universal machines. They execute the program that you feed them The only limit is your imagination The good news: Your computer will do exactly what your program says

slide-7
SLIDE 7

7

I ntro – Lecture 1 37 Chair of Softw are Engineering

Working with a computer

Programmer: writes programs User: runs programs

Program Program

A programmer writes a a user which runs on a com puter

I ntro – Lecture 1 38 Chair of Softw are Engineering

Working with a computer

Program Program

A programmer writes a a user which runs on a com puter using a com puter

I ntro – Lecture 1 39 Chair of Softw are Engineering

Working with a computer

Program Program

A programmer writes a users which their com puters using a com puter run on

I ntro – Lecture 1 40 Chair of Softw are Engineering

Working with a computer

Program Program

Programmers write a users which their com puters using a com puter run on

I ntro – Lecture 1 41 Chair of Softw are Engineering

Computers

  • Computers are universal machines. They execute the program that

you feed them.

  • The only limit is your imagination.
  • The good news:

Your computer will do exactly what your program says. It will do it very fast.

I ntro – Lecture 1 42 Chair of Softw are Engineering

Moore’s “Law”

  • Approximate doubling of computer power, for comparable price,

every eighteen months

2000 1 MHz 10 MHz 1 GHz 100 MHz 1990 1980 1970 8008: < 1 MHz 80386: 33 MHz 80486: 50 MHz Pentium: 133 MHz Pentium IV: 1.3 GHz to 1 GHz: 26 years from 1 to 2 GHz: 8 months Speed of Intel processors (1 Hertz = 1 clock cycle per second) 3.8 GHz

slide-8
SLIDE 8

8

I ntro – Lecture 1 43 Chair of Softw are Engineering

Common myths and excuses

“Computers are intelligent” Fact: Computers are neither intelligent nor

  • stupid. They execute programs devised by
  • humans. These programs reflect the intelligence
  • f their authors.

The basic computer operations are extremely elementary (store this value, add these two numbers). “The computer has crashed” “The computer doesn’t allow this” “The computer lost your record” “The computer messed up your record”

I ntro – Lecture 1 44 Chair of Softw are Engineering

Computers don’t make mistakes * ....

Programs don’t make mistakes either Programmers do make mistakes *Actually, hardware can malfunction, but this is much more rare than

program errors

I ntro – Lecture 1 45 Chair of Softw are Engineering

Computers

  • Computers are universal machines. They execute the program that

you feed them

  • The only limit is your imagination and your carefulness
  • The good news:

Your computer will do exactly what your program says It will do it very fast

  • The bad news:

Your computer will do exactly what your program says It will do it very fast

I ntro – Lecture 1 46 Chair of Softw are Engineering

Writing software is tough

Programs “crash” Programs that don’t crash don’t necessarily work Badly functioning programs have killed people, e.g. in medical devices Ariane 5 rocket, 1996: $10 billion lost because of a simple program error Programmers are responsible for the good functioning

  • f their programs

The purpose of this course is to teach you not just programming but good programming

I ntro – Lecture 1 47 Chair of Softw are Engineering

The “Blue Screen Of Death”

I ntro – Lecture 1 48 Chair of Softw are Engineering

Learning to program well

slide-9
SLIDE 9

9

I ntro – Lecture 1 49 Chair of Softw are Engineering

What computers do

  • Storage and retrieval
  • Operations
  • Communication
  • Storage and retrieval memories
  • Operations processors
  • Communication communication devices

Memories, processors and communication devices are the hardware.

Rest of the world Rest of the world Processors Memories Communication devices

I ntro – Lecture 1 50 Chair of Softw are Engineering

General organization

Rest of the world Rest of the world Processors Memories Communication devices “Core” memory, disks... “Persistent” or not Keyboard, mouse, video display, network connector... Also “CPU”

I ntro – Lecture 1 51 Chair of Softw are Engineering

Information and data

Information is what you want, e.g. a text or music Data is how it is encoded for the computer, e.g. MP3 audio format

  • Data: collections of symbols held in a computer
  • Information: interpretation of data for human

purposes

I ntro – Lecture 1 52 Chair of Softw are Engineering

Information and data processing

Data is stored in memory Input devices produce data from information Output devices produce information from data

Information Information Data Data Data Data Data I nput Output Process

Computer

I ntro – Lecture 1 53 Chair of Softw are Engineering

Computers come in all sizes, colors, flavors

I ntro – Lecture 1 54 Chair of Softw are Engineering

Computers everywhere

Banks Airplanes, cars… Washing machines Cell phones (70% of value) Printers Tomorrow: your shirt…

slide-10
SLIDE 10

10

I ntro – Lecture 1 55 Chair of Softw are Engineering

Computers

  • Computers are universal machines. They execute the program that

you feed them.

Program (Universal machine) + = Specialized machine

I ntro – Lecture 1 56 Chair of Softw are Engineering

Where’s the program?

  • Stored-program computer: the program is in memory. “Executable

data”.

  • The computer, with the help of some basic programs (operating

system) knows how to find your program in memory to execute it.

  • A program can appear in memory in different forms:

Source: human-readable form (programming language). Target form, machine code, object form: form executable by the computer. Compilers transform source text to machine code.

I ntro – Lecture 1 57 Chair of Softw are Engineering

Software Engineering

Writing software that’s Correct Does what it’s supposed to! Extendible Easy to change! Readable by humans! Reusable Don’t reinvent the wheel! Robust React appropriately to errors

I ntro – Lecture 1 58 Chair of Softw are Engineering

Size of operating systems (source)

1990

1992

1995 1998 2000 2 10 20 40 30 Lines of code (millions) Windows 3.1: 3 M Windows NT: 4 M Windows 95: 15 M Windows 98: 18 M Windows 2000: 40 M Red Hat 6.2 17 M Red Hat 7.1 30 M Linux: 10,000 Solaris 7: 12 M Unix V7: 10,000 Windows XP: > 45 M

I ntro – Lecture 1 59 Chair of Softw are Engineering

In other application areas

(source: Siemens)

I ntro – Lecture 1 60 Chair of Softw are Engineering

Writing software is tough

Programs crash, etc.

slide-11
SLIDE 11

11

I ntro – Lecture 1 61 Chair of Softw are Engineering

Topics covered

  • Objects
  • Interface of a Class
  • Invariants and Logic
  • Assignment, references
  • Control Structures
  • BNF
  • Dynamic Model
  • Inheritance
  • Recursion
  • Data Structures
  • Event-Driven Programming
  • Topological Sort
  • Testing
I ntro – Lecture 1 62 Chair of Softw are Engineering

Writing software is fun

Design and build your own machines Exert your creativity and imagination Programs save lives and help make the world better Experience the feeling of a program that you wrote, and that works

I ntro – Lecture 1 63 Chair of Softw are Engineering

For next week

Read chapter 1 of Touch of Class Recommended: start reading chapter 2 and slides for next lecture

I ntro – Lecture 1 64 Chair of Softw are Engineering

End lecture 1