Libraries of Code Notes from Wilson, Software Design and Development Preliminary Course pp137-140.

Slides:



Advertisements
Similar presentations
Driving Test 1 Marking Scheme Focus on five areas to pass driving test 1.
Advertisements

Review What is a virtual function? What can be achieved with virtual functions? How to define a pure virtual function? What is an abstract class? Can a.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Chapter 3: Modularization
Chapter 2: Modularization
 Draft timetable has the same times as this semester: - ◦ Monday 9:00 am to 12:00 noon, 1:00 pm to 3:00 pm. ◦ Tuesday 9:00 am to 12:00 noon, 1:00 pm.
Chapter 10.
16/11/2015 9:05 AM6/11/2015 9:05 AM6/11/2015 9:05 AMFunctions Functions A function consists of: Name Name Arguments (also called parameters) Arguments.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
FunctionsFunctions Systems Programming. Systems Programming: Functions 2 Functions   Simple Function Example   Function Prototype and Declaration.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
FunctionsFunctions Systems Programming Concepts. Functions   Simple Function Example   Function Prototype and Declaration   Math Library Functions.
Functions. Program complexity the more complicated our programs get, the more difficult they are to develop and debug. It is easier to write short algorithms.
Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.
Beginning C++ Through Game Programming, Second Edition by Michael Dawson.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
E0001 Computers in Engineering Procedures: subprograms and functions.
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
COMPUTER PROGRAMMING. Functions What is a function? A function is a group of statements that is executed when it is called from some point of the program.
Functions. Type of Subprograms Fortran 90/95 allows for two types of subprograms: –Functions, and –Subroutines. In general, there are two forms of subprograms:
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
CPS120: Introduction to Computer Science Functions.
David Stotts Computer Science Department UNC Chapel Hill.
Writing JavaScript Functions. Goals By the end of this unit, you should understand … How to breakdown applications into individual, re-usable modules.
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Computing Higher – SD Unit - Topic 8 – Procedure and Standard Algorithms P Lynch, St Andrew’s High School Unit 2 Software Development Process Topic.
Modularity using Functions Chapter 4. Modularity In programming blocks of code often can be "called up" and reused whenever necessary, for example code.
Visual Basic CDA College Limassol Campus COM123 Visual Programming 1 Semester B Lecture:Pelekanou Olga Week 5: Useful Functions and Procedures.
Chapter 6 Methods Chapter 6 - Methods.
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
Fundamental Programming Fundamental Programming Introduction to Functions.
Functions Dilshad M. Shahid New York
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
Introduction to Programming Lecture 6. Functions – Call by value – Call by reference Today's Lecture Includes.
Programming Fundamentals Enumerations and Functions.
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
Lecture 3 Translation.
Unit 2 Technology Systems
Lesson 06: Functions Class Participation: Class Chat:
Functions + Overloading + Scope
Topic: Functions – Part 1
Python Programming Module 3 Functions Python Programming, 2/e.
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
Topic: Functions – Part 2
The Selection Structure
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Function There are two types of Function User Defined Function
C-language Lecture By B.S.S.Tejesh, S.Neeraja Asst.Prof.
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Functions.
Using local variable without initialization is an error.
Functions Declarations CSCI 230
Subroutines Web Programming.
Machine Independent Features
Functions, Procedures, and Abstraction
Functions A function is a “pre-packaged” block of code written to perform a well-defined task Why? Code sharing and reusability Reduces errors Write and.
Lesson 06: Functions Class Chat: Attendance: Participation
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
Assignment Preliminaries
Classes.
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Data Dictionary Overview
CPS125.
Functions, Procedures, and Abstraction
Presentation transcript:

Libraries of Code Notes from Wilson, Software Design and Development Preliminary Course pp137-140

What is a Library of Code? A set of routines or modules stored for future use Module should work independently Module should contain Local variables Identifiers Assignment statements that assign values to variables used only within that module

Why have a Library of Code Can copy from Library into a program If truly independent will need little or no modification Will reduce time needed to code a program Will reduce time needed to test the program (because the library code should already have been tested)

Reusable Code Reusable code are standard routines Reusable code often is used to Data validation Checking format of data entered is valid for e.g. checking the user entered a valid date Date conversion Put date entered into format you need for your code. For e.g. 25th August 2006 -> 25-08-2006 Converting words to numbers Once coded and tested reusable code can be stored in a library and reused in many programs

Using Libraries of Code Copy and Paste Calling Modules As a subprogram The main program calls the module, follows the module’s instructions, then returns control to main program As a function Works similar to a subprogram, but always returns a value to the main program code Subprograms and functions are often passed variables from the main program

Sharing Variables between Main Program and Modules Variables can be defined as Global or Local GLOBAL variables can be seen from anywhere in the main program or modules LOCAL variables are used within modules and cannot be recognised by the main program or other modules

Pseudocode Example of main program and modules begin declare globalvariable1 as number globalvariable2 as date localvariable1 as number localvariable2 as date localvariable3 as number do subprogram1 localvariable3 = function1(localvariable1,localvariable2) subprogram1 statement1 statement2 statement3 end function1 (localvariable 4 as number, localvariable 5 as date) localvariable6 as number localvariable4 = localvariable6 Example subprogram, follows steps passes no variable Example function, follows steps does pass variable