Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.

Slides:



Advertisements
Similar presentations
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Advertisements

INTRODUCTION Chapter 1 1. Java CPSC 1100 University of Tennessee at Chattanooga 2  Difference between Visual Logic & Java  Lots  Visual Logic Flowcharts.
PSEUDOCODE & FLOW CHART
Introduction to a Programming Environment
Lesson 3 Variables – How our Brains Work - Variables in Python.
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
An ordered sequence of unambiguous and well-defined instructions that performs some task and halts in finite time Let's examine the four parts of this.
UNIT - 1Topic - 3. Computer software is a program that tells a computer what to do. Computer software, or just software, is any set of machine-readable.
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
Software Development. Software Development Loop Design  Programmers need a solid foundation before they start coding anything  Understand the task.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Algorithms and Pseudocode
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
All materials copyright UMBC unless otherwise noted CMSC201 Computer Science I for Majors Lecture 02 – Algorithmic Thinking.
Chapter 1 Introduction 2nd Semester H
Software Development Environment
Software Development.
Understand Problem Solving Tools to Design Programming Solutions
CMSC201 Computer Science I for Majors Lecture 02 – Algorithmic Thinking Prof. Katherine Gibson Based on slides by Shawn Lupoli and Max Morawski at UMBC.
Chapter 10 Programming Fundamentals with JavaScript
Topic: Introduction to Computing Science and Programming + Algorithm
Basics of Computer Programming
CSCI-235 Micro-Computer Applications
Computer Programming.
ALGORITHMS part-1.
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
ALGORITHMS AND FLOWCHARTS
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Understand Problem Solving Tools to Design Programming Solutions
Basics of Computer Programming
Basics of Computer Programming
Introduction to Computer Programming
Basics of Computer Programming
CS 240 – Lecture 11 Pseudocode.
Lesson 1 Introduction – Computing - Binary – Programming Basics.
Lesson 1 Introduction – Computing - Binary – Programming Basics.
Chapter 1: Introduction to Computers and Programming
Print slides for students reference
IPC144 Introduction to Programming Using C Week 2 – Lesson 1
Chapter 10 Programming Fundamentals with JavaScript
Unit# 9: Computer Program Development
Creativity in Algorithms
(Course Introduction)
Language Basics.
Introduction to Algorithms
Introduction to Algorithms and Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
Chapter 2- Visual Basic Schneider
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Introduction to programming
ICT Gaming Lesson 2.
Tonga Institute of Higher Education IT 141: Information Systems
An Introduction to Programming with C++ Fifth Edition
Tonga Institute of Higher Education IT 141: Information Systems
Computers, Programs, and Programming Languages
Chapter 2 – part a Brent M. Dingle Texas A&M University
Basic Concepts of Algorithm
CMPT 120 Lecture 3 - Introduction to Computing Science – Programming language, Variables, Strings, Lists and Modules.
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro

COMPUTER SCIENCE Lesson 2 So what is Programming? How do our Brains work – an analysis of what we do automatically! Algorithms as sequences of instructions Introducing the 3 main programming constructs Using the SEQUENCE and SELECTION (IF) programming constructs Using Scratch to program using Sequence and IF Scratch Task

