Introduction to Engineering Using Robotics Experiments. Dr. Yinong Chen

Similar documents
Chapter 6: Programming Languages

Second-generation: Assembly language. Figure 6.1 Generations of programming languages. Assembly Language Characteristics.

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

Chapter 5: Algorithms

Chapter 1. Preview. Reason for Studying OPL. Language Evaluation Criteria. Programming Domains

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2014 Euiseong Seo

CSCI 3136 Principles of Programming Languages

Chapter 1. Preliminaries

CS101 Introduction to Programming Languages and Compilers

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2015 Euiseong Seo

Compilation I. Hwansoo Han

Topic I. Introduction and motivation References: Chapter 1 of Concepts in programming languages by J. C. Mitchell. CUP, 2003.

Concepts in Programming Languages

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Principles of Programming Languages. Lecture Outline

Programming Languages, Summary CSC419; Odelia Schwartz

Discovering Computers Chapter 13 Programming Languages and Program Development

Chapter 1 Preliminaries

Introduction to Python. Didzis Gosko

Chapter 1. Preliminaries

SOFTWARE ARCHITECTURE 6. LISP

A script is a computer program that automates the sort of task that a user might otherwise do interactively at the keyboard.

CGT 456 Lecture 1. Introduction to Computers & Programming

Introduction P L COS 301. Fall School of Computing and Information Science University of Maine. Introduction COS 301.

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction

Full version is >>> HERE <<<

Technology in Action. Chapter Topics (cont.) Chapter Topics. Reasons for Software Programming. Information Systems 10/29/2010

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5

What is a programming language?

A Dream of Software Engineers -- Service Orientation and Cloud Computing

Introduction to Engineering Using Robotics Laboratories Algorithms

Using Data Science to deliver Workforce & Labour Market Insights. Gary Gan Co-Founder, JobKred

Mechanization. A little bit of history. Mechanization. The old dream of mechanical computing. Jordi Cortadella Department of Computer Science

Why learn Computer Programming? Computer-based problem solving in Science and Engineering. Why learn Fortran? Elementary Computer Organization

A little bit of history. Jordi Cortadella Department of Computer Science

Outline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current

Lecture 1 - Introduction (Class Notes)

Introduction to Scientific Computing Languages

Chapter 11 Program Development and Programming Languages

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Introduction to Scientific Computing Languages

Javascript Coding Interview Questions And Answers In C++ Pdfs >>>CLICK HERE<<<

Programming: C ++ Programming : Programming Language For Beginners: LEARN IN A DAY! (Swift, Apps, Javascript, PHP, Python, Sql, HTML) By Os Swift

CSC 533: Organization of Programming Languages. Spring 2005

Programming Language Concepts 1982, 1987, Outline. Period

Dynamic Languages Toolkit. Presented by Andrey Tarantsov

CSI32 Object-Oriented Programming

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

CSCE150A. Administrivia. Overview. Hardware. Software. Example. Program. Pseudocode. Flowchart. Control Structures. Hello World Program CSCE150A

Computer Science & Engineering 150A Problem Solving Using Computers

CHAPTER 1 Introduction to Computers and Java

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008.

Com S 541. Programming Languages I

Introduction to Computer Science Lecture 6: Programming Languages

Programming & Computers

Technology in Action. Chapter Topics. Scope creep occurs when: 3/20/2013. Information Systems include all EXCEPT the following:

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts

Part (04) Introduction to Programming

Concepts of Programming Languages

Chapter 1: Introduction

LECTURE 1. Overview and History

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Low-Level Languages. Computer Programs and Programming Languages

Read & Download (PDF Kindle) A First Book Of C++ (Introduction To Programming)

ASSOCIATE DEGREE REQUIREMENTS

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Early computers (1940s) cost millions of dollars and were programmed in machine language. less error-prone method needed

Introduction Objectives: 1) differentiate between high-level, low-level, and machine language; 2) explain why it is necessary to translate a program

