Programming and Languages Dept. of Computer and Information Science IUPUI.

Slides:



Advertisements
Similar presentations
Computers Are Your Future
Advertisements

Introducing Programming a general discussion. What is a Program? Sets of instructions that get the computer to do something Programs may be a few lines.
Computer Concepts 5th Edition Parsons/Oja Page 546 CHAPTER 11 Software Engineering Section A PARSONS/OJA Computer Programming.
Computers: Tools for an Information Age
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
An Introduction to Programming with C++ Fifth Edition Chapter 1 An Introduction to Programming.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
Intro to Programming CST JavaScript. Objectives Define software Identify the different types of software Differentiate the different types of programming.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Object-Oriented Programming (OOP)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
1 CS101 Introduction to Computing Lecture 19 Programming Languages.
C++ Crash Course Class 1 What is programming?. What’s this course about? Goal: Be able to design, write and run simple programs in C++ on a UNIX machine.
© Paradigm Publishing Inc Chapter 12 Programming Concepts and Languages.
1 Chapter-01 Introduction to Computers and C++ Programming.
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Copyright ©2005  Department of Computer & Information Science Introducing Programming.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
Programming Languages CPS120: Introduction to Computer Science Lecture 5.
Languages and Environments Higher Computing Unit 2 – Software Development.
Computers Are Your Future Eleventh Edition
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
High-Level Programming Languages: C++
CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
111 © 2002, Cisco Systems, Inc. All rights reserved.
An Introduction to Programming with C++ Sixth Edition
CS101 Introduction to Computing Lecture Programming Languages.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
© 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.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
What is Programming? A program is a list of instructions that is executed by a computer to accomplish a particular task. Creating those instructions is.
Chapter One An Introduction to Programming and Visual Basic.
1 3. Computing System Fundamentals 3.1 Language Translators.
 Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Skill Area 311 Part B. Lecture Overview Assembly Code Assembler Format of Assembly Code Advantages Assembly Code Disadvantages Assembly Code High-Level.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Software Design and Development Languages and Environments Computing Science.
 By the end of this lecture, you should …  Understand the three pillars of Object- Oriented Programming: Inheritance, Encapsulation and Polymorphism.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Lecture 1 Introduction Richard Gesick.
CSCI-235 Micro-Computer Applications
Sequential Structures
Chapter One: An Introduction to Programming and Visual Basic
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
ICT Programming Lesson 1:
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
ICT Gaming Lesson 2.
Tonga Institute of Higher Education IT 141: Information Systems
An Introduction to Programming with C++ Fifth Edition
4 – History of Programming Languages
Tonga Institute of Higher Education IT 141: Information Systems
Programming Logic and Design Eighth Edition
Presentation transcript:

Programming and Languages Dept. of Computer and Information Science IUPUI

Programming as Problem Solving Problem solving principles: 1. Completely understand the problem 2. Devise a plan to solve it 3. Carry out the plan 4. Review the results Developing a Program: 1. Analyze the problem 2. Design the program 3. Code the program 4. Test the program

 Hardware  Machine code  Assemblers  Compilers  Interpreters Progression

Hardware encoding  Change physical structure of machine  Extremely tedious  Very difficult  Prone to error

Programming Languages  Programming languages allow programmers to code software.  The three major families of languages are:  Machine languages  Assembly languages  High-Level languages

Machine Language  Stored Language Concept  Von Neumann  Treat Instructions as data  Comprised of 1s and 0s  The “native” language of a computer  Difficult to program – one misplaced 1 or 0 will cause the program to fail.  Example of code:

Assembly Languages  Mnemonics  Labeled cells  somewhat easier on programmers  Assembly languages are a step towards easier programming.  Assembly languages are comprised of a set of elemental commands which are tied to a specific processor.  Assembly language code needs to be translated to machine language before the computer processes it.  Example: ADD ,

High-level Language  Typed in near-human language  Converted to assembler  Much easier on programmers  Can be assembled or compiled  Language is still very precise, but more nearly readable  High-level languages represent a giant leap towards easier programming.  The syntax of HL languages is similar to English.  Historically, we divide HL languages into two groups:  Procedural languages  Object-Oriented languages (OOP)