At the end You should know ... What is Programming? What is an Algorithm? What are the three programming constructs!? SEQUENCE SELECTION ITERATION Using scratch to create simple programs and use programming principles How have you used TWO of the THREE constructs (SEQUENCE AND SELECTION (IF STATEMENTS) today? The use of a Variable in Scratch

Introduction to Programming

Human cells contain DNA – Have you heard of the term the GENETIC CODE?!

Remember Binary = Base 2 Decimal = Base 10 Quite mysteriously – the genetic CODE is just that – a CODE – a type of programming language that we find inside our cells. Can you guess what BASE it is?!?

Remember Binary = Base 2 Decimal = Base 10 GENETIC CODE = 4 BASES! Can you guess what BASE it is?!? A T U G Our genes consist of various sequential combinations!!!

You can think of the genetic code as a language You can think of the genetic code as a language. Each group of three bases or 'letters' forms a 'word' called a codon. Each codon specifies one amino acid, and proteins are made from long chains of amino acids. There are also codons that mark the start and end of the gene. Inspired? Well read more on the GENETIC CODE and you’ll probably find out more in BIOLOGY

So what is Computer Programming? The process of developing and implementing various sets of instructions to enable a computer to do a certain task. These instructions are considered computer programs and help the computer to operate smoothly. The language used to program computers is not understood by an untrained eye. Computer programming continues to be a necessary process as the Internet continues to expand. more: http://www.businessdictionary.com/definition/computer-programming.html#ixzz1jFC1Lf99

What is a Computer Program A computer program (also software, or just a program) is a sequence of instructions written to perform a specified task with a computer. FYI A Computer Virus = is just a nasty little computer program (a bit of a code that does something BAD!)

A computer programmer basically thinks about and then types loads of clever instructions to CREATE something In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions. In simple words an algorithm is a step-by-step list of instructions (that tell a program what to do)

The 3 main programming constructs Any programmer needs to know about the following three things. In this lesson We will only be looking at the first two. SEQUENCE (basically a sequence or set of instructions put in order) SELECTION (IF STATEMENTS and CASE Statements. We will only be looking at the first one in this session) ITERATION (these are loops – there are 3 main types (FOR loops, While – Next and Repeat – Until LOOPS - - More on these later)

Very very clever people in the early days of computing realised that they could use a special number system called BINARY Binary is a language of 1

Two type of Programming Ways we communicate with computers LOW LEVEL (Binary / Assembly Language) HIGH LEVEL Languages (like Java, VB, Scratch)

Remember that all a computer can really understand is BINARY (1s and 0s) This means that ultimately all code (high level language code) needs to be CONVERTED into Binary. This is done by means of COMPILERS, INTERPRETERS and TRANSLATORS These are computer programs that are used to convert high level instructions or language into a form that can be understood by the computer. (Binary) Read more: http://www.differencebetween.com/difference-between-compiler-and-vs-interpreter/#ixzz1sTXxdqWI

TRANSLATORS! The idea of using a computer to TRANSLATE human like language to machine language was first suggested by Grace Hopper (in 1952) She is often credited with the title of being the world’s first FEMALE PROGRAMMER!

Let’s Analyze the Programming Constructs in use

SELECTION: IF STATEMENTS See if you can find: SEQUENCE SELECTION: IF STATEMENTS ITERATION: LOOPS The use of a VARIABLE

But what, really is a program? -A Sequence of Instructions And what is a variable?

Algorithms – (in our brain) HOW OUR BRAINS WORK Algorithms – (in our brain) We eat, drink, speak, respond and appear to have been pre-programmed to do so. There is ‘Free Will’ too, but that’s a more philosophical discussion. DEFINITION: Algorithm = sequence of instructions which performs a meaningful task

How our brains work Input Processing Output We don’t often realize it but our brains are pretty awesome. The brain is storing values and processing data (as well as producing outputs) all the time Think of any system as comprising of these 3 parts Input Processing Output

Inputs need to be “stored” And this is where “Variables” come in. Variables are about allocating a little memory space to store a value.

What is a Variable? A storage box for Values 26 Name of Box [Variable] =Age 26 A storage box for Values

What is a Variable? All variables must be declared before they are used in a program

When I give you two numbers your brain stores it automatically… 15 47 Number 1 Number 2 You don’t consciously say – “right, now I am going to store number 1 and assign it a value of 15 and number 2 and assign it a value of 47…” it just happens instantly!”

In a computer you need to declare variables …. Example of declaring variables in VB Num1=15 Num2 =47 15 47 Number 1 Number 2 Think of it like a block of space (MEMORY ALLOCATION) for the inputs You are going to be processing

TASK Write a paragraph about why coding is important. Could computers work without code? If you wrote your own code to solve a problem, what problem would you want to fix? Take the next 5-10 minutes to write your reflective paragraph.

A little more on Algorithms Pseudocode or Flow Charts are often used to show the structure and functionality of a program. In Pseudocode the individual actions to be carried out by the program are stated in plain English … they can be visually represented in a Flow Chart using symbols and arrows.

Sample Pseudocode or Flowchart Pseudocode – is like “fake” code – resembles English in this case. READ NUMBER1 READ NUMBER 2 IF NUM 1 > NUM 2 Then ADD NUMBERS PRINT THE SUM Read Number 1 Read Number 2 No Num 1 > Num 2? Yes Add Numbers Print the Sum

Closing thought! In pairs discuss a few things you thought were interesting about this lesson. Talk about potential careers you could peruse if you became a computer programmer. Be ready to answer if called on!