BTP300 Practical Tips 2012

From CDOT Wiki
Jump to: navigation, search

Purpose

Share useful information that can help all groups with their projects.

Pair Programming

  • a story about pair programming and job interview (Sept. 10, 2012) [1]
    • read the comments as well
"Before hiring a new developer, they want to know that a candidate is both
technically proficient and a good personality fit for the 28 person company."
  • pair programming and music (October 11, 2012) [2]

Using SVN and Collaboration Requirements

A1

A2 Release 0.1 (the CFrame class)

  • Download and run the executable code. [4]
    • Try the following key presses: F6, move the arrow keys, ESC, F7, move the arrow keys, ESC.
    • Repeat the above sequence of key presses a few times.
  • Inspect the source code of testFrame( ) in a2test.cpp.
  • Write up a list of all the source files that you need to compile the code. (For example, cfg.h, iframe.h, consolebackup.cpp, cframe.h, cframe.cpp,...)
  • command line on Borland:
bcc32 a2test.cpp cframe.cpp consolelineedit.cpp consolebackup.cpp console.cpp
  • READ the problem description for A2 Release 0.1.
  • Run the VS executables on the course website [5].

A2 Release 0.2


A2: Useful Pseudo Code (Dr. Chris Szalwinski)

This is one way to design some of your classes. Other ways are also possible. The instance variable and pointer names are left to your discretion. Not all methods and functions are included. The simpler ones are omitted.

CFrame

  • Constructor
    • initialize instance variables
    • determine if full screen
      • if full screen set width and height to console width and height
    • initialize covered area to nothing
  • Destructor
    • release the covered area
  • CFrame::setLine
    • do this yourself
  • CFrame::absRow
    • start with the row value for this frame - call row()
    • add the row value for the parent frame if any
    • add the row value for the parent's parent frame if any
    • continue until you run out of parents
  • CFrame::absCol
    • same as absRow except for columns
  • CFrame::goMiddle
    • calculate the absolute row and column position of the middle accounting for the border if any
    • set the cursor position to these absolute values
  • CFrame::display
    • remember to account for a border if any and is on
    • calculate the width of the frame with a border if any
    • reduce width if frame extends beyond the border of the parent frame
    • calculate the absolute position of the frame
    • call your display function to display the string
  • CFrame::edit
    • remember to account for a border if any and is on
    • calculate the width of the frame with a border if any
    • reduce width if frame extends beyond the border of the parent frame
    • calculate the absolute position of the frame
    • call your edit function to edit the string
  • CFrame::draw
    • allocate dynamic memory for string to hold a single line of the frame
    • capture the rectangle of characters that will be hidden by the drawing of the frame
    • if the frame is bordered and the parameter does not hold the no frame value
    • create the top line of the frame
    • position the cursor for the top line
    • insert the top line into the output stream (<<)
    • create an interior line of the frame
    • for each interior line
      • position the cursor for the interior line
      • insert the interior line into the output stream (<<)
    • create the bottom line of the frame
    • position the cursor for the bottom line
    • insert the bottom line into the output stream (<<)
    • deallocate dynamic memory
  • CFrame::move
    • hide the frame
    • switch on direction received
      • increment or decrement row or column value
      • ensure that frame does not move outside parent frame or console space
    • draw the frame
  • CFrame::hide
    • restore the hidden rectangle of characters at the current position of the frame
    • release the dynamic memory used to store the hidden characters
  • move
    • create pointer to message for moving
    • capture the characters hidden by the message
    • for each move request
      • insert the message into the output stream (<<)
      • extract the key pressed from the console (>>)
      • switch on the key press
        • move the frame referred to in the parameter as requested
        • exit moving operations on Escape
      • restore the characters hidden by the message
      • release the dynamic memory for the message
      • may need to draw the frame after removing the message

CField

  • Constructor
    • pass parameter data to CFrame
    • store the address of the field data in the instance pointer
  • Destructor
    • does nothing
  • CField::display
    • call CFrame::display with the offset received
  • CField::edit
    • call CFrame::edit with the address of the data belonging to the field
  • CField::pdata
    • return the address of the data belonging to the field
  • CField::data
    • return the address of the pointer that holds the address of the data belonging to the field

Useful Diagrams

Useful Links On The Web

Useful Code Snippets