Procedural Languages  Early high-level languages are typically called procedural languages.  Procedural languages are characterized by sequential sets of linear commands. The focus of such languages is on structure.  Examples include C, COBOL, Fortran, LISP, Perl, HTML, VBScript

 Most object-oriented languages are high-level languages.  The focus of OOP languages is not on structure, but on modeling data.  Programmers code using “blueprints” of data models called classes.  Examples of OOP languages include C++, Visual Basic.NET and Java. Object-oriented

Interpreting  Some programs are translated using an interpreter. Such programs are translated line-by-line instead of all at once (like compiled programs). Interpreted programs generally translate quicker than compiled programs, but have a slower execution speed.  Interpreter runs in background  Instructions are translated in real time  high-level code is distributed  More flexible  Slower

Compiling  Some programs are translated using a compiler. When programs are compiled, they are translated all at once. Compiled programs typically execute more quickly than interpreted programs, but have a slower translation speed.  Compiler converts entire program into machine language  binary code is distributed  Less flexible  Faster  Regardless of the HL Language, all HL programs need to be translated to machine code so that a computer can process the program.

Structured Programming  A method for designing and coding programs in a systematic, organized manner.  It combines the principles of top-down design, modularity and the use of the three accepted control structures of sequence, repetition and selection.

Control Structures  Sequence –in sequential order.  The simplest of control structures – start at the beginning and continue in sequential order.  Selection – selectively execute statements  Called a branch, it requires a condition to determine when to execute statements.

Control Structures  Repetition – repeat statements more than once  Called a loop, it needs a stop condition, I.e, the program will continue to loop until some condition is met.

Sequence Structure  Start – where the program begins  Input – data to be used for the program  Step One, Step Two, etc. – the sequence of the program until it finishes  No deviation

Selection Structure  Start the program  Input – data to be used  Asking the question; only one question  The answer, YES or NO  Depending on the answer, the action to be taken  The program moves on or ends

Loop Structure  Program starts  The condition is set  Input – ask for password  Answer is evaluated, compared to condition  If no, action of asking for password continues until input of correct password

Event-Driven Programming  In an event-driven program, the flow of control is based on the user’s clicking on menus and buttons, etc. These user actions are called events.  Event-driven programming still uses the basic principles of structured programming – program modules, control structures, good programming style, and program testing.

Types of Errors  Syntax – wrong grammar, i.e., breaking the rules of how to write the language  Forgetting punctuation, misspelling keyword  The program will not run at all with syntax errors  Logic - the program runs, but does not produce the expected results.  Using an incorrect formula, incorrect sequence of statements, etc.

Programming Example  Simple programming problem: Convert a price from British pounds into Dollars.  Pseudocode Input the price of the item, PoundPrice, in pounds Compute the price of the item in dollars: Set DollarPrice = 1.62 * PoundPrice Write DollarPrice

Programming Example  Translating to Basic: INPUT PoundPrice LET DollarPrice = 1.62 * PoundPrice PRINT DollarPrice END

<!– var strUserName = ""; // user's name, this is a STRING var strUserCity = ""; // user's city, this is a STRING var intNumLetters = 0; // number of letters in user's first name, this is an INTEGER var strMessage = "" // output to the user, this is a STRING strUserName = window.prompt("What is your name?"); //this is asking for the user's name strUserCity = window.prompt("Where do you live?"); //this is asking what city does the user live in strMessage = ("Hello, "); strMessage += (strUserName.toUpperCase()); //this puts the user's name into uppercase letters strMessage += (". You live in "); strMessage += (strUserCity.toUpperCase()); //this puts the user's city into uppercase letters window.alert(strMessage); //this is the message given to the user intNumLetters = strUserName.length; // output to the user window.alert("There are " +intNumLetters+" letters in your first name."); //this is a string method, it is counting the number of letters in the user's name //this tells the user how many letters that user has in their name // -->