Programming Languages: Notes for Class Discussion: V22.0002 Deena Engel’s class.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
2440: 211 Interactive Web Programming JavaScript Fundamentals.
INTRODUCING OUR LANGUAGE: C# CHAPTER Topics  The Features of C# –C# is an Interpreted Language –C# is Managed Code –C# is Strongly Typed –C# is.
INTRODUCING OUR LANGUAGE: C# CHAPTER Topics  The Features of C# –C# is a Compiled Language –C# is Managed Code –C# is Strongly Typed –C# is Function.
Introduction to C Programming
Concept of Computer Programming November 2, 2011.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
Computer Science 101 Introduction to Programming.
Introducing Java.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Programming Languages V Deena Engel’s class.
Programming Lifecycle
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
The Java Programming Language
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Programming With C.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
Review, Pseudocode, Flow Charting, and Storyboarding.
Introduction to Computer Programming
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
Basic Programming Lingo. A program is also known as a  Sequence of instructions  Application  App  Binary  Executable.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
1 Program Planning and Design Important stages before actual program is written.
REVIEW No curveballs this time …. PROBLEM TYPE #1: EVALUATIONS.
Debugging, Escape Command, More Math. It’s your birthday!  Write a program that asks the user for their name and their age.  Figure out what their birth.
ERRORS. Types of errors: Syntax errors Logical errors.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
Error Handling Tonga Institute of Higher Education.
REVIEW No curveballs this time …. PROBLEM TYPE #1: EVALUATIONS.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
Introducing Java Chapter 3 Review. Why Program in Java? Java, is an object-oriented programming language. OOP languages evolved out of the need to better.
 Lecture 2 Introducing C. Lecture overview  Operator:=  Functions: main(), printf()  Putting together a simple C program  Creating integer-valued.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Chapter 1: Introduction to Computers and Programming.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
FG Group -Afrilia BP -Liana F.B.I -Maulidatun Nisa -Riza Amini F.
Computer Programming - Key Concepts and Terms Computer Program – A computer program is a set of instructions for computer, arranged in logical order, using.
Few More Math Operators
Basic Concepts: computer, program, programming …
Component 1.6.
Component 1.6.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Lecture 1 Introduction Richard Gesick.
Chapter 3 Syntax, Errors, and Debugging
CSCI-235 Micro-Computer Applications
Programming Mehdi Bukhari.
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Statement atoms The 'atomic' components of a statement are: delimiters (indents, semicolons, etc.); keywords (built into the language); identifiers (names.
Programming Vocabulary.
Introduction to C++ Programming
Spot the bug!.
Programming.
Software Development Process
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Learning Intention I will learn about the different types of programming errors.
WJEC GCSE Computer Science
Instructor: Alexander Stoytchev
Presentation transcript:

Programming Languages: Notes for Class Discussion: V Deena Engel’s class

Programming languages and Natural Languages They both use: syntax (e.g. punctuation) grammar (“well formed sentences”) parts of speech (analogous to data types) Semantics (the meaning of symbols and words)

Natural Languages use: Syntax: punctuation and spacing Grammar: to create “well formed sentences” (e.g. subject-verb-object) Parts of speech: nouns, verbs, adjectives Semantics: the meaning of the words and what they represent (e.g. in English, “cat” refers to a furry, four-pawed mammal in the Great Cats family)

Programming Languages use: Syntax: punctuation such as parentheses, braces, brackets, semicolons, etc Grammar: well-formed structures such as blocks of code and statements within the blocks Parts of speech: can be viewed as the different data types such as integers, characters, text Semantics: the meaning of the symbols, e.g. =, + and others; or the use of reserved words.

Key words See Table 1-2 on page 18 One distinction between programming languages and natural languages is that programming languages contain key words – or reserved words. Each reserved word has a specific meaning and cannot be used for any other purpose. Python key words: anddelfromnotwhile aselifglobalorwith assertelseifpassyiel breakexceptimportprint classexecinraise continuefinallyisreturn defforlambdatry

Writing Steps in writing code in a programming language which gets compiled: Source code  Compiler  Machine language Python uses an interpreter.

Style Style counts … in both kinds of languages! In natural language … style is one way to distinguish the type of writing e.g. the differences between a sonnet by Shakespeare and a weekly shopping list… In a programming language, style is important to make the program both readable and more efficient.

Comments Programming languages allow us to document what we are doing … explaining how something works and what the most recent changes were. Like stage directions in a play, or one’s notes in the margins, programming languages allow us to separate out text from the body of the program.

How to use programming languages: Natural languages: can be used to tell a story … and other purposes … as well as to give instructions. Cookbooks and how-to books provide instructions in a natural language: “mix ½ cup of sugar into the butter” The instructions might include decisions: “if these are chocolate chip cookies, add chocolate chips and shredded coconut ; otherwise just add shredded coconut”).

Programming Languages... Give instructions to the computer… A computer program is like a recipe except that the computer follows the instructions.

Programming Languages (Page 17 - Table 1-1) Ada Basic Fortran Cobol Pascal C and C++ C# Java JavaScript Python Ruby Visual Basic

Programming Languages give instructions: Any series of repeated instructions can be called an algorithm. In many cases, the programming language mirrors what you would do if you were doing the task manually. For example: To keep a running total in a checkbook … First: order the amounts by the date of the check; then, if it’s a check, subtract the amount or if it’s a deposit, add the amount; then print the current total For example: To create an index of important terms in a book: First, read or scan the text; discard extra words (“the”, “and”); list the important terms and their pages; write it up as an index in alphabetical order.

“Bugs”! De-bugging a program is the process of finding and resolving errors. Errors fall into three general categories –Syntax errors: The code does not follow the rules of the language; for example, a single quote is used where a double quote is needed; a colon is missing; a keyword is used as a variable name. –Runtime errors: In this case, your code is fine but the program does not run as expected (it “crashes”). For example, if your program is meant to divide two numbers, but does not test for a zero divisor, a run-time error would occur when the program attempts to divide by zero. –Logic errors: These can be the hardest to find. In this case, the program is correct from a syntax perspective; and it runs; but the result is unanticipated or outright wrong. For example, if your program prints the line “2 + 3 is equal to “ … followed by a 6 … the answer is wrong!