Programming Principles Spreadsheet-Based Decision Support Systems Chapter 24: Aslı Sencer MIS 463.

Slides:



Advertisements
Similar presentations
P5, M1, D1.
Advertisements

Unit 6 Assignment 2 Chris Boardley.
Object Oriented Programming A programming concept which views programs as objects with properties and ways to manipulate the object and the properties.
Coding Standard: General Rules 1.Always be consistent with existing code. 2.Adopt naming conventions consistent with selected framework. 3.Use the same.
CHAPTER 5: LOOP STRUCTURES Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Communicating in Code: Layout and Style Programming Studio Spring 2009 Note: several examples in this lecture taken from The Practice of Programming by.
Introduction to C Programming
Documentation 1 Comprehending the present – Investing in the future.
SYSTEM ANALYSIS & DESIGN (DCT 2013)
Decisions (Conditional Programming) Chapter 5 (Sec. 5.1 & 5.2)
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Introduction to C Programming
VB .NET Programming Fundamentals
Algorithm Programming Coding Advices Bar-Ilan University תשס " ו by Moshe Fresko.
Adding Automated Functionality to Office Applications.
Fundamentals of Python: From First Programs Through Data Structures
CIS162AD - C# Decision Statements 04_decisions.ppt.
Chapter 9 Describing Process Specifications and Structured Decisions
University of Toronto at Scarborough © Andria Hunter, Kersti Wain-Bantin CSCA01 VBA-3 1 Lecture Outline Variable Scope Calling another subprogram Programming.
Spreadsheet-Based Decision Support Systems Chapter 22:
Mr C Johnston ICT Teacher BTEC IT Unit 06 - Lesson 05 Learning To Program.
Chapter 2 Primitive Data Types and Operations F Introduce Programming with an Example  The MyInput class F Identifiers, Variables, and Constants F Primitive.
Programming Style and Documentation Objective(s) F To become familiar with Java Style and Documentation Guidelines.
1 Chapter 2 Primitive Data Types and Operations F Introduce Programming with an Example  The MyInput class F Identifiers, Variables, and Constants F Primitive.
Chapter 11 Describing Process Specifications and Structured Decisions Systems Analysis and Design Kendall and Kendall Fifth Edition.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Kruse/Ryba Ch011 Object Oriented Data Structures Programming Principles Introduction Programming Style Coding, Testing, Further Refinement Program Maintenance.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
GUI Design Spreadsheet-Based Decision Support Systems Chapter 23: Aslı Sencer MIS 463.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
Introduction To Engineering Bike Lab 1 – 4 Report Agenda: Lab Report Format Team Writing Outline Lab 1 Report.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Program Style Chapter 22 IB103 Week 12 (part 2). Modularity: the ability to reuse code Encapsulation: hide data access directly but may use methods (the.
Chapter 23: GUI Design Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
An Object-Oriented Approach to Programming Logic and Design Chapter 5 Making Decisions.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.
Dani Vainstein1 VBScript Session 8. Dani Vainstein2 What we learn last session? VBScript procedures. Sub procedures. Function Procedures. Getting data.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
CS0004: Introduction to Programming
Kruse/Ryba Ch011 Object Oriented Data Structures Programming Principles Introduction Programming Style Coding, Testing, Further Refinement Program Maintenance.
A variable is a name for a value stored in memory.
VBA - Excel VBA is Visual Basic for Applications
Chapter 4 The If…Then Statement
Input and Output: I/O Finish reading chapters 1 and 2 of the text
Think What will be the output?
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
Unit 6 Assignment 2 Chris Boardley.
Spreadsheet-Based Decision Support Systems
Spreadsheet-Based Decision Support Systems
Chapter 2 Primitive Data Types and Operations
Creating Maintainable code
Variables and Constants
Creating readable code
Presentation transcript:

Programming Principles Spreadsheet-Based Decision Support Systems Chapter 24: Aslı Sencer MIS 463

2 Overview  24.1 Programming Practices  24.2 Clarity  24.3 Efficiency  24.4 Summary

3 Programming Practices  Issues related to coding in VBA for spreadsheet-based DSS development.  Clarity –Coding with a consistent style; –Using naming standards; –Having clear comments;  Increasing coding efficiency.

4 Consistent Style Use a consistent style for formatting, organizing, and commenting your code.  Spacing, indenting, line length should be consistent –Keep procedures and functions far enough so that scanning is easy –Indent to signify the beginning and end of a loop –Line length should be long enough to avoid scroll back and forth –Break lines at logical places  Be consistent at error checking –Check inputs in all input forms and worksheets Indenting not clear: If A is True Then ‘actions 1 ElseIf B is True Then ‘actions 2 End If Clearer indenting style: If A is True Then ‘actions 1 ElseIf B is True Then ‘actions 2 End If

5 Naming  Use naming standards for variables and procedures. –Abbreviate names so that they are not confused with other meanings. Ex:NumFac ? –When there is more than one word in a name capitalize the first letter. Ex: MinVal –Create descriptive names that are not lengthy Ex: “MinVal”, “SumProfit”, “MaxPrice” “FindMinCost”, “GetUserInfo” –Loop counters are usually i and j. May also use “iter”, or “run”  Naming standards also apply to control names and specific data types, Ex: The name of a textbox should start with “txt”, The name of a form should start with with “frm”, boolean varaible may start with “IsDone” or “DoAnimation” for constants use PI, INFINITY Procedure names: Use CalcReturn instead of Calc Function names: FindMinCost, GetUserInfo

6 Documentation  Make comments clear throughout the code.  Describe procedure functionality and loop and logical flow.

7 Efficiency  Always look for ways to improve your coding efficiency.  Avoid redundancies and unnecessary code. Static structure: For i = 1 to 10 ‘do actions Next i Dynamic structure: For i = 1 to NumProducts ‘do actions Next i

8 Efficiency (cont) Static structure: Dim CostArray(10) as Double Dynamic structure: Dim CostArray() As Double, CostSize As Integer ReDim CostArray(CostSize) Static structure: ‘paste in output table Range(“A1”).PasteSpecial Dynamic structure: Dim OutputTable As Range Set OutputTable = Range(“A1”) OutputTable.PasteSpecial

9 Summary  The most important programming principles are writing with a consistent style, using naming standards, including clear comments, and improving code efficiency.  It is important to have a clear, readable, and understandable code.  Documentation is an important part of any programming project. We accomplish documentation by placing comments throughout our code.  We should continuously be working to improve our code by reducing the complexity of the logic and the time required.