PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Singleton pattern vs Class variables and methods
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Singleton pattern vs Class variables and methods

Réponse
 
LinkBack Outils de la discussion
Vieux 16/09/2007, 17h42   #1
Summercool Summercool
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Singleton pattern vs Class variables and methods

There seems to be a big thing about the Singleton Pattern... and the way
to implement it, but what about just using class variables and class
methods to do the job?

So for example, the class Jukebox can have an object Logger... and all
the Jukebook instances will call the Logger methods which access the
class variables... isn't that what the Singleton Pattern is?

(this refers to p.35 of the pickAx2 book... about creating a class that
can do the singleton by making "new" private.)
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 16/09/2007, 17h52   #2
Marcin Raczkowski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Singleton pattern vs Class variables and methods

Summercool Summercool wrote:
> There seems to be a big thing about the Singleton Pattern... and the way
> to implement it, but what about just using class variables and class
> methods to do the job?
>
> So for example, the class Jukebox can have an object Logger... and all
> the Jukebook instances will call the Logger methods which access the
> class variables... isn't that what the Singleton Pattern is?
>
> (this refers to p.35 of the pickAx2 book... about creating a class that
> can do the singleton by making "new" private.)


It's singleton is PATTERN, implementation is left to progammer, in Ruby
you can implement singleton by including Singleton Mixin or using Class
and class variables (which is bit slower)

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h07.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07318 seconds with 10 queries