Notes+10.10

Compare and contrast:
Keep it collaborative, derived work, technology transfer.
 * Collaboration
 * Derivative Work
 * Plagiarism
 * Teaching/Learning
 * Technology Transfer
 * Theft

Cached value
A value which can be computed or measured on demand, but it's a little expensive to recompute for each use. Eg.: a person's height. Someone has to back them up against a wall with gradations on it... very slow in in computer time scale.

"Cached value" is such a common pattern, it is often just assumed. How is it implemented in your favorite language? Usually, space for the value is pre-allocated, but when a value is requested, a check is done to see if it is the designated NULL value. If it is NULL, the real value is obtained and stored in the cache.

Eg.2: A student's percentage of points in a class. It's only a small bother to recompute it. If there's any chance that the value has changed, such as reporting one more assignment, it is conservative to reset the value to NULL.

Base data (business objects) usually do not stow their own cached values. "Wrappers" which contain them are more likely to stow the values on their behalf.

Sorting Students
Remember: design and code a little, test right away. Lather, rinse, repeat.

Design a way to make a SortedCollection of StudentsBySID. (How very administrative!) In C, it is wise to have some procedures which do ALL the data accessing. That is, your main program should NEVER just drill-in and diddle the bits. Nor should any other procedure which is not part of the StudentsBySID package.

Kinesthetic? exercise in class: 4 large guys line up. They represent business data. They are LARGE, and do not move easily. A small guy asks them to swap until they are in alphabetical order. THIS TIME they comply. A small girl asks them to move around to be in SID order. Of course they follow her requests, totally messing up the other SortedCollection. Bring out note cards. Each small person can make their collection be sorted by shuffling lightweight cards which refer to the large data items, and the big data need not move. Each card only needs a reference to the "real" data, and might cache the value of the aspect being sorted by. Especially smart if the value is a computed value not stored in the business object.