20
CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Embed Size (px)

Citation preview

Page 1: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

CompSci 105 SS 2005

Principles of Computer Science

Lecture 4

Lecturer: Santokh Singh

Page 2: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Parity

Abstraction

Modular Design

Procedural Abstraction

Data Abstraction

Abstract Data Types

Information Hiding

Software Life Cycle

Basic Stages

Specification and Design

Verification via Loop Invariants

Costs Associated with Software

Page 3: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Hacking

• Type in a heap of code

Page 4: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Hacking

• Type in a heap of code

• Battle compilation errors

Page 5: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Hacking

• Type in a heap of code

• Battle compilation errors

• Run the code

Page 6: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Hacking

• Type in a heap of code

• Battle compilation errors

• Run the code

• If doesn’t work, change a random thing

Page 7: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Software Engineering

• Large Projects

• Team Development

• Guaranteed Results

• Easy Modification

Page 8: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Abstractions

ComplexObject

IdealisedModel

IgnoreInessential

Details

Page 9: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Class Reps

Name login

First meeting today/tomorrow (..) ..time

Place (CompSci …)

Page 10: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Parity

Abstraction

Modular Design

Procedural Abstraction

Data Abstraction

Abstract Data Types

Information Hiding

Software Life Cycle

Basic Stages

Specification and Design

Verification via Loop Invariants

Costs Associated with Software

Page 11: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Modular (Class) Design

System

SecretCodes

String

Random

Page 12: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Procedural (Method) Design

Encode

SecretCodes

Main

Decode

Page 13: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Information Hiding

Program that uses the String

Class

Implementation of the

String Class

API for the

String Class

Page 14: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Data Abstraction

int x = 14;

1110

14

Page 15: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Software Life Cycle

Specification

Design

Verify

Code

Test

Refine

Produce

Maintain

Page 16: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Software Life Cycle

Specification

Design

Verify

Code

Test

Refine

Produce

Maintain

Page 17: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Agreeing on a method

• Suppose we want a method that adds two integers

uses the add method

implements the add method

Page 18: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

What needs to be specified?

• Suppose we want a method that adds two integers

public int add ( int x, int y )

Page 19: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

What needs to be specified?

• Suppose we want a method that adds two integers

// General Description:// Precondition: // Postcondition: public int add ( int x, int y )

Page 20: CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh

Course Book

We have been referring to the Course Book during lectures:-

• Pages 62 - 64: Numbers in the Computer

• Pages 65 - 92: Data Representations

Please attend ALL classes for better understanding & for your own good.