|
Bas de page | |
---|---|
Auteur | Sujet : intérêt du pattern factory |
![]() Publicité | Posté le 26-03-2006 à 11:12:39 ![]() ![]() |
Harkonnen ModérateurUn modo pour les bannir tous | ta classe FabriqueAbstraite n'a aucune utilité à mon sens. moi je ferais comme ceci :
--------------- J'ai un string dans l'array (Paris Hilton) |
weblook$$ | si elle a un intérêt vu qu'un pattern conçu comme ça existe :
|
weblook$$ | Sachant qu'il y a deux patterns avec à peu près la même philosophie, le abstract factory et le factory. Moi je parle juste du Factory. |
Harkonnen ModérateurUn modo pour les bannir tous | l'intéret de cette fabrique abstraite, est de permettre à toutes ses sous classes de surcharger la méthode FactoryMethod(), et ainsi d'implémenter leur propre comportement --------------- J'ai un string dans l'array (Paris Hilton) |
weblook$$ | oui mais dans ce cas, une classe de base et des classes filles spécialisées qui implémente leur propre comportement suffirait. |
Harkonnen ModérateurUn modo pour les bannir tous |
--------------- J'ai un string dans l'array (Paris Hilton) |
weblook$$ | non.
|
![]() Publicité | Posté le 26-03-2006 à 15:23:46 ![]() ![]() |
Harkonnen ModérateurUn modo pour les bannir tous | tu as d'un coté une liste de produits, et de l'autre coté un Factory. les produits partagent des caractéristiques communes, donc ils dérivent tous d'une même interface.
--------------- J'ai un string dans l'array (Paris Hilton) |
masklinn í dag viðrar vel til loftárása |
Message édité par masklinn le 26-03-2006 à 15:37:03 --------------- I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing? |
weblook$$ | Sauf que l'objet appelant cette méthode commune sera changeant d'un produit à l'autre: fabriqueconcreteA, fabriqueconcreteB. Et le code permettant de créer l'objet doit se situer dans le client. on sera donc obligé de changer au moins une ligne de code au nvieau du client si on change de produit. Tout comme ça aurait été le cas sans fabrique. je comprends pas et je crois que je vais laisser tomber. |
Harkonnen ModérateurUn modo pour les bannir tous | tu achètes le Head First Design Patterns chez O'Reilly, et tu regardes l'exemple avec la pizzeria, tu verras que ce sera bien plus clair --------------- J'ai un string dans l'array (Paris Hilton) |
weblook$$ | "... mais si aucune opération n'est effectuée sur les produits (qui puisse être abstraite) le Factory Method pattern devient un gros tas de boilerplate sans intérêt par rapport à une SimpleFactory ..."
|
Harkonnen ModérateurUn modo pour les bannir tous |
--------------- J'ai un string dans l'array (Paris Hilton) |
masklinn í dag viðrar vel til loftárása |
Message édité par masklinn le 26-03-2006 à 15:47:36 --------------- I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing? |
weblook$$ | oui, mais tu ne m'as pas dit dans quel cas ça pouvait avoir un intérêt. c'est ce qui me manquait pour comprendre. Message édité par weblook$$ le 26-03-2006 à 15:56:06 |
Harkonnen ModérateurUn modo pour les bannir tous | --------------- J'ai un string dans l'array (Paris Hilton) |
slash33 | Si je résume la chose, ce pattern met en pratique un concept de conception : le masquage d'information. Ici le pattern masque et centralise les détails de création. |
masklinn í dag viðrar vel til loftárása |
--------------- I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing? |
Harkonnen ModérateurUn modo pour les bannir tous | Comme dit dans le Head First : "Designs should be open for extension, but closed for modifications" --------------- J'ai un string dans l'array (Paris Hilton) |
masklinn í dag viðrar vel til loftárása |
Message édité par masklinn le 26-03-2006 à 18:31:06 --------------- I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing? |
![]() Publicité | Posté le ![]() ![]() |
Sujets relatifs | |
---|---|
DESIGN PATTERN | Interet des fichiers .h |
[XML] Shema XSD avec un pattern de date ? | Recuperer un pattern en batch |
Quelle est l'interet d'étudier JAVA ou C++ ??? | Design Pattern "Proxy" |
[corba] Obtenir la reference de channel & channel factory | Range pattern matching avec SED |
quel intérêt d'utiliser AWT ? | De l'interet des tables temporaires (benchmark inside) |
Plus de sujets relatifs à : intérêt du pattern factory |