On Mon, 2015-11-30 at 23:51 +0000, Matthew Brincke wrote:
> how would you ensure that nobody abuses a static-methods-only
> factory class? What do you think of as best practice? I think,
> warning and error messages are instrumental to prevent abuse.
> Regarding the "unfinished work": should I submit an empty inline
> implementation (but commented out to prevent calls to it)?

        Hi,
I hope we both agree that having something declared, but not
implemented anywhere is wrong in general. It can strike back in
different ways, like adding work to someone else extending the class
and realizing that there is missing code. I believe we can find other
good reasons too.

I would not call it 'abuse', if the caller wants to instantiate a class
which provides only static methods, then it's up to him/her. One semi-
valid reason can be to "save source code size". Instead of calling each
method as PdfEncodingFactory::some-method-to-call(), it can be called
as here:
   PdfEncodingFactory ef;
   ef.some-method-to-call()
Stupid example, I know, but exhibits that there is no abuse involved in
the instantiation of the class. At least from my point of view.

Nonetheless, if you want to ensure that the class will no be
instantiated, then your way of adding the constructor in the 'private'
section if completely fine. What I claimed about was the declaration
without implementation of the methods (constructors, in this case).
Declaring them with empty body is fine too.

Hope it helps.
        Bye,
        zyx

-- 
http://www.litePDF.cz                                 i...@litepdf.cz



------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to