computer programming i an introduction to the art and science of programming with c++

15
Computer Programming I An Introduction to the art and science of programming with C++

Upload: brook-washington

Post on 30-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Programming I An Introduction to the art and science of programming with C++

Computer Programming I

An Introduction to the art and science of programming with C++

Page 2: Computer Programming I An Introduction to the art and science of programming with C++

Some thoughts on Programming

1. The Human Race does not yet know how to program.

2. When the failures occur, (and they occur 75% of the time!) they occur because of a failure to control complexity.

3. Programming is both an art and a science. 4. Most software projects fail. The odds of failure

rise sharply with how hard it is for one person to keep track of what is going on. The more people you have, and the longer it is expected to take, the worse your odds are.

Page 3: Computer Programming I An Introduction to the art and science of programming with C++

Some thoughts on Programming

5 When we start a project we inevitably do not know as much as we will learn. Therefore we will make decisions that in hindsight would be better being changed. Plan ahead.

6 In software more than any other field, it is absolutely madness to assume.

7 That which is not automated does not reliably happen.

8 Expect the worst - don't always think that the user's input will be nice, clean, and tidy.

Page 4: Computer Programming I An Introduction to the art and science of programming with C++

Some thoughts on Programming

9 Programming is about finding patterns.

10 If debugging is the process of removing bugs, then programming must be the process of putting them in.

Page 5: Computer Programming I An Introduction to the art and science of programming with C++

Programming Languages

• What is a programming language?

• Compiled vs. Interpreted

• High-Level vs. Low-Level Programming languages

• Binary Code

• Assembly Language

• C

Page 6: Computer Programming I An Introduction to the art and science of programming with C++

Programming Languages

• C++

• Java

Other Languages?

Page 7: Computer Programming I An Introduction to the art and science of programming with C++

Tools of the trade

• Text Editor

• Source Control System

• Compiler

• Linker (for some languages)

• Interpreter (for some languages)

• Runtime systems (for some languages)

Page 8: Computer Programming I An Introduction to the art and science of programming with C++

The Role of Abstraction in Programming

• The computer knows only 1’s and 0’s• This is a lie.• The computer doesn’t even know what a 1 or 0 is• The computer has transistors that can have one of

two voltages.• At bottom, all software comes down to

occurrences of those two voltages. There is nothing else.

Page 9: Computer Programming I An Introduction to the art and science of programming with C++

The Role of Abstraction in Programming

• So if a computer doesn’t understand a 1 or 0, it certainly doesn’t understand its processors instructions, that is to say assembly language. It needs a program called an assembler to turn it into binary code.

• Similarly, a computer doesn’t understand C code. It needs a compiler to compile it to assembly code or directly to binary code.

• Moving up in abstraction from C brings us to C++

Page 10: Computer Programming I An Introduction to the art and science of programming with C++

C++

Bjarne Stroustrup Bjarne Stroustrup created C++ in 1985

C++ is a general purpose programming language with a bias towards systems programming that:

• is a better C • supports data abstraction • supports object-oriented programming • supports generic programming.

Page 11: Computer Programming I An Introduction to the art and science of programming with C++

C++ - What is object oriented programming

• Procedural Programming

• Object Oriented

• Functional Programming

Page 12: Computer Programming I An Introduction to the art and science of programming with C++

Roles for Programmers

• Code Designer

• Code Writer – (programmer, developer) Code Tester

Writing large, complex software requires many people working together

Page 13: Computer Programming I An Introduction to the art and science of programming with C++

Code

• This course concentrate on the role of writing code. Churning out correct, maintainable, flexible, clean, fast code.

• Correct – above all, the code must do what you want it to do

• Time passes, things change, and code needs to be modified. Your code has to be written in a way that it will be easily modifiable

Page 14: Computer Programming I An Introduction to the art and science of programming with C++

Code

• So your code needs to be modifiable.• To be modifiable, code needs to be flexible and

maintainable.• To be flexible and maintainable, code needs to be

clean and clear.• Finally, a program needs to run as fast as it needs

to run. This depends very much on the type of application

Page 15: Computer Programming I An Introduction to the art and science of programming with C++

Next Week

Beginning to write C++ code