Five Guidelines for Robust Reusable Code

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 4 Modular Programming with Functions.
Advertisements

User Defined Functions
Software development process. Explanation of the iterative nature of the software development process.
Pass by Value. COMP104 Pass by Value / Slide 2 Passing Parameters by Value * A function returns a single result (assuming the function is not a void function)
Copyright Ó Oracle Corporation, All rights reserved Sharing Objects and Code.
Software Engineering and Design Principles Chapter 1.
Classes. Object-Oriented Design Method for designing computer programs Consider “objects” interacting in the program –Example: a zoo, a gradebook.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 6 Functions.
Programming with Objects: Class Libraries and Reusable Code.
An Introduction to Programming with C++ Fifth Edition Chapter 10 Void Functions.
FunctionsFunctions Systems Programming. Systems Programming: Functions 2 Functions   Simple Function Example   Function Prototype and Declaration.
MADALINA CROITORU Software Engineering week 4 Madalina Croitoru IUT Montpellier.
CSE 303 – Software Design and Architecture
Chapter 6 Functions 1. Opening Problem 2 Find the sum of integers from 1 to 10, from 20 to 37, and from 35 to 49, respectively.
CS0004: Introduction to Programming Subprocedures and Modular Design.
SE: CHAPTER 7 Writing The Program
Subprograms CE 311 K - Introduction to Computer Methods Daene C. McKinney.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 7 Clicker Questions September 22, 2009.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Procedural Programming Criteria: P2 Task: 1.2 Thomas Jazwinski.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Functions Outline 5.1Introduction 5.2Program Modules.
KIC/Computer Programming & Problem Solving 1.  Introduction  Program Modules in C  Math Library Functions  Functions  Function Definitions  Function.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 5A Repetition (Concepts)
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
1 Brief Version of Starting Out with C++, 4th Brief Edition Chapter 6 Functions.
Jump to first page (C) 1998, Arun Lakhotia 1 Design Quality Metrics Arun Lakhotia University of Southwestern Louisiana Po Box Lafayette, LA 70504,
Design and Planning Or: What’s the next thing we should do for our project?
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Modularity using Functions Chapter 4. Modularity In programming blocks of code often can be "called up" and reused whenever necessary, for example code.
Introduction to OOP CPS235: Introduction.
Object-Oriented Design Concepts University of Sunderland.
Lecture 4 – Function (Part 1) FTMK, UTeM – Sem /2014.
Lesson 9: Modular Programming Todd A. Boyle, Ph.D. St. Francis Xavier University.
Chapter 6 Functions. 6-2 Topics 6.1 Modular Programming 6.2 Defining and Calling Functions 6.3 Function Prototypes 6.4 Sending Data into a Function 6.5.
JavaScript Modularity. Goals By the end of this lecture, you should … Understand why programmers use modularity. Understand how to create a function in.
Variable Scope MacDonald Ch. 2-3 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Sub Procedures and Functions Visual Basic. Sub Procedures Slide 2 of 26 Topic & Structure of the lesson Introduction to Modular Design Concepts Write.
World of Wokcraft The very best in Single pan cooking themed fantasy gaming!
Lesson 3 Functions. Lesson 3 Functions are declared with function. For example, to calculate the cube of a number function function name (parameters)
Programming Right from the Start with Visual Basic .NET 1/e
CS1010 Discussion Group 11 Week 5 – Functions, Selection, Repetition.
TK1924 Program Design & Problem Solving Session 2011/2012
Visit for more Learning Resources
Oracle11g: PL/SQL Programming Chapter 5 Procedures.
Review What is an object? What is a class?
About the Presentations
Function There are two types of Function User Defined Function
Using local variable without initialization is an error.
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
6 Chapter Functions.
Qbasic Modular Programming.
PROGRAMMING Sub Procedures I.
Programming Logic and Design Fourth Edition, Comprehensive
Information Flow Metric
Topics Introduction to Functions Defining and Calling a Function
Software development process
Fundamental Programming
Object-Oriented PHP (1)
Chapter 10: Void Functions
Classes.
CPS125.
Lesson 3. Controlling program flow. Loops. Methods. Arrays.
Introducing Modularity
C Parameter Passing.
Presentation transcript:

Five Guidelines for Robust Reusable Code Code Optimization Five Guidelines for Robust Reusable Code 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 1

Code Optimization: Yvonne V. Richardson, BSCS, M. Ed Five Major Concepts Modularity Maintainability Re-usability Robustness 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 2

Code Optimization: Yvonne V. Richardson, BSCS, M. Ed Five Major Concepts Use the MVC Model Respect the Task-Method Correspondence Pass Few Parameters Declare Variables Locally Minimize Scope of Method Calls 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 3

Code Optimization Guideline 1 Use the MVC model to organize program code Model - default View - user interaction Controller - main 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 4

Code Optimization Guideline 2 One method, one task One task, one method 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 5

Code Optimization Guideline 3 Do not pass values to a method if it does not use them Affects both the calling and the called module 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 6

Code Optimization Guideline 4 Declare variables (and objects) as locally as possible Precondition – local construct – postcondition Top of the class or method is reasonable and traditional 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 7

Code Optimization Guideline 5 Call methods (and objects) as low as possible Stay within the MVC model Scope affects object life 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 8

Code Optimization: Yvonne V. Richardson, BSCS, M. Ed Summary Use the MVC Model Respect the Task-Method Correspondence Pass Few Parameters Declare Variables Locally Minimize Scope of Method Calls 2/14/2012 Code Optimization: Yvonne V. Richardson, BSCS, M. Ed 9