Talk:DMA Design Project

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
 
I was given this design study to take a look at during class. I fed back some comments but have since thought of some more.
 
I was given this design study to take a look at during class. I fed back some comments but have since thought of some more.
  
Firstly - this s an awesome study. Congatulations on the amount of effort and work which has gone into creating the design. The end result looks good.
+
Firstly - this is an awesome study. Congatulations on the amount of effort and work which has gone into creating the design. The end result looks good.
  
 
I do have one problem with the final design and that is the use of generics "feels" wrong. I would like to find principles to support my feelings about this. The only one that I can think of at this stage is that it adds an extra layer of complexity to the design.
 
I do have one problem with the final design and that is the use of generics "feels" wrong. I would like to find principles to support my feelings about this. The only one that I can think of at this stage is that it adds an extra layer of complexity to the design.
Line 10: Line 10:
 
Alternatives to the use of generics in this circumstance:
 
Alternatives to the use of generics in this circumstance:
 
* If you are calling the ToString of an object then you could define the type coming into the logger as Object type.
 
* If you are calling the ToString of an object then you could define the type coming into the logger as Object type.
  * Object has the ToString method which is the interface required by the logger.
+
** Object has the ToString method which is the interface required by the logger.
  * I don't like this solution since the use of ToString by objects is inconsistent - different classes implement this method to return different representations of an object. Sometimes this is the memory location of the object - which is unlikely to be meaningful in a log file. ToString is primarily used as a tool by developers in debugging. Using it in other circumstances is dangerous.
+
** I don't like this solution since the use of ToString by objects is inconsistent - different classes implement this method to return different representations of an object. Sometimes this is the memory location of the object - which is unlikely to be meaningful in a log file. ToString is primarily used as a tool by developers in debugging. Using it in other circumstances is dangerous.
  
 
* An interface ILoggableType which contains the method ToLogString is defined. This would mean that all logged object will need to extend this class, that is a String would need to be wrapped in a class implementing ILoggableType. Perhaps this is a bit heavy weight but it would ensire that meaningful log information is available.
 
* An interface ILoggableType which contains the method ToLogString is defined. This would mean that all logged object will need to extend this class, that is a String would need to be wrapped in a class implementing ILoggableType. Perhaps this is a bit heavy weight but it would ensire that meaningful log information is available.

Latest revision as of 20:25, 3 October 2010


Design Study Comments----

I was given this design study to take a look at during class. I fed back some comments but have since thought of some more.

Firstly - this is an awesome study. Congatulations on the amount of effort and work which has gone into creating the design. The end result looks good.

I do have one problem with the final design and that is the use of generics "feels" wrong. I would like to find principles to support my feelings about this. The only one that I can think of at this stage is that it adds an extra layer of complexity to the design.

Is it really necessary that a logger only contain one type of object? Do we need to be certain that the logger only logs Strings for example? Are we retrieving the logged object for further processing at the end of processing?

Alternatives to the use of generics in this circumstance:

  • If you are calling the ToString of an object then you could define the type coming into the logger as Object type.
    • Object has the ToString method which is the interface required by the logger.
    • I don't like this solution since the use of ToString by objects is inconsistent - different classes implement this method to return different representations of an object. Sometimes this is the memory location of the object - which is unlikely to be meaningful in a log file. ToString is primarily used as a tool by developers in debugging. Using it in other circumstances is dangerous.
  • An interface ILoggableType which contains the method ToLogString is defined. This would mean that all logged object will need to extend this class, that is a String would need to be wrapped in a class implementing ILoggableType. Perhaps this is a bit heavy weight but it would ensire that meaningful log information is available.
  • A logger only logs string - some other tool takes responsibility for converting an exception into a meaningful string representation.

I believe that all these solutions are preferable to the use of generics. I'm interested in other people's opinions on this and their reasoning so please post comments...

--Linda 20:02, 3 October 2010 (UTC)


Personal tools