Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to programming

Similar presentations


Presentation on theme: "Introduction to programming"— Presentation transcript:

1 Introduction to programming
ICS2O Mr. Lane

2 agenda We will learn What is a Program What is a programming language
The difference between source code and machine code The difference between an interpreter and a compiler The Turing integrated development environment (IDE)

3 Which Specimen is Most Like a Program?
Buy cookie dough Lay out cookie dough on tray in 5 cm diameter circular goodness Preheat oven to 425 degrees Fahrenheit Place cookie tray with cookies in oven for 15 minutes Remove tray and proceed with gluttony Specimen 1: How to be a Glutton Specimen 2: Binary

4 A plan that lays out actions to achieve a goal
A Program Is… A plan that lays out actions to achieve a goal

5 Why Was “How to be a Glutton” More Like a Program than the “Binary”?
It was recipe for how to be a glutton It gave step-by-step actions starting from the beginning to the end After finishing the program you achieve the desired goal: being a glutton The binary was just a bunch of numbers, not a real program

6 Let’s Try it out! Objective: What do we notice from this activity?
To put on a jacket What do we notice from this activity? Clearly stating the steps to achieve a task is not easy We cannot make any assumptions

7 What is a Programming Language?
A language that tells machines/computers how to perform computations They can be used to control machines by defining the machine’s behaviour

8 Source Code What is source code? This is the code that you write
It usually looks like English words Example put “Hello World!” Source code, like any language, follows a set of grammatical rules. In programming we call this set of rules the syntax. Breaking these rules will cause the program to not function. Like writing a poorly structured sentence.

9 Source code example What is it like? Why is this like source code?
Telling someone in English to stop talking Why is this like source code? We are giving instructions to do something We are not physically doing the instructions The instructions must be translated into physical actions

10 Source code example Telling someone in English to stop talking
We don’t Tell them that they have to close their mouth Tell them how to stop moving muscles, etc Their brain should Translate the English words into meaning That meaning should translate into brain signals going to muscles in mouth to stop moving, stop making sounds from throat, etc.

11 Source code Source code is meant to be read by people
Easy to understand for computer scientists, and mostly understandable to non-techies Source code itself cannot be run as a program by the computer It must be translated into machine code Why do we have source code? The alternative is machine code

12 Machine code What is machine code?
This is the code that the machine uses It is just binary (0, 1)

13 Machine code Different processors understand different assembly instructions Most personal computers use x86 instructions New AMD processors also use AMD-64 New Intel processors also use IA-64 PlayStation3, Xbox 360, Wii, DS all use different assembly instructions That is why a Wii game doesn’t work on Xbox 360 That is why a PS3 game doesn’t work on Xbox 360 So how are some games released on multiple consoles?

14 Machine code What is it like? It is not like:
The signals that your brain sends to your body to do something Brain goes through memory to find the meaning of “stop talking” It keeps on repeating the process until it finds it and then acts on the meaning It is not like: A vague description of what to do…it is exact Down to the bits of memory to use

15 Source vs machine code The source code that you write gets converted into machine code The source code The machine code put “Hello World!” “Magic”

16 What is this “magic” There are two types of programs that can be used to convert source code to machine code The “magic” 1) Compilers A software program (or programs) that takes your entire source code file(s) and converts it to machine code all at once It results in files that can be converted into executable (exe) files that you run

17 Is there other “magic” 2) Interpreters
A software program (or programs) that takes your source code file and converts it to machine code one line at a time You need to run your program inside of another program E.g., most Visual Basic code must be run from inside of the Visual Basic integrated development environment (IDE)

18 Compilers vs interpreters
Advantages of Compilers (over Interpreters) Advantages of Interpreters (over Compilers) The program runs faster You only need to compile it one time after you are finished Users do not need to install the code interpreter on their machine (try running your old interpreted Basic projects on someone’s computer) Programs start faster since they only need to look at one line at a time (no need to compile the entire program first then run) Finding errors is easy because you know exactly which line caused the error Turing is a compiled language


Download ppt "Introduction to programming"

Similar presentations


Ads by Google