15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

118<br />

Automating Software Engineering with CASE<br />

Figure 5-3:<br />

UML Use<br />

Case<br />

diagrams<br />

define how<br />

users need<br />

to interact<br />

with a<br />

program,<br />

such as this<br />

diagram<br />

describing<br />

an online<br />

shopping<br />

program.<br />

Customer<br />

Search<br />

<strong>for</strong> items<br />

Place Order<br />

Obtain Help<br />

Vendor<br />

Customer Support<br />

Figure 5-4:<br />

UML Class<br />

diagrams<br />

divide a<br />

large<br />

program<br />

into multiple<br />

objects and<br />

define the<br />

properties<br />

and<br />

methods of<br />

each object.<br />

Student<br />

Name<br />

Address<br />

Student ID<br />

Grade Point Average<br />

Enroll<br />

Name<br />

Address<br />

Salary<br />

Teacher<br />

Name<br />

Course ID<br />

Fees<br />

Days Offered<br />

Course<br />

Add Student<br />

Drop Student<br />

Assign Teacher<br />

An object’s properties define the type of data it can hold whereas an object’s<br />

methods define what type of actions the object can per<strong>for</strong>m. In Figure 5-4, the<br />

three classes are Students, Teachers, and Courses. Students have properties,<br />

such as their names and student ID numbers; Teachers have properties,<br />

such as their names and salaries; and Courses have properties, such as its<br />

name and days offered.<br />

The Student class also has an Enroll method to model a student’s actions<br />

in choosing a course to take. The Course class has three methods — Add<br />

Student, Drop Student, and Assign Teacher. By using UML Class

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!