Introduction to Computer Programming

Slides:



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

SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Systems Software.
Programming Types of Testing.
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computers: Tools for an Information Age
Program Flow Charting How to tackle the beginning stage a program design.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter One An Introduction to Programming and Visual Basic.
CS Computer Science I. BCPL was developed in 1967 as a language for writing operating systems and software compilers In 1970, the creators of the.
Agenda Computer Languages How to Write a Simple C Program
CS-303 Introduction to Programming
CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
LESSON 1 Introduction to Programming Language. Computer  Comprised of various devices that are referred to as HARDWARE.  The computer programs that.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
Introduction to C Programming Language. History of C  C was evolved by Dennis Ritchie at AT&T Bell Laboratories in early of 1970s  Successor of: ALGOL.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Chapter 1: Introduction to Computers and Programming.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Chapter 1 Introduction 2nd Semester H
DDC 2223 SYSTEM SOFTWARE DDC2223 SYSTEM SOFTWARE.
Chapter 5- Assembling , Linking, and Executing Programs
CSCI-235 Micro-Computer Applications
LESSON 1 Introduction to Programming Language
Instructor: Chien-Ho Ko
Computer System and Programming
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Intro to Programming Week # 1 Hardware / Software Lecture # 2
Chapter 1: An Overview of Computers and Programming Languages
CHAPTER 1: Introduction to Computers and Programming
C++ Programming: From Problem Analysis to Program Design
TRANSLATORS AND IDEs Key Revision Points.
and Executing Programs
Computer Programming.
Programming languages and software development
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
Chapter One: An Introduction to Programming and Visual Basic
Programming.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Introduction to Computer Programming
CS IA: Procedural Programming CS IB: Object-Oriented Programming
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Chapter 1 Introduction to Programming
Presentation transcript:

Introduction to Computer Programming

Overview What is programming? What are computer languages and how have they evolved? What is the basic process of programming, including the tools involved?

A step-by-step set of instructions to accomplish a task. Algorithm A step-by-step set of instructions to accomplish a task. Example: Make KoolAid - Fill jug with water - Add KoolAid mix - Stir - Pour from jug into cups

expressed in a Computer Language Computer Program A step-by-step set of instructions to accomplish a task expressed in a Computer Language

Computer Languages Machine Language - Consists of binary codes for very simplistic commands Ex: 1001 (move), 1100 (add) - Codes differ by CPU model - Is the only language a CPU can follow - Using ML Requires detailed knowledge of the CPU/hardware.

Computer Languages ENIAC being programmed Machine Language Univ of Penn, 1940’s (photo: U.S. Army)

Computer Languages Assembly Language - Consists of text codes for very simplistic commands Ex: ADD, SUB, MOVE - Codes differ by CPU model - 1-to-1 translation to Machine Language - Using Assembly requires detailed knowledge of the CPU/hardware

Computer Languages High Level Language - Consists of text codes for more complex expressions - Codes standardized across CPU models - 1-to-Many translation to Machine Language - Does not require detailed knowledge of the CPU/hardware.

Computer Languages ML vs ASSM vs HLL Assembler: Machine Lang: MOV @065 to CPU:R1 10010001 01000001 MOV @066 to CPU:R2 10010010 01000010 ADD 01010000 MOV CPU:REG3 to @067 10100010 01000011 High Level Language: x = a + b

Early High Level Languages Computer Languages Early High Level Languages Fortran (FORMula TRANSlation) - by IBM, 1950’s - Number cruncher for mathematicians, scientists and engineers. - Ex: A = 3.1415926 * R * R; - Very poor at manipulating “pretty” output and large volumes of data.

Early High Level Languages Computer Languages Early High Level Languages COBOL (COmmon Business Oriented Language) - by committee, funded by DoD, 1960 - For business/management apps: does “pretty” and handles large volumes of data easily. - Very English-Like. Ex: ADD SUBTOTAL TO TAX GIVING TOTAL.

Computer Languages High Level Languages C - by Dennis Ritchie (AT&T), 1972 - Combines ease-of-use of a HLL with the “power” of Assembly - Used to write efficient systems software (Unix Operating System)

Accomplishing a task using the least amount of resources. Computer Languages Efficiency Accomplishing a task using the least amount of resources. In Programming, “resources” are: - Time (number of instructions executed) - Space (amount of memory required)

Today: one of the most common languages. Computer Languages High Level Languages C++ - By Bjarne Stroustrup (AT&T), 1983 - Enhancement of C: major items: - Object-Oriented Programming - Extensibility: programmers can add new features to the language itself. Today: one of the most common languages.

Programming Process Tools, Files and Errors

Programming Process Software Tools Editor – used to write the program in a HLL. Compiler – translates program in a HLL into Machine (or other low level) Language Linker – combines Object Files into an Executable. Loader – copies an Executable into memory and starts program execution.

Programming Process Software Tools Integrated Development Environment (IDE) Combines the editor, compiler, linker, loader and often other helpful tools into one programming tool. Example: Microsoft Visual Studio IDE

Programming Process Files Source – a text file containing a program written in a HLL Object – part of a program translated in Machine Language Executable – a complete program in Machine Language

Programming Process Errors Syntax (aka Compiler) – found in the Source, these are violations of the rules for writing programs in the HLL. Link – the linker is unable to link the object files into an executable. Typical errors indicate something is missing or the parts (objects) do not “fit” together as expected.

Programming Process Errors Load – the loader is unable to copy the executable into memory and start execution. Typical errors include “not enough memory” or “not a trusted program” (virus protection). Run-Time – occurs during execution. Typical errors include “division by 0”, “file not found”, “memory access violation”. Execution halts when a RTE occurs; normally called a “program crash” and may not have an error message.

Programming Process Errors Logic (Semantic) – when there is no error from the perspective of the computer, but rather the program does something unexpected by the user. Example: The program prints: The area of a square with a length of 3m is 6m2

Errors Bug informal name for a Logic (or Run-Time) Error Programming Process Errors Bug informal name for a Logic (or Run-Time) Error

Conclusion - Programming is writing instructions for a computer to follow. - Various languages have been invented over the years to assist programmers. - While variations exist, there is a basic process for writing code in a HLL and translating it into ML, including use of a basic set of tools.

Vocabulary Term Definition Algorithm A step-by-step set of instructions to accomplish a task Program A step-by-step set of instructions to accomplish a task expressed in a computer language. Machine Language Binary computer language that differs by CPU model…the only language a computer can follow. Assembly Language Language made up of simple text codes for simplistic instructions. It differs by CPU model and has a 1-to-1 translation of commands into Machine Language. High Level Language Language made up of more complex and human-language-like codes with a 1-to-many translation of commands into Machine Language. FORTRAN Early language used to solve mathematical/scientific/engineering problems. COBOL Early language used for business data processing. C Language combining the functionality of a HLL with that of Asssembly, used to write Systems Software.

Vocabulary Term Definition C++ An enhancement of the C language providing support for Object-Oriented Programming and language Extensibility. Extensibility The ability of a programmer to extend an existing language with new features. Editor Software tool that allows a programmer to write a program in a HLL. Compiler Software tool that translates a program in a HLL into Machine Language. Linker Software tool that combines Object Files into a single Executable. Loader Software tool that copies an Executable into memory and initiates program execution. Source File Text file that contains a program written in a HLL. Object File File that contains instructions in Machine Language, but is not a complete program. Executable File File that contains instructions in Machine Language that is a complete program.

Vocabulary Term Definition Syntax Error Violation of a HLL rule in a Source File, discovered by the Compiler Compiler Error (same as Syntax Error) Link Error Error meaning the Linker is unable to combine Object Files into an Executable Load Error Error meaning the Loader is unable to copy an Executable into memory and initiate program execution. Run-Time Error Error that occurs while a program is executing, causing the program to halt. Logic Error Unexpected output/behavior of a program when there is no other type of error. Semantic Error (same as Logic Error) Bug Informal word meaning Logic (or Run-Time) Error