P
Padu
Hi,
I'm building a class library that uses the serial port to communicate with a
custom serial bus. Two of the classes I've built ("Packet" and "SerialPort")
uses an aggregated class "Log" to log their activity on a log file.
Now that it is working, I'd like to refactor it so it implements a better
design. What I want to do is instead of coupling a Log class to my Packet
and SerialPort classes, I want to be able to choose what type of log I want
to assign to my serial classes. The options I envision are: 1) A file log;
2) The console; 3) A remote log, that sends a (probably XML) text stream
over the net; 4) A null log, that does nothing when asked to log
I could create a base class for these logs, but then I couldn't use the
standard console (unless my derived class wraps it, which maybe it's not a
bad idea).
I'm a newcomer to the C# world and I only have a vague idea of how
serialization works. I've been investigating the help, but everywhere I look
they implement things using reflection, and I don't know if it is
justifiable in this case.
Do you have any design/implementation suggestions for this app?
Cheers
Padu
I'm building a class library that uses the serial port to communicate with a
custom serial bus. Two of the classes I've built ("Packet" and "SerialPort")
uses an aggregated class "Log" to log their activity on a log file.
Now that it is working, I'd like to refactor it so it implements a better
design. What I want to do is instead of coupling a Log class to my Packet
and SerialPort classes, I want to be able to choose what type of log I want
to assign to my serial classes. The options I envision are: 1) A file log;
2) The console; 3) A remote log, that sends a (probably XML) text stream
over the net; 4) A null log, that does nothing when asked to log
I could create a base class for these logs, but then I couldn't use the
standard console (unless my derived class wraps it, which maybe it's not a
bad idea).
I'm a newcomer to the C# world and I only have a vague idea of how
serialization works. I've been investigating the help, but everywhere I look
they implement things using reflection, and I don't know if it is
justifiable in this case.
Do you have any design/implementation suggestions for this app?
Cheers
Padu