• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            EverSpring working shop

            To pursue creative ideas based on nature.

            統(tǒng)計

            留言簿(1)

            他山之石

            閱讀排行榜

            評論排行榜

            Some notes about the Factory Patterns

            ?

            One of the primary goals of using a factory is to organize your code so you don't need to select teh exact constructor type when creating an object.
            Two kinds of Factory Patterns, actually, they are similar, with difference that the abstract factory can contain servral factory methods.
            • Factory Method
            • Abstract Factory.
            The key roles in the Factory Patterns include:
            • Product : Actually it acts as the working horse in the real time processing, I mean to do the work belonging to the products.
            • Product specific factory :? The place where the special product is made. Please note the word "special", which means that even there is a Super Class of Factory, each kind of product needs a special defined factory as derived factory which is 1-to-1 tightly connected to this specific product.
            • Super Class of Factory:
              1. Actually, it acts as a place where the product specific factories gather.? A table of Concret Product Specific Factory Objects is maintained, as form of static member, by this class.
              2. Also, the class provide the virtual method of the Create() for the derivded Product Specific Factory class to implement respectively.
            • Factory Initializer: The responsibility of this Class is to realize all the necessary Product?Specific Factories, and place them into the static Factory Table of the Super Class Factory. This repsonsibility should and MUST be finished before all the necessary Fatories begin to work on manufacturing, normally occurs when the system is initialized.
            Some rules(if can call them as rules)?needs to be noted when implemented by C++:
            1. The constructor of the specific product normally is designed as Private member, to only allow friend class to access. The purpose of this rule is to prevent the product to be made by incorrect factory.
            2. The 1-to-1 product specific factory is designed as the friend class of the its specific product class.? The implementation of the Product specifc factory could be combined into the internal body of the product as the form of Product::Factory. We can also to place the factory out the product, as the form of ProductFactory. As you wish, :)
            3. The list of the concret factories of the super class of factory is designed as static. The index of the list is used to find the correct concrete factory by passing the Identifier parameter.
            4. The signleton is also used: Factory and the Factory Initializer should be singleton. In other words,?we can only?has only one set of factories and only one factory initializer.?Otherwise, there will exist two interactive factory framework in a single system. The result is that the system is crashed.

            Any supplementary information or correction is to be attached later, with further understanding on this important Patterns.

            Alex Zhang

            posted on 2007-12-11 22:55 everspring79 閱讀(380) 評論(1)  編輯 收藏 引用 所屬分類: Notes

            評論

            # re: Some notes about the Factory Patterns 2008-01-23 17:54 everspring79

            This Monday, I hold a presentation about the design of the fpf agent by introducing the concept of the abstract factory. However, maybe it is due to my presentation skill, the audience does not show great interest on this design pattern.   回復(fù)  更多評論   

            人妻精品久久无码专区精东影业| 久久精品无码一区二区三区| 国产一区二区久久久| 97久久国产露脸精品国产| 精品久久久无码人妻中文字幕豆芽 | 国产高清国内精品福利99久久| 亚洲伊人久久综合影院| 久久天堂AV综合合色蜜桃网| 激情五月综合综合久久69| 国内精品伊人久久久久777| 一本一道久久精品综合| 久久成人国产精品免费软件| 久久久久久狠狠丁香| 亚洲午夜久久久久妓女影院| 久久精品国产国产精品四凭| 蜜臀av性久久久久蜜臀aⅴ麻豆 | 思思久久99热免费精品6| 久久99精品久久久久子伦| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 国产精品久久波多野结衣| 久久综合成人网| 国产成人久久精品二区三区| 国产午夜免费高清久久影院| 亚洲精品无码专区久久久| 欧美激情精品久久久久久久| 国产成人香蕉久久久久| 久久久91精品国产一区二区三区 | 精品亚洲综合久久中文字幕| 国产亚洲综合久久系列| 人妻少妇久久中文字幕一区二区| 偷偷做久久久久网站| 超级97碰碰碰碰久久久久最新| 国产一区二区精品久久凹凸| 色综合久久久久网| 国产成人精品久久一区二区三区av| 久久精品视频网| 91精品无码久久久久久五月天| 成人久久综合网| 99久久精品费精品国产| 久久精品国产清自在天天线| 亚洲国产成人久久笫一页|