Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data --

Slides:



Advertisements
Similar presentations
INSTRUCTION SET ARCHITECTURES
Advertisements

Lecture 1: Overview of Computers & Programming
PROGRAMMING Introduction To Programming Definition Types Of Programming Languages Programming Language Paradigm Translator
The Binary Machine Modern high-level programming languages are designed to make programming easier. On the other end, the low level, all modern digital.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
This set of slides is provided by the author of the textbook1 Introductory Topics l Computer Programming l Programming Life-Cycle Phases l Creating an.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Introduction to a Programming Environment
Implementation of a Stored Program Computer
Compiler Construction
Topic 1: Introduction to Computers and Programming
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Assembly & Machine Languages
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
1 Chapter-01 Introduction to Computers and C++ Programming.
PROCESSING Designing and developing a program. Objectives Understand programming as the process of writing computer instructions that achieve a goal Understand.
Programming Languages Generations
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Course Introduction C++ An Introduction to Computing.
THE PROCESS OF WRITING SOFTWARE Python: System Engineering 1.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computer Science.
Natawut NupairojAssembly Language1 Introduction to Assembly Programming.
Laboratorio di Calcolo I Docente: prof. Berardi (Dip. Informatica) Lezione introduttiva su Computing ed esercitazioni di Unix/Linux tenute da Fabrizio.
Introduction CS 104: Applied C++ What is Programming? For some given problem: __________ a solution for it -- identify, organize & store the problem's.
Tranlators. Machine Language The lowest-level programming languageprogramming language Machine languages are the only languages understood by computers.languagescomputers.
Evolution of Programming Languages Generations of PLs.
Programming Languages: History & Traditional Concepts CSC 2001.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
1 CPSC 185 Introduction to Computing The course home page
© Calvin College, When we prepare a program, the experience can be just like composing poetry or music … My claim is that it is possible to write.
PROGRAMMING LANGUAGES
Ted Pedersen – CS 3011 – Chapter 10 1 A brief history of computer architectures CISC – complex instruction set computing –Intel x86, VAX –Evolved from.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Beginning Snapshots Chapter 0. C++ An Introduction to Computing, 3rd ed. 2 Objectives Give an overview of computer science Show its breadth Provide context.
Sahar Mosleh California State University San MarcosPage 1 Assembly language and Digital Circuit By Sahar Mosleh California State University San Marcos.
Introduction to Computer and Programing Thanachat Thanomkulabut.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Chapter 1 An Overview of Computers and Programming Languages.
Skill Area 311 Part B. Lecture Overview Assembly Code Assembler Format of Assembly Code Advantages Assembly Code Disadvantages Assembly Code High-Level.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
INTRODUCTION TO COMPUTER PROGRAMMING ITC-314. Computer Programming  Computer Programming means creating a sequence of instructions to enable a computer.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Assembly language.
Operating System Interface between a user and the computer hardware
CSCI-235 Micro-Computer Applications
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Microprocessor and Assembly Language
A Closer Look at Instruction Set Architectures
C Prog. To Object Code text text binary binary Code in files p1.c p2.c
Assembly Language Programming II: C Compiler Calling Sequences
Programming.
Machine-Level Programming: Introduction
Introduction to Microprocessor Programming
1.3.7 High- and low-level languages and their translators
Compiler Construction CS 606 Sohail Aslam Lecture 1.
Algoritmos y Programacion
Presentation transcript:

Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data -- develop algorithms (procedures) to process it; code this solution as a program; test the program; maintain the program (fix it, upgrade it, …). What is a program? — a collection of statements that — implement the design plan, and — are written in a programming language — a language that the computer can understand. CS 104: Applied C++ OCD in C++ debug "real world"

What kinds of statements do computers understand? A computer only understands a language specially designed for it called machine language. Machine-language statements are stored in a computer’s memory, which is a sequence of two-state devices (on-off switches). They are retrieved from memory and executed one at a time. The "character set" for machine language: __ representing "off" __ representing "on" 2 RISC CISC 0 1

Machine language programs thus consists of strings of bits ( ) Example (hypothetical) binary digits

4 Bits are usually grouped into bytes (8 bits) and words (e.g., 32 or 64 bits). Each machine language instruction might be stored in one word. opcode instruction #1 first operandsecond operand e.g., "Store" 1 in memory location with this address

5 So a sequence of machine language instructions might be stored in a sequence of consecutive words instruction #1 #4 #3 #2

SPARC executable machine code … this goes on for another 1600 lines... Intel Pentium executable machine code … this goes on for another 74 lines... A Real Machine-Language Example 6 int main() { int x, y; x = 1; y = x + 2; return 0; } C++

Early Computers Required a programmer to write in machine language. –Very easy to make mistakes! –And they were hard to find! –Programs were not portable. They could only be run on one kind of machine! Result: programming was very difficult and programs weren't widely used. 7

An Early Innovation Create a machine-language program called an assembler to input each assembly language instruction and translate it into machine language LOAD x ADD 2 STORE y Assembler 8 Devise a set of mnemonics (abbreviations), one for each machine language instruction; this was called an assembly language.

Intel Pentium assembly language: _main: pushl %ebp movl %esp,%ebp subl $24,%esp call ___main movl $1,-4(%ebp) movl -4(%ebp),%eax addl $2,%eax movl %eax,-8(%ebp) xorl %eax,%eax jmp L2.align 4 L2: movl %ebp,%esp popl %ebp ret Intel Assembler 9 The Real Example SPARC assembly language: main: save%sp, -120, %sp mov1, %o0 st%o0, [%fp-20] ld[%fp-20], %o0 add%o0, 2, %o1 st%o1, [%fp-24] mov0, %i0 b.LL2 nop mov0, %i0 b.LL2 nop.LL2: ret restore Sun Assembler int main() { int x, y; x = 1; y = x + 2; return 0; }

Assembly Languages Allowed a programmer to use mnemonics, which were more natural than binary. +Much easier to read programs +And much easier to find and fix mistakes –Still not portable to different machines –Still quite difficult to write, read, and debug programs 10

Next Major Advance: High Level Languages & Compilers To improve on assembly language: Devise a set of statements called a high-level language that are closer to human language and methods of writing expressions and a program called a compiler to translate them into machine language. 11 Why not just use human language? It’s too complex and ambiguous; e.g., “Time flies like an arrow” 1950s FORTRAN COBOL LISP

Compilers vs. Assemblers An assembler translates one assembly-language statement into one machine-language statement. A compiler translates one high-level statement into multiple machine-language statements, so it is much more difficult to write a correct compiler than an assembler. LOAD b ADD c STORE temp1 LOAD a MULT temp1 STORE z Assembler z = a * (b + c); Compiler 12

Advantages of High-Level Languages With programming in high-level languages (e.g., C++): +Programs are much easier to read. +Mistakes are much easier to find and fix. +Programs are (or can be) portable from one machine to another (provided they conform to the language standard). Just need a compiler for that language written in the machine language of that machine.  Not so simple that just anyone can use them (otherwise this course wouldn't exist) 13

Objectives in Programming A program to solve a problem should be: +correct (it actually solves the problem) +readable (understandable by another person) +user-friendly (designed in a way that is easy for its user to use). 14 Grading criteria Later +efficient (doesn’t waste time or space)

Fredrick P. Brooks, Jr. (1931- ) We enjoy designing things because we are created in the image of God. The woes of programming: Products become obsolete too quickly. 15 The computer is a powerful and rewarding tool to use. The joys of programming: The “mindless” details can be excessively tedious.