the artifacts of a software-intensive system" (Booch et. al. 1999)
Graphic notation + Semantic Rules. (Things / Relationships / Diagrams)
Get a Drink from the Drink Machine
- Customer selects type of drink (e.g. "Krap Cola")
- Customer presses button corresponding to selection
- System displays amount of $ to insert
- Users inserts money into slot
- When user has inserted enough money system issues drink
- User enjoys drink
Alternative: No drinks of selected type available
At step 2, system displays message "None Available, make another selection"
Allow customer to select new drink typeAlternative: Not enough change
User does not have enough change at step 4
System allows user to press "Cancel" button while waiting for correct change. Any coins already inserted are returned.
Return to step 1.
class Vehicle
{
public:
Vehicle(void);
virtual bool Register(string regnum);
string GetRego(void);
private:
string myRegNum;
};
Class Diagrams from different perspectives:
- Conceptual: diagram of concepts in the domain under study (does not necessarily match class names). Often used in the analysis phase.
- Specification: software interfaces, not implementation ("type" and "class")
- Implementation: interface and implementation
class Vehicle { public: Vehicle(void); virtual bool Register(string regnum); string GetRego(void); private: string myRegNum; }; class Car : public Vehicle { public: Car(string make, string model); virtual bool Register(string regnum); string GetDescription(void); private: string myMake; string myModel; };
class StudentRec
{
public:
StudentRec(StudentId& ID, string name);
StudentID GetID(void);
string GetName(void);
void AddMark(Mark * theMark)
Mark GetAverageMark(void);
private:
StudentID& myID;
string myName;
Mark * myMarks;
};
Putting it together:
class Window // abstract base class { public: virtual void toFront() = 0; virtual void toBack() = 0; }; class WindowsWindow : public Window { public: void toFront(); void toBack(); }; class X11Window : public Window { public: void toFront(); void toBack(); }; class MacWindow : public Window { public: void toFront(); void toBack(); };
class Order { private: Map <OrderLine, Product> lineItems; public: OrderLine getLineItem(Product aProduct); void addLineItem(Number amount, Product forProduct) }; class OrderLine { private: Number amount; }; class Product { public: . . . };
List<Type>
) are represented
as boxes with "dashed boxes" for the various template parameters
template <class TYPE>
class List
{
public:
bool First(void);
bool Next(void);
TYPE GetCurrent(void);
bool InsertCurrent(const TYPE& newelem);
bool DeleteCurrent(void);
private:
TYPE* myArray;
int mySize;
int myNextFree;
};
List<string>
)
are represented like templates in C++.
template <bool>
class List<bool>
{
public:
bool First(void);
bool Next(void);
TYPE GetCurrent(void);
bool InsertCurrent(const TYPE& newelem);
bool DeleteCurrent(void);
private:
long* myPackedArray;
};