Resources‎ > ‎Programming‎ > ‎Object-Oriented Design‎ > ‎OO Tutorial‎ > ‎Lesson 5‎ > ‎

Sample Solutions

Practice 

Step 1 (facts finding/brain storming)

You can list anything you can think of to model the piecewise function:

  • There are ranges of independent variable (x of y=f(x)).
  • slope of the linear function stays the same within each range.
  • within each range a function can be anything.
  • the starting point of a sub function must match with the end point of its previous function.

Step 2 (viewpoint/concept)

Here, I consider the piecewise function as a set of different but simple functions. However, those small functions must be continuously connected in a ordered fashion.

Step 3 (modelling)


Step 4 (design)

From this practice, a tutor should start directing students to make the design diagrams suited to the outcome of the design process.  The above UML class diagram can have more details with regard to its implementation.



Comments