17 March, 2000 CS1001 Lecture 2 Programming and problem solving Software engineering practices.

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Programming Types of Testing.
Python Programming: An Introduction to Computer Science
 2005 Pearson Education, Inc. All rights reserved Introduction.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Program Flow Charting How to tackle the beginning stage a program design.
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
27 March, 2000 CS1001 Lecture 16 FUNCTIONS SUBROUTINES SCOPE MODULES EXTERNAL SUBPROGRAMS.
2.4 The Assignment Statement Values are assigned to variables using the assignment statement : variable = expression Examples: Ex.1: REAL :: XCoordinate,
1 BIL106E Introduction to Scientific & Engineering Computing.
Top-down Program Design Selim Aksoy Bilkent University Department of Computer Engineering
Program Design, Relational and Logical Operators Selim Aksoy Bilkent University Department of Computer Engineering
Guide To UNIX Using Linux Third Edition
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1 Program Design
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
Chapter 3 Planning Your Solution
BPC.1 Basic Programming Concepts
1 Chapter Two Introduction to the Programming Language C.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Computer Science 101 Introduction to Programming.
Introduction to High-Level Language Programming
6 Steps of the Programming Process
Introduction to FORTRAN-90 University of Liverpool course.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
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.
Simple Program Design Third Edition A Step-by-Step Approach
CSC141 Introduction to Computer Programming
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 2.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Programming Lifecycle
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
1 Week 2 n Organizational matters n Fortran 90 (subset F): Basics n Example programs in detail.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
1 Program Planning and Design Important stages before actual program is written.
Program Development C# Programming January 30, 2007 Professor J. Sciame.
PROGRAMMING in FORTRAN BSYSE 595 Joan Wu, WSU, Pullman, WA.
The Hashemite University Computer Engineering Department
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Introduction to Computer Programming using Fortran 77.
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.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Engineering Problem Solving With C An Object Based Approach
Chapter 1: Introduction to computers and C++ Programming
Completing the Problem-Solving Process
Lecture 1: Introduction to JAVA
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Presentation transcript:

17 March, 2000 CS1001 Lecture 2 Programming and problem solving Software engineering practices

17 March, 2000 Introduction Use computers as a problem solving tool A computer program is a sequence of instructions that must be followed to solve a particular problem. Software engineering is the study and application of programming and problem solving techniques and methodologies

17 March, 2000 Simple Program Design Process Start Specify & analyze the problem you are trying to solve Test the resulting Fortran program Convert algorithm into Fortran statements Design the algorithm Define required inputs and outputs Finished!

17 March, 2000 Problem Statement A nuclear physicist is conducting research with the radioactive element polonium. The half-life of polonium is 140 days, which means that because radioactive decay, the amount of polonium that remains after 140 days is one-half of the original amount. How much polonium will remain after 180 days if 10 milligrams are present initially. What information is given? … which ones are important ? What information must be produced?

17 March, 2000 Data analysis and organization Specific InputOutput Initial amount: 10 mgAmount remaining Half-life: 140 days Time period: 180 days Generalize InputOutput Initial amountAmount remaining Half-life Time period InitialAmount HalfLife Time AmountRemaining

17 March, 2000 Algorithm Design & Refinement Get values for InitialAmount, HalfLife, and Time Compute the value of AmountRemaining for a given Time Display AmountRemaining AmountRemaining = InitialAmount*(0.5)**(Time/HalfLife) Assignment = multiplication * division / raise to power ** Logics errors

17 March, 2000 Coding General form of Fortran program: Heading specification execution subprogram END PROGRAM Documentation –Opening documentation –

17 March, 2000 Coding PROGRAM Radioactive_Decay ! ! This program calculates the amount of a radioactive ! substance that remains after a specified time, given ! an initial amount and its half-life. Variables used are: ! InitalAmount : initial amount of substance (mg) ! HalfLife : half-life of substance (days) ! Time : time at which the amount remaining ! is calculated (days) ! AmountRemaining : amount of substance remaining (mg) ! ! Input: InitialAmount, HalfLife, Time ! Output: AmountRemaining ! ! Use for Comments Program heading Opening documentation Other useful information: author, date, version number, etc.

17 March, 2000 IMPLICIT NONE REAL :: InitialAmount, HalfLife, Time, AmountRemaining ! Get values for InitialAmount, HalfLife, and Time. PRINT *, "Enter initial amount (mg) of substance, & &its half-life (days)" PRINT *, "and time (days) at which to find amount remaining:" READ *, InitialAmount, HalfLife, Time ! Compute the amount remaining at the specified time. AmountRemaining = InitialAmount * 0.5 ** (Time / HalfLife) ! Display AmountRemaining. PRINT *, "Amount remaining =", AmountRemaining, "mg" END PROGRAM Radioactive_Decay Prompt for, and obtain input PRINT, READ Display the result as an output PRINT END PROGRAM statement Specification Continuation Execution

17 March, 2000 Preparing a Program for Execution You enter the program and save it as a source file The compiler attempts to translate the program You correct syntax error The linker links the new object file with other object files The loader places the load file into memory Executable program in memory Load File Source file on disk New Object File Other Object File Revised Source file List of errors Oops! Good job! Syntax or compile-time errors Run-time errors

17 March, 2000 Testing Initial test -- the ones that you can calculate easily by hand. E.g.: – InitialAmount = 2, HalfLife=140, Time=140. AmountRemaining should = mg –InitialAmount = 4, HalfLife=140, Time=280. AmountRemaining should = mg. –Then InitialAmount = 10, HalfLife=140, Time=180. AmountRemaining= mg “Once we are confident that the program is correct” –what? when? how? how much?

17 March, 2000 More Realistic Process Start Specify & analyze the problem you are trying to solve Test the resulting Fortran program Convert algorithm into Fortran statements Design the algorithm Define required inputs and outputs Decomposition Stepwise refinement Release Maintain the resulting Fortran program End of life

17 March, 2000 A typical testing process for a large program Start Unit testing of individual subtasks Beta release Alpha release Successive builds (adding subtasks to the program) Release -- a little breather ! Subtasks validated separately As many times as necessary Subtasks combined into programs Major bugs fixed Minor bugs fixed As many times as necessary

17 March, 2000 Program Design Tips This process is often iterative because you may not initially know what all you want to print out, or input. –Design a little –Code a little –Test a little –Take a break –Repeat until finished

17 March, 2000 Summary Program solving process, SE process Fortran statements: PROGRAM program_name IMPLICIT NONE REAL:: list_of_real_variables INTEGER:: list_of_integer_variables Comments ! Continuation & Operations + - * / ** Assignment = Input READ*, input_list_of_variables Output PRINT *, output_list_of variables END PROGRAM program_name