[Phpmyadmin-devel] PMA_CommonFunctions

Atul Pratap Singh atulpratapsingh05 at gmail.com
Sat Aug 18 19:51:11 CEST 2012


On Sat, Aug 18, 2012 at 10:52 PM, Rouslan Placella <rouslan at placella.com>wrote:

> Just in case you guys decide to change this class from a singleton to
> something else, may I recommend that this gets done after GSoC? As IMO
> such a move will create a whole bunch of conflicts for everyone to
> resolve

I support it to be done after most GSoC development gets merged to upstream.

> and yet there is no clear advantage other than shorter syntax in
> this move.
>
I think making it static would be a logical move as the class is just a
collection of necessary functions and doesn't require instantiating in
object-oriented sense.

>
> Bye,
> Rouslan
>
> On 18/08/2012 18:22, Chanaka Dharmarathna wrote:
> > Hi Dieter,
> >
> > First sorry for top posting. I'm using my phone to send this.
> >
> > As I remember I discussed about this class structure in the mailing list
> > before. At that time I decided to use singleton pattern for this class.
> >
> > Anyway, I got the point you mentioned. Since the class itself have no
> > properties singleton may not be essential here. I'll look more on what
> > are the pros and cons between these two approaches in this kind
> > background. Hope other also will share their ideas on this.
> >
> > However, since I need to stop my work by tomorrow according to the GSoC
> > timeline (Carol ask to do so) I'll take the responsibility of any
> > necessary changes regarding this after GSoC session.
> >
> > Regards !
> >
> > Chanaka
> >
> > On Aug 18, 2012 6:10 PM, "Dieter Adriaenssens"
> > <dieter.adriaenssens at gmail.com <mailto:dieter.adriaenssens at gmail.com>>
> > wrote:
> >  >
> >  > Hi Chanaka,
> >  >
> >  > I stumbled upon this piece of code (random pick) :
> >  >
> >  >
> PMA_CommonFunctions::getInstance()->backquote($_REQUEST['view']['name'])
> >  >
> >  > and it made me wonder if using a singleton for PMA_CommonFunctions is
> >  > necessary, because basicaly PMA_Commonfunctions is a collection of
> >  > methods, not really a 'living' object.
> >  > So then I had a look at the class, and I discovered that the class has
> >  > no class variables (apart from the _instance variable) and an empty
> >  > constructor.
> >  > So basicly this should be a static class, with static methods, because
> >  > no instance is needed for it to work.
> >  >
> >  > And the above piece of code will become :
> >  >
> >  > PMA_CommonFunctions::backquote($_REQUEST['view']['name'])
> >  >
> >  > BTW: If you convert it to a static class, don't forget to replace the
> >  > $this->method() calls by the static equivalent self::method().
> >  > BTW2 : you forgot to add the if (! defined('PHPMYADMIN')), check in
> >  > the beginning of the file, see [0].
> >  >
> >  > [0] http://wiki.phpmyadmin.net/pma/File_template
> >  > --
> >  > Kind regards,
> >  >
> >  > Dieter Adriaenssens
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Phpmyadmin-devel mailing list
> Phpmyadmin-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
>



-- 
Atul Pratap Singh
http://blog.atulsisodia.in/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20120818/b6e117db/attachment.html>


More information about the Developers mailing list