java - OOP advice for messaging objects design -
my scenario this:
i have messaging system when dispatch message different destinations message type.
that's current design:
abstract class: messagekindabs messagekind1 extends messagekindabs messagekind2 extends messagekindabs messagekind3 extends messagekindabs
and on..
now messagekind3
special kind. it's purpose send content of messagekind1
or messagekind2
log process.
so created inside messagekind3
list of messagekind3items
:
list<messagekind3item> messagekind3itemlist...
messagekind3item
includes information of messagekind1
/messagekind2
logging purposes.
so happens each messagekind3item
includes messagekindabs
type.
but makes no sense me.
for example: send message db queue , log information messagekind1
holds , messagekind2
holds.
so oop design got bit complicated.
anyone me find way on here?
i have created inside messagekind3item
instance type of messagekindabs
not sure make sense.
thanks, ray,
i have created inside messagekind3item instance type of messagekindabs not sure make sense.
you can not, it's abstract.
since messagekind3 logging structure known. messagekind3 items create special logitem class instantiated like:
logitem createlogitem(messagekind1) { return new logitem(); } logitem createlogitem(messagekind2) { return new logitem(); }
and attach these items messagekind3.
you trying tightly couple classes inheritance , problem lies.
Comments
Post a Comment