Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the driver class (Main class) an association, aggregation, or composition?

I've been wondering what kind of relationship the main class (controlling all the other classes in a non-GUI program) has with the other classes?

for example a class which is instantiated in the class containing the main method and classes which the main method interacts with such as getting a return value.

EDIT: Should it even be included in the UML? because my professor includes it (I didn't even know it was called a driver class) and the book im reading apparently doesn't include it, no this isn't homework.

It could be an association because it interacts with it. It can also be an aggregation because its made up of several of a class. And a class doesn't make sense without it (in the program implementation) so I think its composition because composition is an aggregation and aggregation in turn is a type of association. Although several responses already posted sound like my answer is wrong.

like image 916
Programmerboi Avatar asked Dec 26 '22 09:12

Programmerboi


1 Answers

None of these. The main method is static. So it doesn't belong to any object. So you don't have any association. The main method uses instances of the other classes, that's all.

like image 186
JB Nizet Avatar answered Dec 29 '22 00:12

JB Nizet