Mailinglist Archive: zypp-devel (68 mails)
| < Previous | Next > |
Re: [zypp-devel] status 15.5. (YUMParser)
- From: Michael Andres <ma@xxxxxxx>
- Date: Wed, 16 May 2007 10:26:01 +0200
- Message-id: <20070516082601.GA19254@xxxxxxx>
On Tue, May 15, Jan Kupec wrote:
> PS: Question for Michael:
>
> I see a lot of classes in libzypp are designed following a certain
> pattern with public API separated from implementation. Is it the Bridge
> pattern? I have not found time to learn much about it so far. Should i
Some are sort of Bridge (e.g. Resolvables, Sources, Capabilites).
Other simply use 'Body/Handle' or PIMPL, to keep data and implementation
details out of the public interface, to implement cheap copy or copy on
write.
> design YUMParser's classes that way?
It's always a good idea to decouple interface and implementation.
Look e.g. at the yum::PrimaryFileReader:
PrimaryFileReader(
const Pathname &primary_file,
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress );
This is actually the complete public interface. A filename,
a callback processing the parded data and optional progressreport.
If you'd move all the rest of the class to a separate implementation
class, you could drop a lot of compiletime dependencies (e.g. the whole
xml::Reader stuff).
Then you can add/remove additional data/calbacks, whatever you need,
without breaking binary compatibility.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
> PS: Question for Michael:
>
> I see a lot of classes in libzypp are designed following a certain
> pattern with public API separated from implementation. Is it the Bridge
> pattern? I have not found time to learn much about it so far. Should i
Some are sort of Bridge (e.g. Resolvables, Sources, Capabilites).
Other simply use 'Body/Handle' or PIMPL, to keep data and implementation
details out of the public interface, to implement cheap copy or copy on
write.
> design YUMParser's classes that way?
It's always a good idea to decouple interface and implementation.
Look e.g. at the yum::PrimaryFileReader:
PrimaryFileReader(
const Pathname &primary_file,
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress );
This is actually the complete public interface. A filename,
a callback processing the parded data and optional progressreport.
If you'd move all the rest of the class to a separate implementation
class, you could drop a lot of compiletime dependencies (e.g. the whole
xml::Reader stuff).
Then you can add/remove additional data/calbacks, whatever you need,
without breaking binary compatibility.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |