Language Basics.

Slides:



Advertisements
Similar presentations
Mission Technology Introduction to Scratch! June 2007.
Advertisements

CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
2440: 211 Interactive Web Programming JavaScript Fundamentals.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
COSC 120 Computer Programming
What Data Do We Have? Sections 2.2, 2.5 August 29, 2008.
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
PHYS 2020 Making Choices; Arrays. Arrays  An array is very much like a matrix.  In the C language, an array is a collection of variables, all of the.
Introduction to a Programming Environment
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Guide To UNIX Using Linux Third Edition
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Introduction to Programming. Our Book in CS Why Program? Lets watch a video
CSE 1340 Introduction to Computing Concepts Class 2.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
CMPD 434 MULTIMEDIA AUTHORING Chapter 06 Multimedia Authoring Process IV.
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
Learning the skills for programming Advanced Visual Programming.
Fundamental Programming: Fundamental Programming Introduction to C++
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Programming Fundamentals. Today’s Lecture The Conditional Operator Logical Operators Structures Enumerations.
Game Programming Using Scratch Brooklyn College Bridges To Computing (2009) M. Meyer, J. Rodney.
1 12/4/1435 h Lecture 2 Programs and Programming Languages.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
COP 2510 Programming ConceptsAlessio Gaspar BSAS Industrial Operations 1 Manipulating Data Concepts Covered: Literal values, variables and Types Variables.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
COIT29222 Structured Programming 1 COIT29222-Structured Programming Lecture Week 02  Reading: Textbook(4 th Ed.), Chapter 2 Textbook (6 th Ed.), Chapters.
My Mission Statement To ensure students leave the course with an intermediate knowledge of general programming skills they can transfer to other platforms.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming Dr. Halla Abdel Hameed.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 1: Introduction to Computers and Programming.
Introduction to Scratch We will be using the Scratch Environment today, so please log in to the Scratch website (scratch.mit.edu)
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Scratch Programming for kids!!. In the 80’s, there was BASIC -- the Beginner's All-purpose Symbolic Instruction Code, a purportedly easy-to- learn, general.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming
BASIC PROGRAMMING C SCP1103 (02)
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 10 Programming Fundamentals with JavaScript
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1. Introduction to Computers and Programming
Computer science By/ Midhat Mohiey. Introduction to Programming using C ++ 2.
Chapter 1: Introduction to Computers and Programming
Chapter 10 Programming Fundamentals with JavaScript
Unit 1: Introduction Lesson 1: PArts of a java program
Language Basics.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Presentation transcript:

Language Basics

What is a Program Made of? Chapter 1.4 What is a Program Made of?

Last lecture I said… Common elements in programming languages: Key Words Programmer-Defined Identifiers Operators Punctuation Syntax

Wow!!! I am overwhelmed ---what does all of this mean. Don’t worry---lets play a bit and learn a little bit about these idea with a fun tool called Scratch before we learn about C++.

Scratch (scratch.mit.edu) Application to teach concepts of Programming that is language independent and geared for children What is it really = a visual editor where you don’t have to worry about language syntax and you can create games/animations that others can “play”.

Scratch Preview Panel- can view current game/animation here Scripting Panel- THIS IS WHERE WE CREATE OUR CODE Toolkit Panel- where can get the operators of the Scratch LANGUAGE Sprite Panel—where you make your characters in your game

Time for a Demo in class Uses beginning project linked on our class website or see instructor. NOTE how the language statements SNAP together like Legos --- this is like writing good Syntax in a program – only certain statements can go with others in a language.

Lets compare concepts of real programs with Scratch to really Learn what these ideas mean

We will compare the following ideas in Scratch and a real C++ program Programmer-Defined Identifiers --- variables Operators Punctuation Syntax

This is our Program we will use

Programmer-Defined Identifiers --Variables Names made up by the programmer Not part of the programming language Used to represent various things: variables (memory locations), functions, etc.

Variables in Scratch Scratch we have character’s named Sprites --- we can define variables about them.

Variables in a Program A variable is a named storage location in the computer’s memory for holding a piece of data.

Variables in C++ example In Program 1-1 we used three variables: The hours variable was used to hold the hours worked The rate variable was used to hold the pay rate The pay variable was used to hold the gross pay

Variable Definitions To create a variable in a program you must write a variable definition (also called a variable declaration) Here is the statement from Program 1-1 that defines the variables: double hours, rate, pay;

Variable Definitions There are many different types of data, which you will learn about in this course. A variable holds a specific type of data. The variable definition specifies the type of data a variable can hold, and the variable name.

Variable Definitions Once again, line 7 from Program 1-1: double hours, rate, pay; The word double specifies that the variables can hold double-precision floating point numbers. (You will learn more about that in Chapter 2)

Operators Used to perform operations on data Many types of operators: Arithmetic - ex: +,-,*,/ Assignment – ex: =

Operators in Scratch Lets look at addition in Scratch When Cat moves lets change location by +10 each time.

Operators in C++ example (<< >> = * )

Punctuation Characters that mark the end of a statement, or that separate items in a list

Scratch – no punctuation –but end of line is visible Here each line of code has its own “shaped box”

Punctuation in C++ Commas = separate Semi-colons = end of line

Syntax The rules of grammar that must be followed when writing a program Controls the use of key words, operators, programmer-defined symbols, and punctuation Scratch TIP: controls syntax remember by Only allowing certain commands to “SNAP” together. Here we see the “if” statement does something (turns 15 degrees) when the (distance to Sprite1 is < 20)

Example Syntax in C++ Regular statements must end with a Semi- colon ---this signifies the end of the statement We will learn more of the C++ sytnax rules as we go through the class.

Procedural and Object-Oriented Programming ---- what did I mean in last lecture --- can Scratch help us?

Procedural and Object-Oriented Programming Procedural programming: focus is on the process. Procedures/functions are written to process data. Object-Oriented programming: focus is on objects, which contain data and the means to manipulate the data. Messages sent to objects to perform operations. Scratch TIP: Our operations like when we are close to Sprite1 then turn 15 degrees is a procedure Scratch TIP: Our Sprites we saw in Scratch are like objects