computer programming i an introduction to the art and science of programming with c++
TRANSCRIPT
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.
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.
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.
Programming Languages
• What is a programming language?
• Compiled vs. Interpreted
• High-Level vs. Low-Level Programming languages
• Binary Code
• Assembly Language
• C
Programming Languages
• C++
• Java
Other Languages?
Tools of the trade
• Text Editor
• Source Control System
• Compiler
• Linker (for some languages)
• Interpreter (for some languages)
• Runtime systems (for some languages)
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.
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++
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.
C++ - What is object oriented programming
• Procedural Programming
• Object Oriented
• Functional Programming
Roles for Programmers
• Code Designer
• Code Writer – (programmer, developer) Code Tester
Writing large, complex software requires many people working together
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
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
Next Week
Beginning to write C++ code