P
__PPS__
Hello all,
I was working on someone else's code to implement some classes. The
task seemed to be simple and I was confident that I won't spent alot of
time on that task... But! I've already spent more time to integrade
old working code with new design than it would take me to write it all
from scratch!
so... after having tons of headaches I desided to figure out what's
wrong with the design (or me) and why it's all so complicated.
Here's an example of Rtp Player class. (rtp/rtcp real time data
trnasmition...)
In short RtpPlayer is something that receives data from network, so, it
probably will need to have some kind of connection to the remote end.
Data is encoded, so before playing my rtp player will have to decode
that data. Then to play it (if it's audio) it will have to open audio
device and write data to it.
simplest design is something like:
class rtp_player {
rtp_connection rtp;
data_decoder decoder;
audio_device audio;
public:
...
};
====
Now the way it's badly designed in my case...
rtp_player's has a constructor that takes pointers to interface classes
like this (for sending data):
class data_senderI {
virtual void sendData(const char* data, unsigned int size) = 0;
}
similar shit for decoder, audio device etc.... Not to mention that all
these classes have lot's of other similar shit classes.
So... there's a top level class Media... it has sockets (for
rtp/rtcp)... this class implements data_senderI, then it does new
rtp_player(this, this, this); (it implements other interfaces etc);
I don't know where this kind of garbage design comes from (my guess is
that it's from java world) but it just drives me crazy, I'm getting
lost... There are tens of almost empty classes that do nothing, all of
them have or implement two or three interfaces and it goes on and on.
Result - this construction is unmanagable at all!
Most of the code is constructed in this way... My goal is to convince
managers that a major fix or refactoring is required, how do I convince
them that's not the way to go with all that interfaces user classes and
userInterface classes that came nobody knows from where and designed
nobody knows by who... All other ppl that work on that project are not
good in c++ and they have tons of troubles tracing function call flows
etc...
Any ideas on that? thank you
I was working on someone else's code to implement some classes. The
task seemed to be simple and I was confident that I won't spent alot of
time on that task... But! I've already spent more time to integrade
old working code with new design than it would take me to write it all
from scratch!
so... after having tons of headaches I desided to figure out what's
wrong with the design (or me) and why it's all so complicated.
Here's an example of Rtp Player class. (rtp/rtcp real time data
trnasmition...)
In short RtpPlayer is something that receives data from network, so, it
probably will need to have some kind of connection to the remote end.
Data is encoded, so before playing my rtp player will have to decode
that data. Then to play it (if it's audio) it will have to open audio
device and write data to it.
simplest design is something like:
class rtp_player {
rtp_connection rtp;
data_decoder decoder;
audio_device audio;
public:
...
};
====
Now the way it's badly designed in my case...
rtp_player's has a constructor that takes pointers to interface classes
like this (for sending data):
class data_senderI {
virtual void sendData(const char* data, unsigned int size) = 0;
}
similar shit for decoder, audio device etc.... Not to mention that all
these classes have lot's of other similar shit classes.
So... there's a top level class Media... it has sockets (for
rtp/rtcp)... this class implements data_senderI, then it does new
rtp_player(this, this, this); (it implements other interfaces etc);
I don't know where this kind of garbage design comes from (my guess is
that it's from java world) but it just drives me crazy, I'm getting
lost... There are tens of almost empty classes that do nothing, all of
them have or implement two or three interfaces and it goes on and on.
Result - this construction is unmanagable at all!
Most of the code is constructed in this way... My goal is to convince
managers that a major fix or refactoring is required, how do I convince
them that's not the way to go with all that interfaces user classes and
userInterface classes that came nobody knows from where and designed
nobody knows by who... All other ppl that work on that project are not
good in c++ and they have tons of troubles tracing function call flows
etc...
Any ideas on that? thank you