PNGCanvas

burgi
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 115
Registriert: 15. Apr 2009 18:08
Wohnort: Ludwigshafen

PNGCanvas

Beitrag von burgi »

Hi everyone,

I have a short design question on the PNGCanvas class. Wouldn't it be more sophisticated to use a DocumentBuilder instance instead of a HTMLBuilder instance to create and add the actual LocalImage to the html document. At the moment with the given signature of PNGCanvas, we have to reimplement the same functonality twice. Once for the DocumentBuilders image(image: Image) method and once for the PNGCanvas' close() method.

Greetings Dominic

imaier
Mausschubser
Mausschubser
Beiträge: 61
Registriert: 21. Okt 2013 21:27

Re: PNGCanvas

Beitrag von imaier »

You are open to change the underlying builder of the canvasses. It ultimately depends on which side of the bridge pattern you implement the image functionality. I don't think there is one single correct version in this case, since I can imagine arguments to support either alternative.

Cheers,
Ingo

burgi
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 115
Registriert: 15. Apr 2009 18:08
Wohnort: Ludwigshafen

Re: PNGCanvas

Beitrag von burgi »

Hi thanks for replying,

I decided to use the given signature of PNGCanvas, as it is only one line of code duplication for the close() method. But reduction in decision logic during runtime, as DocumentBuilders image method has to distinguish between local and remote images, to do the job, which is not neccessary for canvases as they are a priori local.

Thanks Dominic

Antworten

Zurück zu „Archiv“