Introduction to computers and programming RIZWAN REHMAN Assistant Professor Centre For Computer Studies.

Slides:



Advertisements
Similar presentations
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Introduction to Computer Programming Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Introduction to Computers and Programming - Class 1 1 Introduction to Computers and Programming Professor Avi Rosenfeld.
1 Chapter 1 Introduction to Object-Oriented Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Computers and Programming Using Java -- Fall, 2006 Professor Deena Engel V : Section 3 Office hours: Mondays.
Java Environment (CSS444)
Introduction to Computers and Programming Using Java Professor Deena Engel V : Sections 1 and 4 Office hours: Tuesdays & Thursdays.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 1 – Introduction to Computers and C++ Programming.
Introduction to Computers and Programming Using Java Professor Deena Engel V : Section 1 Office hours: MW 12:00 - 1:00 in room.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers and C++ Programming Outline 1.1Introduction 1.2What Is a Computer?
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
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
1 6 Abacus An early device to record numeric values Blaise Pascal Mechanical device to add, subtract, divide & multiply Joseph Jacquard Jacquard’s Loom,
CSL101 : Introduction to computers and programming Instructor : Neelima Gupta.
CS102 Introduction to Computer Programming
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
Chapter Introduction to Computers and Programming 1.
1 Chapter 1 - Introduction to Computers, the Internet, and the World Wide Web Outline 1.1Introduction 1.2What Is a Computer? 1.3Computer Organization 1.4Evolution.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Lecture 1 Introduction to computers & VB.Net. What is a Computer? Examples? A device capable of  Performing computation  Making logical decisions 
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
Introduction to the Computer System. What is a computer ? A computer is an electronic device that can accept data and instruction, process them or store.
Computer Programming I. Today’s Lecture  Components of a computer  Program  Programming language  Binary representation.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Computer Organization Six logical units in every.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introduction to Computers Outline 1.1Introduction.
 2006 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 Introduction to Computers, the Internet and.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
1 MIS 131 Introduction to Algorithms and Programming 2015/2016 Fall - Chapter 1 -
School of Computer Science & Information Technology G6DICP Introduction to Computer Programming Milena Radenkovic.
1 Programming Fundamentals How to Program in C++ How to Program in C++
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 1 - Introduction to Computers, the Internet, and the World Wide Web Outline 1.1Introduction 1.2What.
Computer Organization & Assembly Language © by DR. M. Amer.
Spring 09- ICE0124 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 1.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers, the Internet and the World Wide Web Outline 1.1Introduction 1.2What.
CS2301:Computer Programming 2
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
CHAPTER 1.1 INTRODUCTION TO COMPUTERS AND C++ Dr. Shady Yehia Elmashad.
Chapter 1 An Overview of Computers and Programming Languages.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
 2001 Prentice Hall, Inc. All rights reserved.
Chapter 1 – Introduction to Computers, the Internet, and the Web
Outline Introduction What Is a Computer? Computer Organization
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Introduction to Programming
Chapter 1 – Introduction to Computers and C++ Programming
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: Introduction to Computers and Programming
CSL101 : Introduction to computers and programming
Overview of Computer Architecture and Organization
Chapter 1 – Introduction to Computers and C++ Programming
Introduction to Computer Programming
Chapter 1 – Introduction to Computers and C++ Programming
Chapter 1 – Introduction to Computers and C++ Programming
Presentation transcript:

Introduction to computers and programming RIZWAN REHMAN Assistant Professor Centre For Computer Studies

Course contents (First Two Units) Unit 1. A Model of a Computer System - Block diagram, Machine Language, High level language, Compiler, interpreter, I/O devices. Unit 2. Problem Analysis, Flow charts, Decision tables, Pseudo codes and Algorithms.

Course Text Book  Dromey, G. : How to solve it by computer, PHI ( EEE)  David Griffiths :Head First C, Shroff/O'Reilly; First edition (18 May 2012)  T Jeyapoovan: Programming with C, Vikas Publication.

What is a Computer?  Computer  Device capable of performing computations and making logical decisions  Computers process data under the control of sets of instructions called computer programs  Hardware  Various devices comprising a computer  Keyboard, screen, mouse, disks, memory, CD-ROM, and processing units  Software  Programs that run on a computer

Computer Organization  Six logical units in every computer:  Input unit  Obtains information from input devices (keyboard, mouse)  Output unit  Outputs information (to screen, to printer, to control other devices)  Memory unit  Rapid access, low capacity, stores input information  Arithmetic and logic unit (ALU)  Performs arithmetic calculations and logic decisions  Central processing unit (CPU)  Supervises and coordinates the various components of the computer  Secondary storage unit  Cheap, long-term, high-capacity storage  Stores inactive programs

Computer Architecture

A Computer Consists of  a central processing unit (CPU) consists of  an arithmetic/logic unit (ALU) where math and logic operations are performed,  a control unit which directs most operations by providing timing and control signals,  and registers that provide short-term data storage and management facilities.  a memory unit that stores instructions and data, and  input (e.g. keyboard, mouse, microphone, disk drive, etc.) and output (e.g. monitor, status indicator lights, speakers, disk drive, etc.) units that are used to transmit data into and out of the computer.

ALU  A : The type of operation that the ALU needs to perform is determined by signals from the control unit.  B: The data can come either from the input unit, or  C: from the memory unit.  D: Results of the operation can either be transferred back to the memory unit or  E: directly to the output unit.

The memory unit - or random access memory (RAM) -  stores instructions and/or data.  Memory is divided into an array of "boxes" each containing a byte of information.  A byte consists of 8 bits.  A bit (binary digit) is either 0 (OFF) or 1 (ON).  The memory unit also serves as a storage for intermediate and final results of arithmetic operations.  F : Control signal (a read or a write operation).  G : A location in memory  H : Input to memory data lines when the control signal J is enabled.  I : Memory to the output unit when the control signal L is enabled.

Control Unit  contains logic and timing circuits that generate the appropriate signals necessary to execute each instruction in a program.  It fetches an instruction from memory by sending an address (G) and  a read command (F) to the memory unit.  The instruction word(s) stored at the memory location specified by the address is then transferred to the control unit (K).  After decoding this instruction, the control unit transmits the appropriate signals to the other units in order to execute the specified operation.  This sequence of fetch and execute is repeated by the control unit until the computer is either powered off or reset.

Common Softwares  Operating System  Compilers  Assemblers  Interpreters

What Is an Operating System?  An interface between the hardware and the user.  Provides an easy and efficient use of the system resources.

Evolution of Operating Systems  Single_user Batch processing  Do only one job or task at a time  Early Operating systems  Manage transitions between jobs (minimizing transition time between jobs)  Increased throughput  Amount of work computers process  Multiprogramming  Computer resources are shared by many jobs or tasks (users still waited a long time for their output)  Timesharing (access computers via terminals)  Computer runs a small portion of one user’s job then moves on to service the next user

Programming Language : Definition  A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks.computer

Evolution of Programming languages  First Generation : Machine languages  Strings of numbers giving machine specific instructions  Example:  Second Generation : Assembly languages  English-like abbreviations representing elementary computer operations (translated via assemblers)  Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY  Third Generation : High-level languages  Codes similar to everyday English  Use mathematical notations (translated via compilers)  Example: grossPay = basePay + overTimePay

PL hierarchy

What does the computer understand?  Computer only understands machine language instructions.

Assembler  Instructions written in assembly language must be translated to machine language instructions :  Assembler does this  One to one translation : One AL instruction is mapped to one ML instruction.  AL instructions are CPU specific.

Compiler  Instructions written in high-level language also must be translated to machine language instructions :  Compiler does this  Generally one to many translation : One HL instruction is mapped to many ML instruction.  HL instructions are not CPU specific but compiler is.

Translation from HLL to ML

Interpreter  An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high-level instructions directly into machine language. compiler machine language  Compiled programs generally run faster than interpreted programs.  The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time- consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. For this reason, interpreters are sometimes used during the development of a program, when a programmer wants to add small sections at a time and test them quickly.programmer

Structured Programming  Structured programming  Disciplined approach to writing programs  Clear, easy to test and debug and easy to modify  Structured programming is hard and takes time to master

Structured Programming contd..  A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having a single entry and a single exit point, and in which control is passed downward through the structure without unconditional branches to higher levels of the structure.codingcomputer  Three types of control flow are used: sequential, test, and iteration

Structured programming  Only the following code structures are used to write programs: 1. Sequence of sequentially executed statements. 2. Conditional execution of statements (i.e., "if" statements). 3. Looping. 4. Structured SubRoutine calls (e.g., 'gosub' but not 'goto').SubRoutine

Structure Programming contd.. In particular, the following language usage is forbidden:  "GoTo" statements.GoTo  "break" or "continue" out of the middle of loops.  Multiple exit points to a function/procedure/subroutine (i.e., multiple "return" statements).  Multiple entry points to a function/procedure/subroutine.

Structured Programming contd..  Structured Programming is generally a non-issue when doing ModularProgramming or ObjectOrientedProgramming as it's assumed that individual methods are structured.ModularProgramming ObjectOrientedProgramming

Structured VS unstructured Languages  Structured languages, such as Pascal, Ada and dBASE, force the programmer to write a structured program.  Unstructured languages such as FORTRAN, COBOL and BASIC require discipline on the part of the programmer to write a structured program.

Structured VS unstructured Languages  Unstructured languages define control flow largely in terms of a GOTO command that transfers execution to a label in code. Structured programming languages provide constructs (often called "if-then-else", "switch", "unless", "while", "until", and "for") for creating a variety of loops and conditional branches of execution, although they may also provide a GOTO to reduce excessive nesting of cascades of "if" structures, especially for handling exceptional conditions.  Strictly speaking, in a structured programming language, any code structure should have only one entry point and one point of exit; many languages such as C allow multiple paths to a structure's exit (such as "continue", "break", and "return"), which can bring both advantages and disadvantages in readability.C

The Key Software Trend: Object Technology  Objects  Reusable software components that model items in the real world  Meaningful software units  Date objects, time objects, paycheck objects, invoice objects, audio objects, video objects, file objects, record objects, etc.  Any noun can be represented as an object  More understandable, better organized, and easier to maintain than procedural programming