Chapter 24: Programming Principles - PowerPoint PPT Presentation

About This Presentation
Title:

Chapter 24: Programming Principles

Description:

Use a consistent style for formatting, organizing, and commenting your code. Indenting not clear: ... Clearer indenting style: If A is True Then. actions 1 ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 12
Provided by: abh116
Category:

less

Transcript and Presenter's Notes

Title: Chapter 24: Programming Principles


1
Spreadsheet-Based Decision Support Systems
Chapter 24 Programming Principles
Prof. Name
name_at_email.com Position
(123) 456-7890 University Name
2
Overview
  • 24.1 Programming Practices
  • 24.2 Clarity
  • 24.3 Efficiency
  • 24.4 Summary

3
Programming Practices
  • We summarize here what we feel are some important
    issues when coding in VBA for spreadsheet-based
    DSS development.
  • We categorize these issues as follows coding
    with a consistent style using naming standards
    having clear comments and increasing coding
    efficiency.

4
Clarity
  • Consistent Style
  • Naming
  • Documentation

5
Consistent Style
  • Use a consistent style for formatting,
    organizing, and commenting your code.
  • 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

6
Naming
  • Use naming standards for variables and
    procedures.
  • MinVal, SumProfit, MaxPrice
  • FindMinCost, GetUserInfo
  • Naming standards also apply to control names and
    specific data types, such as Boolean.
  • IsDone, DoAnimation

7
Documentation
  • Make comments clear throughout the code.
  • Describe procedure functionality and loop and
    logical flow.

8
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

9
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

10
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.

11
Additional Links
  • (place links here)
Write a Comment
User Comments (0)
About PowerShow.com