c++ - Objects of class A in Class B in Class Diagram -


i have app own - user defined class , use qt framework libraries initiate objects of other classes built-in. in class let's call 'myclass' create instances of qt built-in classes , work on them. done ... now, need create class diagram that. wondering out of association, aggregation, composition or generalization classified ?

thanks

the important thing keep in mind uml there's no actual right or wrong answer when deciding on use, tools better others. uml tool communication , long tool used in way understands being communicated, serves purpose.

for class diagram, @ basic level, model association , generalisation, lack detail others may want see.

generalisation has 1 one relationship inheritance, it's clear when use that.

association describes class relationship or dependancy class; quite generalisation there(!) why used in replacement of aggregation , composition.

aggregation used when object (b) makes object (a) , b can shared amongst other objects. example, library consists of books, book modelled aggregate of library because other classes, aggregate book, such person borrowing it.

use composition when object (b) used directly make object (a). in case, if modelling human body , had classes of organs, model heart class composition object of body class.

the fact you're using qt framework irrelevant use model classes , diagram doesn't need model everything, necessary communicate concepts others.

if, example you're using container classes such qlist , qmap, don't want in diagram, if use qtcpsocket , inherit it, may better show that.

just remember, it's you're trying communicate.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -