CIS 234: Project 2 Issues - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

CIS 234: Project 2 Issues

Description:

Other Code Issues ... don't 'hard code' array length in sort method, or in ... all of code in BuildingReport for printing needs to be in a separate method, ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 13
Provided by: CBA
Category:
Tags: cis | code | issues | project

less

Transcript and Presenter's Notes

Title: CIS 234: Project 2 Issues


1
CIS 234 Project 2 Issues
  • Dr. Ralph D. Westfall
  • May, 2010

2
Avoid Copy and Paste Reuse
  • don't copy and paste code to do something very
    similar with different data
  • put repeated code in a method, then call that
    method with different data
  • method may be in same class, or in a different
    class (e.g., FICA/Medicare calculations work like
    FIT calculations)

3
Repeat This With Me
  • "If I'm copying and pasting code, and then
    changing it slightly, I'm probably doing
    something wrong."
  • all together
  • left side of the room say the green text, then
    middle say blue text, and finally right side say
    red text (then 3-part harmony?)
  • the more lines x often, the more wrong

4
Avoid Duplicated Activities
  • data
  • don't get same data again and again
  • store value in a variable the first time, then
    use that instead of going back to source
  • calculations
  • don't repeat them
  • store value in a variable the first time, and
    then recycle that as needed

5
Separate Data Calculations
  • put ALL data in a separate class e.g., Inputs.
    java
  • possibly with the exception of trivial items such
    as MONTHS_IN_YEAR
  • don't do any calculations in the class that holds
    the data

6
Inheritance
  • when a class inherits from another class, you can
    (and should) use the new class to do what the
    previous one did
  • a class named NuEmployee that inherits from
    Employee should now do the income tax (FIT)
    calculations that Employee did
  • do NOT create objects from both, and use Employee
    class objects to calculate FIT

7
Excel File
  • intended to check calculations in Java
  • if just plug output data into it, without any
    formulas, nothing gets checked
  • all subtotals and totals should be calculated in
    Excel
  • formulas should also multiply items per day times
    days per year time prices, and times costs

8
Code
  • appropriately formatted with skipped lines
  • put all declarations before any of the action
    code in a method
  • no redundant items e.g.,
  • use comments where necessary, delete ones that
    are unnecessary or are no longer appropriate

9
Follow the Requirements
  • Excel file missing in a lot of projects
  • pseudocode too
  • a few zip or Word files weren't named with last
    and first name
  • output needs to be pasted in Word file
  • code needs to be pasted into Word file
  • JOptionPane should be in Inputs class

10
Requirements Really Do Count
  • several students didn't make the output show the
    kangas and hanboks per day, or missed other
    requirements for output
  • some didn't use a separate class to calculate
    Other Operating Expense
  • a few didn't notice that some data items had been
    updated (red font)

11
Use Feedback
  • Project 1 grading identified problems with
    Mortgage calculations
  • a few students still didn't convert monthly
    payment to annual occupancy expense
  • at least one student still used the percentage
    value (6.5) instead of the decimal value (0.065)
    in the calculation

12
Variable Names
  • should make it clear what the data is
  • total and subtotal aren't good, because they
    could apply to a lot of different things
  • instead use names such as incomeTotal,
    productCostSubtotal, kangasPerYear,
    employeeExpenseSubtotal,
  • use naming convention lower case for first word,
    Upper Case to start each added one
Write a Comment
User Comments (0)
About PowerShow.com