MODULE 1 : WHY PROGRAMMING LANGIUAGES - Overview Programming fundamentals is about knowing how to give instructions in a computer language to the computer.

Slides:



Advertisements
Similar presentations
Slide 1CPU Emulator Tutorial This program is part of the software suite that accompanies the book The Digital Core, by Noam Nisan and Shimon Schocken 2003,
Advertisements

4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Overview of Programming and Problem Solving ROBERT REAVES.
Lab6 – Debug Assembly Language Lab
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
1 Chapter 1 Introduction to Object-Oriented Programming.
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
Intoduction First we’ll talk in general about Visual X-Toy Then we’ll input and run a program using switches Then we’ll look at the more advanced editor.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Chapter 1: An Overview of Computers and Programming Languages
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Topic 1: Introduction to Computers and Programming
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 1 An Overview of Computers and Programming Languages.
1.1 1 Introduction Foundations of Computer Science  Cengage Learning.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Chapter 1 Engineering Problem Solving 1. Hardware and Software 2 A computer is a machine designed to perform operations specified with a set of instructions.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Invitation to Computer Science 5 th Edition Chapter 9 Introduction to High-Level Language Programming.
Topics Introduction Hardware and Software How Computers Store Data
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
Chapter 1: Preliminaries. Objectives In this chapter, you will learn about: Unit analysis Exponential and scientific notations Software development Algorithms.
The Beauty and Joy of Computing Lecture #3 : Creativity & Abstraction UC Berkeley EECS Lecturer Gerald Friedland.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Computer Architecture And Organization UNIT-II General System Architecture.
Execution of an instruction
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Problem Solving Techniques Using Pascal Allen C.-H. Wu Department of Computer Science Tsing Hua University Hsinchu, Taiwan 30043, ROC
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Chapter 1 An Overview of Computers and Programming Languages.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
1 Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
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.
Computer Architecture and Number Systems
Computing Science Computer Structure: Lesson 1: Processor Structure
Operating System Interface between a user and the computer hardware
Control Unit Lecture 6.
Computing Systems Organization
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
CHAPTER 6: The Little Man Computer
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Introduction to Assembly Language
Computer Science I CSC 135.
Computer Electronic device Accepts data - input
Chapter 1 Introduction.
The Von Neumann Model Basic components Instruction processing
Topics Introduction Hardware and Software How Computers Store Data
Data Representation Conversion 05/12/2018.
BIC 10503: COMPUTER ARCHITECTURE
Processor Fundamentals
MARIE: An Introduction to a Simple Computer
ECE 352 Digital System Fundamentals
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

MODULE 1 : WHY PROGRAMMING LANGIUAGES - Overview Programming fundamentals is about knowing how to give instructions in a computer language to the computer system to solve problem, the problem domain. This implies having the basic knowledge of the architecture of the computer machine and its influence on the problem solving process – the instructions to be given. The problem domain equally dictates the solving process and the computer tools, techniques and methods that could be used. Mr. Joseph Ecklu (DCS) Slide 1

Session Objectives At the end of the session, the student will – To enable the user to enlist the help of a computer system in solving problems in the domain of interest – To enable the user to bridge the gap between problem and machine domain Mr. Joseph Ecklu (DCS) Slide 2

Reading List Programming Language Essentials by Bal H.E. and Grune D. (Chapter 1) C.S. French “Computer Science” Fifth Edition (Chapters 13,27, 28) Foundations of Computer Science by Forouzan B. and Mosharraf F (Chapter 9) Mr. Joseph Ecklu (DCS) Slide 3

WHY PROGRAMMING LANGUAGES ? To understand better some of the features found in programming languages AND some of the issues in programming language design It is useful to summarise some well known aspects of the computer machine Mr. Joseph Ecklu (DCS) Slide 4

WHY PROGRAMMING LANGUAGES ? Very broadly a computer machine consists of Common Elements/components -a memory -Central Processing Unit ( CPU ) -Peripheral equipment (Input/Output) Mr. Joseph Ecklu (DCS) Slide 5

WHY PROGRAMMING LANGUAGES ? The Memory contains machine instructions and data -both represented as sequences of bits -grouped into bytes of 8-bits each on most machines - each byte occupies a location in memory and - each location has an address Mr. Joseph Ecklu (DCS) Slide 6

WHY PROGRAMMING LANGUAGES ? The Memory /Program The machine instructions in memory constitute the program At any point in time the machine is in a certain state, determined by the contents of its memory and the state of its peripherals Mr. Joseph Ecklu (DCS) Slide 7

WHY PROGRAMMING LANGUAGES ? The Memory / Program Instruction Pointer ( IP ) very central to the machine’s state it points to the next machine instruction in memory to be executed Flow of control refers to the series of successive values of the instruction pointer manipulating the flow of control is a main issue for many programming languages Mr. Joseph Ecklu (DCS) Slide 8

WHY PROGRAMMING LANGUAGES ? The Memory / Program a John von Neumann Machine a type of machine whose memory can contain both - instructions and - data - and that manipulates the flow control Other machine types exist e.g. data flow machine but the von Neumann machine type is still predominant Mr. Joseph Ecklu (DCS) Slide 9

WHY PROGRAMMING LANGUAGES ? The Memory / Program Program as a sequence of bits A program running on a computer was, and is, a sequence of machine instructions, and thus a sequence of bits Programming the computer by writing this sequence of bits by hand was necessary in the very early days – a very tedious and error prone effort – but was abandoned Mr. Joseph Ecklu (DCS) Slide 10

