[Spice-devel] Using private structure for making structure more public...
Frediano Ziglio
fziglio at redhat.com
Fri May 13 08:42:08 UTC 2016
Hi,
this is the last though looking at refactory branch current trend.
We use Gobject and private separation so structure are less exposed
to external... bla bla bla.
The implementation however looks to not agree with it!
Usually the channel and the client (like InputsChannel and
InputsChannelClient) are quite tight so each other know and access
their internal. This could lead to bad encapsulation. So current
status is:
- single file for channel/client (beside display which is
huge and split in different files);
- access mostly free from one structure to another. Which is
bad.
So the actual transformation is:
- split channel and client;
- add accessors to deal with encapsulation;
- move structures to headers;
- change structures to Gobjects
The result however from the external point of view is that
users of channels include these giant headers with a lot
of internal details while before in headers there were very
small information, mainly you have these structures (without
any types beside base class) with these methods.
The most visible example of this is CursorChannel(Client).
These have (currently master state) very limited header (one!)
while at the end it's quite huge.
Now... from the abstract point of view. Why a client of a channel
have to know details on the client of the same channel?
I think it's just a design mistake (at lest mostly).
Back to code it's quite a mistake that channel headers include
client ones, should not. Would be also better to have a kind of
external interface header and a specific channel <-> specific client
header to avoid exposing all accessors.
Not last in C++ these stuff resolve in a bunk of lines instead
of hundreds.
Frediano
More information about the Spice-devel
mailing list