Content deleted Content added
Line 30:
#*Step 3: ...
# '''Class diagram derivation''': Now it is fairly straight forward to derive a [[class diagram]] from the object diagrams used in the storyboards. <br/>[[File:WikipediaGoDutchClassDiag.png|Class diagram for a go-dutch barbecue]]<br/>Note, the class diagram serves as a common reference for all object diagrams. This ensures that overall the same types and attributes are used. Using a [[UML]] tool, you may generate a first implementation from this class diagram.
# '''Algorithm design''': So far you have modeled and implemented that object structures that are deployed in your application. Now you need to add behavior, i.e. algorithms and method bodies. Programming the behavior of an application is a demanding task. To facilitate it, you should first outline the behavior in [[pseudocode]] notation. You might do this, e.g. with an object game. For example, to update the saldo attributes of all persons you look at our object structure and from the point of view of the GroupAccount object you do the following:
#: Update the saldo of all persons:
#* visit each item
#** for each item add the value to the total value and add 1 to the number of items
#* compute the average share of each person by dividing the total value by the number of persons
#* visit each person
#** for each person reset the saldo
#** for each person visit each item bought by this person
#*** for each item add the value to the saldo of the current person
#** for each person subtract the share from the saldo
# '''Behavior implementation''': Once you have refined your algorithm [[pseudocode]] down to the level of operations on object structures it is straight forward to derive source code that executes the same operations on your object model implementation.
# '''Testing''': Finally, the scenarios may be used to derive automatic [[JUnit]] tests.
#: Test update the saldo of all persons:
#* create a group account object
#* add a person object with name Peter and a person object with name Putri and a person object with name Peng to the group account object
#* add an item object with buyer Peter, description Meat, and value 12$ to the group account object
#* add an item object with buyer Putri, description Salad, and value 9$ to the group account object
#* call method update the saldo of all persons on the group account object
#* ensure that the saldo of the Peter object is 5$
#* ensure that the saldo of the Putri object is 2$
#* ensure that the saldo of the Peter object is -7$
#* ensure that the sum of all saldos is 0$
: Such automatic tests ensure that in the example situation the behavior implementation actually does what is outlined in the storyboard. While these tests are pretty simple and may not identify all kinds of bugs, these tests are very useful to document the desired behavior and the usage of the new features and these tests ensure that the corresponding functionality is not lost due to future changes.
== Summary ==
|