1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.

Slides:



Advertisements
Similar presentations
compilers and interpreters
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Chapter 1 - An Introduction to Computers and Problem Solving
CSE123 Introduction to Computing Lecture 1 Introduction Engineering Problem Solving.
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.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
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.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
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.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Systems Software Operating Systems.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
CS102 Introduction to Computer Programming
Tools make jobs easier to do -A computer is a tool used by many professions A computer can do many different jobs because they are programmable - Machine.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
© 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.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
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.
 Why?  Because it can be programmed to do more than one specific task. ◦ Accountants ~ tax forms etc. ◦ Machinists ~ control drilling, lathes etc. ◦
Visual C++ Programming: Concepts and Projects
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
CSE123 Introduction to Computing Lecture 1 – Introduction to Computers 1.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
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.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Program Planning and Design Important stages before actual program is written.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Introduction to Computer Programming using Fortran 77.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 1: Introduction to Computers and Programming.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Software Engineering Algorithms, Compilers, & Lifecycle.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
Operating System Interface between a user and the computer hardware
CSCI-235 Micro-Computer Applications
Introduction to Visual Basic 2008 Programming
CS190/295 Programming in Python for Life Sciences: Lecture 1
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
WJEC GCSE Computer Science
Programming Logic and Design Eighth Edition
Presentation transcript:

1 Computing Software

Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand when read a few months later, in order to correct or update them. Thus, it is extremely important to develop the art of writing programs that are well structured, with all of the logic clearly described. This is known as programming style. Elements of good programming style include: 1. Use comments liberally, both at the beginning of a script, to describe briefly what it does and any special methods that may have been used, and also throughout the script to introduce different logical sections.

2. Describe each variable briefly in a comment when it is initialized. 3. Separate sections of code with blank lines. 4. Indent multiple line structures to make them stand out as a logical unit. 5. Use spaces in expressions to make them more readable (for example, on either side of operators and equal signs).

Computing Software Before discussing MatLab in more detail, a brief discussion on computing software is useful. Computer software contains the instructions or commands that the computer is to execute. Categories include:  System software  Languages  Tools

System Software Computer system software provides: 1. An interface between the user and the hardware 2. An environment for developing, selecting, and executing software. The operating system is the most important part of the systems software, managing:

 The individual user sessions on multiuser computer systems.  The division of CPU time across various tasks.  The random access memory, or RAM, where both instructions and data are stored.  The secondary storage systems, such as disk drives, CD-ROM drives, tape drives, or any other device in which information is stored in binary form on some medium. Information in secondary storage is organized into units called files. When a computer is turned on, it loads the operating system into RAM (usually from secondary storage) before a user can execute a program.

The system software may also include one or more command shells:  Programs that direct the interaction with users. In most cases, when a you type a command, you are interfacing with the shell.  Early shells provided a ” text ” only interface, but modern computers (particularly personal computers) have graphical user interfaces (GUIs) that allow users to express what they want to do by using a pointing device and selecting among choices displayed on the screen.

System software also includes:  Language compilers  Text editors  Utilities for file management  Utilities for printing

Computer Languages Computer languages are used to develop programs to be executed. They can be described in terms of levels. Machine language:  Lowest-level language  Binary-encoded instructions that are directly executed by the hardware.  Language is closely tied to the hardware design.  Machine specific: machine language for one computer is different from that of a computer having a different hardware design.

Assembly language:  Also unique to a specific computer design.  Commands or instructions are written in text statements instead of numbers.  Assembly language programming requires good knowledge of the specific computer hardware. This is a tedious process, but it results in programs that are very fast, because they take advantage of the specific computer hardware.  System software called an assembler translates the assembly language program to a machine language program for execution on the hardware.

High-level languages:  Have English-like command syntax.  Include languages such as Basic, Fortran, COBOL, Pascal, Ada, C, C++, and Java.  Supported on many computer designs and knowledge of the specific hardware is not as critical in writing a program.  System software called a compiler translates the program into machine language.

Compilation Process:  Original program is called the source program  Translated machine language program is called the object program.  Errors detected by the compiler (called compile errors or syntax errors) must be corrected and compilation performed again.  The process of compiling, correcting errors (or debugging) must often be repeated several times before the program compiles without compile errors.

Execution Process:  To prepare the object program for execution, system software is applied to link other machine language statements to the object program and then load the program into memory.  The program is executed and new errors, called execution errors, run-time errors or logic errors (also called bugs) may be identified.  These program errors are caused when the programmer errs in determining the correct steps to be taken in the problem solution, such as an attempt to divide by zero.  These errors must be corrected in the source program, which must again be compiled and link- loaded for execution.

High-Level Language Program Development

Even when a program executes without an error message, the results must be checked carefully to be sure that they are correct. The computer performs the steps precisely as specified in the source; if the wrong steps are specified, the computer will execute these wrong (but syntactically correct) steps and produce a result that is incorrect.

Computing Terminology Definitions of computing terms:  Command: A user-written statement in a computer language that provides instructions to the computer.  Variable: The name given to a quantity that can assume a value.  Default: The action taken or value chosen if none has been specified.  Toggle: To change the value of a variable that can have one of two states or values. For example, if a variable may be ” on ” or ” off ” and the current value is ” on, ” to toggle would change the value to ” off. ”  Arguments: The values provided as inputs to a command.  Returns: The results provided by the computer in response to a command.  Execute: To run a program or carry out the instructions specified in a command.  Display: Provide a listing of text information on the computer monitor or screen.  Echo: To display commands or other input typed by the user.  Print: To output information on a computer printer (often confused with ” display ” in the text-book).

Brian Kernighan ’ s Programming Style Tips  Say what you mean, simply and directly.  Use the “ telephone test ” for readability.  Write clearly - don ’ t be too clever.  Don ’ t use conditional expressions as a substitute for a logical expression.  Parenthesize to avoid ambiguity.  Each time you make a test, do something.  Follow each decision as closely as possible with its associated action.  Use the good features of a language; avoid the bad ones.  Capture regularity in control flow, irregularity in data.  Each module should do one thing well.  Make sure comments and code agree.

 Don ’ t just echo the code with comments - make every comment count.  Don ’ t comment bad code - rewrite it.  Use symbolic constants for magic numbers.  Watch out for side effects and order of evaluation.  Macros are not functions.  Watch out for off-by-one errors.  Test programs at their boundaries.  Program defensively.  Make sure input cannot violate the limits of the program.  Make it right before you make it faster.  Keep it right when you make it faster.  Don ’ t sacrifice clarity for small gains in “ efficiency. ”  Don ’ t stop with your first draft.