Programming Languages and Program Development Life Cycle Fall Introduction to Information and Communication Technologies CSD 102

New Programming Paradigms

Why are there so many programming languages?

Introduction to Programming Languages. CSE 307 Principles of Programming Languages Stony Brook University

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

CSc 372 Comparative Programming Languages

NOTE: Answer ANY FOUR of the following 6 sections:

CSc 372. Comparative Programming Languages. 1 : Introduction. Department of Computer Science University of Arizona

Continuations provide a novel way to suspend and reexecute

CMSC131. Hardware and Software. Hardware

CMSC131. Hardware and Software

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified

Why study Programming Language Concepts? Chapter One. Language Evaluation Criteria. Programming Domains. Readability Writability Reliability Cost

Caliber Data Training

Programming Languages 2nd edition Tucker and Noonan"

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

CS2303 C14 Systems Programming Concepts. Bob Kinicki

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Principles and Components 1

Introduction to the course and basic programming concepts

Chapter Twelve. Systems Design and Development

Chapter 1: Introduction to Computers and Programming

Objective: To learn meaning and concepts of programming. Outcome: By the end of this students should be able to describe the meaning of programming

Transcription:

Introduction to Engineering Using Robotics Experiments Dr. Yinong Chen

Outline Historical Perspective Programming Language Generations Programming Language Paradigms Imperative Programming Paradigm Writing Imperative Programs in C# Console Interface vs. Graphic User Interface Next Object-Oriented Computing Service-Oriented Computing Web-based Computing Mobile Computing 2

Generations of Programming Languages Classification by Time 5 th Data flow / Event-driven Workflow Visual Programming, Alice VPL Phone Inventor 3

First-Generation: Machine language Operator and operands are coded in to binary Each instruction is a binary (or hexadecimal) number Second-Generation: Assembly language A mnemonic system for representing machine instructions One-to-one correspondence (table) between machine instructions and assembly instructions Converted to machine language by a program called an assembler: look up the table 4

Program Examples Machine language in HEX 156C 166D 5056 30CE C000 Assembly language LD R5, Price LD R6, ShippingCharge ADDI R0, R5 R6 ST R0, TotalCost HLT Machine code Assembly code 5

Third Generation Language Uses high-level imperative languages Similar to our pseudo-code Machine independent (mostly) Examples: FORTRAN, COBOL, C Each primitive corresponds to a sequence of machine language instructions Converted to machine language by a program called a compiler 6

Evolution of Programming Languages Service-oriented Paradigm VPL C# Java Time 7

Spectrum of Programming Languages Paradigms Functional Programming e.g. LISP/Scheme Logic/ Declarative Programming e.g. Prolog Imperative Programming Assembly, Algo, FORTRAN, Pascal, C Object-Oriented Programming C++, Java, C# CSE100/110 Workflow-based languages VPL, WF, Oracle BPEL Service-Oriented Programming Java, C#, VPL/ASU-VPL Component-Based Programming C++, Java, C# Event-driven VPL 50s 60s 70s 80s 90s 00s 10s Time 8

What is a Program Program Algorithm Process (steps) of data manipulation Data structure Objects of the manipulation Emphasis: Imperative / Procedural Paradigms Emphasis: Object- Oriented Paradigm 9

Imperative Programming Paradigm Fully specified and fully controlled manipulation of named data in a step-wise fashion. Developed as abstractions of von Neumann machine (stored program concept). Programs are algorithmic in nature: do this, then that, then repeat this ten times -- focuses on how rather than what. Why popular Performance match the machine Culture reading manuals Foundation of object-oriented programming 10

Flowchart Input the values of W1, W2, W3, W4 W1 > W3 W1 > W4 W3 > W4 W1 > W2 P1 won P4 won P3 won P4 won W2 > W4 W2 > W3 W3 > W4 P2 won P4 won P3 won P4 won 11

