Managing Software Development
Project 1: More Products through Feature Combination
Spring 2008
Karl Lieberherr  
Out: Jan. 14, 2008

Due date: Jan.  28, 2008 (no class on Jan. 21, MLK day)

Preparation:
Learn how to use the wiki: https://wiki.ccs.neu.edu/display/CSG110/Home

PART 0: Improving the Requirements Document
===========================================

In project 1 you indentified several problems with the current document.
Write a new one and post it on the wiki.
https://wiki.ccs.neu.edu/display/CSG110/Perfect+SDG+Requirements+Document

PART 1: Pay Feature 
===================

SDG Inc. has decided to offer a variant of its popular SDG-F07 game.
In SDG-F07, the quality or pay function is defined as follows (proportional pay):

fsat(J,F) where F is a CNF formula and J an assignment. fsat(J,F) is the weighted fraction
of satisfied clauses.

pay(d,J,F) = fsat(J,F), where d is the derivative and F is of type d.type.

In the new version of the game, called SDG-SP08-all-or-nothing, we will use the following pay function:

pay(d,J,F) = fsat(J,F) > d.price ? 1 : 0

In other words, the pay is all or nothing. If the buyer can find an assignment J that
has a better satisfaction ratio than the price
of the derivative (which is in [0,1]), then 
the buyer earns 1 (million) and nothing otherwsie. SDG-SP08-all-or-nothing is a tougher game
because when the owner offers s derivative that is too cheap, 
it will cost the owner 1 (million) instead of a fraction of a million, provided
the buyer plays well. 
And if the buyer buys a derivative that is too expensive, the buyer will not
get anything back, provided the owner plays well.

What to turn in:

The game SDG-SP08-all-or-nothing together with a modified administrator.
Your game should run and be able to compete against other games.
All other game rules are unchanged.

A discussion of how well localized the change is to player and administrator implementations.


PART 2: Borrow Feature
======================

SDG Inc. has decided to offer a variant of its popular SDG-F07 game.
In SDG-F07, the rule holds that if the account of a player becomes negative,
she loses the game. In the new version, called SDG-SP08-borrow, players have the
option to borrow money from the administrator. They can borrow x million
with an interest rate of y% per round. For example, if x=2 (million) and y=5,
each round will cost $10 000 in interest.
Currently there is no capability to pay borrowed money back.

What to turn in:

The game SDG-SP08-borrow together with a modified administrator.
Your game should run and be able to compete against other games.
All other game rules are unchanged.

A discussion of how well localized the change is to player and administrator implementations.


PART 3: Combined Pay and Borrow Feature
=======================================

The two features are independent and we want to create a third version of the game, called
SDG-SP08-all-or-nothing-borrow.

Instead of turning in running code, discuss how we could organize our game software 
so that we don't have to duplicate code. The code in PART 1 has a huge overlap with
the code in PART 2. We would like to have an organization where we factor out
an SDG-F07-core and "compose" it with add-on features:

The core: SDG-F07-core

The add-on features:
proportional-pay
all-or-nothing-pay
borrow

The compositions we want ( + is used as composition operator)
SDG-F07-core + proportional-pay = SDG-F07
SDG-F07-core + all-or-nothing-pay = SDG-SP08-all-or-nothing
SDG-F07-core + proportional-pay + borrow = SDG-SP08-borrow
SDG-F07-core + all-or-nothing-pay + borrow = SDG-SP08-all-or-nothing-borrow

How can we achieve such a software organization?

Note that we must have exactly one of proportional-pay and all-or-nothing-pay?
The borrow feature is optional.

PART 4: DemeterF for software product lines
===========================================

Consider the Java program in 
http://www.ccs.neu.edu/home/lieber/courses/csg110/sp08/project/project2/depth/
which uses DemeterF.
Read file:
http://www.ccs.neu.edu/home/lieber/courses/csg110/sp08/how-to-use-demeterf
to learn how to use DemeterF on CCIS UNIX machines.

The Java program is compiled and run with the cr file. Rewrite the Depth calculation
so that Traversal only uses one argument instead of three:
new Traversal(d,d, da).