WHY PROGRAMMING LANGUAGES ? The Memory / Program Program as a sequence of bits Programming using notation was invented to replace programming using bits Assembly language Names were given to - machine instructions - data and - positions in the program Mr. Joseph Ecklu (DCS) Slide 11

WHY PROGRAMMING LANGUAGES ? Figure 1. Shows a short program fragment which counts from 1 to 10 using machine level and low-level notations Machine Code( hex)Assembly language 23fc movl#Ox 1, n compare: 0cb a cmpl#0xa, n 6e0c bgtend…of…loop 06b addl#0x1, n 60e8 bracompare end…of…loop; Mr. Joseph Ecklu (DCS) Slide 12 Fig. 1

WHY PROGRAMMING LANGUAGES ? assembly machine code memory code (hex) location address movl #Ox 1, n 23fc compare 0002 cmpl #0xa, n 0cb a bgt end…of…loop 6e0c0004 addl #0x1, n06b bra compare 60e80006 end..of…loop n Mr. Joseph Ecklu (DCS) Slide 13 Fig. 2

WHY PROGRAMMING LANGUAGES ? The program addresses a memory location called n, Initialises its value to 1 using the assembly instruction ( movl #0x1, n ) ‘move long number 1 to location n’ Mr. Joseph Ecklu (DCS) Slide 14

WHY PROGRAMMING LANGUAGES ? The program then enters a program loop It repeatedly increases the value in n by 1 Until it becomes greater than 10 The loop consists of four instructions Starts by comparing n to the number 10 ( cmpl #0xa, n ) Note : 0xa is hexadecimal notation for decimal 10 Mr. Joseph Ecklu (DCS) Slide 15

WHY PROGRAMMING LANGUAGES ? If the result of this comparison is ‘greater’ the program branches to the location named ( end…of…loop ) which means that the instruction pointer ( IP ) is set to the address of that location – see fig. 2 ( IP = 0007 ) Otherwise the IP is not affected and now points to ( addl #0x1,n ) (IP = 0005 ) which adds 1 to the contents of location n Mr. Joseph Ecklu (DCS) Slide 16

WHY PROGRAMMING LANGUAGES ? A branch instruction ( bra compare ) sets the IP to the address of the location labelled compare ( IP = 0002 ) causing the loop body to be repeated Mr. Joseph Ecklu (DCS) Slide 17

WHY PROGRAMMING LANGUAGES ? Refer to Fig 2. The left column shows the corresponding machine code in hexadecimal notation. The hexadecimal notation is a higher abstraction of the real binary notation of 0s and 1s or bits Mr. Joseph Ecklu (DCS) Slide 18

WHY PROGRAMMING LANGUAGES ? Advantages of Notation Language e.g. Assembly -A big step forward i.e. instead of using bits of 0s and 1s mnemonics such as mov, add, are used - Less cumbersome compared to programming using bits Mr. Joseph Ecklu (DCS) Slide 19

WHY PROGRAMMING LANGUAGES ? Disadvantage of Notation language -Language is machine-specific or machine-dependent Mr. Joseph Ecklu (DCS) Slide 20

WHY PROGRAMMING LANGUAGES ? Machine-independent language the need to have machine-independent programming language led to the development of High-level languages with more problem-oriented notation Mr. Joseph Ecklu (DCS) Slide 21

WHY PROGRAMMING LANGUAGES ? High-level notation Figure 2. Shows a short program fragment which counts from 1 to 10 using high-level notation FORTRAN CodeCOBOL Code DO 2 N = 1, 10 MOVE 1 TO N 2 CONTINUEAGAIN. IF N IS EQUAL TO 10 GOTO END-DEMO ADD 1 TO N GOTO AGAIN END-DEMO Mr. Joseph Ecklu (DCS) Slide 22

WHY PROGRAMMING LANGUAGES ? The Central Processing Unit ( CPU ) it can inspect and modify the memory Mr. Joseph Ecklu (DCS) Slide 23

WHY PROGRAMMING LANGUAGES ? PERIPHERAL EQUIPMENT for human interaction which may include keyboard mouse display unit printer … Mr. Joseph Ecklu (DCS) Slide 24

Session Summary This session has covered the – Importance of computer system in solving problems in variety of areas and domain of interest – Understanding the features found in programming languages programming Mr. Joseph Ecklu (DCS) Slide 25

BASIC COMPUTER ARCHITECUTRE Control Unit C Hi 55 * * * * Bill Auxiliary Storage Input Device c. A.L.U d.. Program Counter b CPU a. address control Trial Questions Mr. Joseph Ecklu (DCS) Slide 26

1. Complete the diagram by joining any missing arrow. 2. Try and identify the parts labeled a, b, c and d. 3. You have just written a program which is currently situated in auxiliary storage. Should you decide to run the program briefly describe how the program will be moved and processed using the diagram above. 4. Address, control and a. are collectively known as Give 2 examples of the part labeled c. Trial Questions Mr. Joseph Ecklu (DCS) Slide 27

Machine Language Assembly Language High Level Language Speedfastest ConvenienceHighest Portability Difficulty Level medium Trial Questions Mr. Joseph Ecklu (DCS) Slide 28

Consider the following codes. Specify which one is machine, assembly or high level a. movl #0x1, n b. 23fc c. if (a > b ) { a = b ; } Trial Questions Mr. Joseph Ecklu (DCS) Slide 29