Basics of Programming 1. List the library packages to be used, e.g., I/O package; 2. Declare variables 3. Initialize variables From outside (keyboard, sensors, networks); Hardcoded assignment, x = Hello World ; y = 7; 4. Manipulate variables (computing) One time modification, e.g., x = x + 1; z = x + y; Multiple modifications using a loop; 5. Selections Select one out of two: if-then-else; Select one out of multiples: switch; 6. Loops For-loop: Iterate a fixed number of times While-loop: Iterate until a condition is met 12

Implementation: Map the Problem to Program using System; // It includes the most frequently used lib functions class weightlift // main class static void Main() // Declare variables (memory spaces) Int32 W1, W2, W3, W4; // for holding the weight lifted by each player string str; // for temporarily holding the input from keyboard; // Enter the weights lifted by each player Console.WriteLine("Please enter the weight lifted by Player 1\n"); str = Console.ReadLine(); // read a string of characters W1 = Convert.ToInt32(str); // Convert the string to an integer Console.WriteLine("Please enter the weight lifted by Player 2\n"); str = Console.ReadLine(); // read a string of characters W2 = Convert.ToInt32(str); // Convert the string to an integer Console.WriteLine("Please enter the weight lifted by Player 3\n"); str = Console.ReadLine(); // read a string of characters W3 = Convert.ToInt32(str); // Convert the string to an integer Console.WriteLine("Please enter the weight lifted by Player 4\n"); str = Console.ReadLine(); // read a string of characters W4 = Convert.ToInt32(str); // Convert the string to an integer 13

Map the Problem to Program (contd.) if (W1 > W2) if (W1 > W3) if (W1 > W4) Console.Write("Player 1 Wins\n"); else Console.Write("Player 4 Wins\n"); else if (W3 > W4) Console.Write("Player 3 Wins\n"); else Console.Write("Player 4 Wins\n"); P1 won W1 > W4 P4 won W1 > W3 P3 won W3 > W4 W1 > W2 P4 won 14

else if (W2 > W3) Map the Problem to Program (contd.) if (W2 > W4) Console.Write("Player 2 Wins\n"); else Console.Write("Player 4 Wins\n"); else if (W3 > W4) P2 won Console.Write("Player 3 Wins\n"); else Console.Write("Player 4 Wins\n"); W1 > W2 W2 > W4 P4 won W2 > W3 P3 won W3 > W4 P4 won 15

Add and Display a List of Numbers in a While-Loop using System; class addlist static void Main() Int32 i = 0; Int32 sum = 0; while (i<10) sum = sum + i; Console.WriteLine("i = 0 sum = 1 ", i, sum); i++; Console.WriteLine("Program completed."); 16

Interface to Users Console input and output Minimum effort on the interface design Used by developers in the development stage Windows-based GUI (Graphic User s Interface) The application is running on the operating system of the computer Example: Install a game and play on your computer Web-based GUI The application is running on a remote server; User access the application through a Web browser; Example: Play an internet game Mobile Device GUI Windows Phone, iphone, Android Phone 17

Console Interface versus Graphic User Interface 18

Traditional Programming Languages vs. Scripting Languages They come and go Fortran Cobol Pascal ADA Lisp Scheme Prolog Java C C++ Php Ruby on Rails SQL Java C# But basic concepts remain Fortran ADA C Pascal C++ C# Java JavaScript Php Traditional programming languages Perl Python TCL AJAX VBScript XSLT CSS Scripting languages

Scripting Languages Job control languages and shells: IBM JCL Unix Script AppleScript Visual programming languages/workflow: Alice National Instrument LabView EV3 Programming Language Microsoft VPL / ASU - VPL Application-specific languages: QuickC Emacs Lisp Parallax C for robotics programming Extension/embeddable languages SpiderMonkey embedded in Yahoo Widget Engine Adobe Flash (ActionScript) TCL Perl Python Web client-side scripting: AJAX CSS, XSLT JavaScript VBScript, C# ECMAScript Dynamic languages and server-side Scripting & Computing: Java PHP C# on ASP.Net Ruby on Rails