• <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.

            統計

            留言簿(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.   回復  更多評論   

            国产精品热久久无码av| 亚洲国产精品综合久久网络| 色婷婷综合久久久中文字幕| 婷婷久久香蕉五月综合加勒比| 人妻无码αv中文字幕久久| 久久电影网2021| 性做久久久久久久久老女人| 久久人人妻人人爽人人爽| 一本伊大人香蕉久久网手机| 国产毛片欧美毛片久久久| 久久久精品一区二区三区| 超级碰碰碰碰97久久久久| 日韩精品久久久久久久电影蜜臀 | 国内精品欧美久久精品| 国产成人精品白浆久久69| 精品久久人人爽天天玩人人妻| 亚洲中文字幕久久精品无码喷水| 91久久成人免费| 亚洲va久久久噜噜噜久久狠狠 | 亚洲国产天堂久久综合| 久久国产午夜精品一区二区三区| 一本色综合网久久| 欧美午夜精品久久久久久浪潮| 99久久国语露脸精品国产| 无码人妻精品一区二区三区久久| 青草久久久国产线免观| 久久婷婷国产麻豆91天堂| a高清免费毛片久久| 熟妇人妻久久中文字幕| 少妇熟女久久综合网色欲| 久久久受www免费人成| 久久国产热这里只有精品| 99久久免费国产精精品| 99久久精品日本一区二区免费| 超级97碰碰碰碰久久久久最新| 久久久精品人妻无码专区不卡| 久久久久无码国产精品不卡| 精品无码久久久久久久久久 | 久久亚洲中文字幕精品有坂深雪| 国产精品久久午夜夜伦鲁鲁| 午夜人妻久久久久久久久|