Creator and Factory

Hello!
I am not sure if i have understood the Grasp creator pattern right.
I made a C++ program in school before. Some of the classes were supposed to have a
method called create that created an object of its own class and returned it.
Is it that method that defines the creator pattern or something else?
Can someone show me a short code example that explains the creator pattern?
There seem to be different kinds of the Gof pattern Factory.
Whats the difference between them?

mattias_westerberg wrote:
Hello!
I am not sure if i have understood the Grasp creator pattern right.Presumably you mean this.
http://en.wikipedia.org/wiki/GRASP_(Object_Oriented_Design)#Creator
Be wary of tracking down absolutely everything that says "pattern" and assuming that it is in fact a pattern.
As stated in the above link I doubt there is enough complexity for that to qualify as a pattern. One might as well claim that a loop is a pattern.
I made a C++ program in school before. Some of the classes were supposed to have a
method called create that created an object of its own class and returned it.
Is it that method that defines the creator pattern?Not per the above definition.
Can someone show me a short code example that explains the creator pattern?
Pseudo code.
       class MyDigit
            int digit;
            MyDigit(int digit) { this.digit = digit; }
      class DigitCollection
            AList<Digit> digits = ....
            MyDigit CreateSingleDigit(int digit)
                 return new MyDigit(digit);
There seem to be different kinds of the Gof pattern Factory.
Whats the difference between them?As the definition says there is a composite/aggregation relationship for the 'Creator'
For a Factory Pattern there isn't.

Similar Messages

  • Wipe and factory restore without discs

    Hi can i do wipe and factory restore my MBA without the discs , i have them some where but no idea where

    We did the same with my wife's MacBook Air before giving it to our daughter, but it is not necessary to erase the drive. Create an account for your wife, give her Administrator privileges, then log into her account and delete your account. Everything you did on the MacBook Air will be gone.
    Presumably, your MacBook Air is working well and your intent to 'wipe' it is not therapeutic, i.e., a clean install of the system software to remedy a software problem. If that is what you intend, then you will need to find your discs.

  • SRM7 classic scenario - backend PO creator and item requisitioner

    Hi all,
    In our current SRM4 with backend ECC 6.0 EhP4, the backend system was defined as ERP_2.0.  After shopping cart get approval and PO generated at backend, both the PO creator and item requisitioner are equal to shopping cart creator.
    We are upgrading to SRM7 and exploring the service procurement scenario (transfer service hierarchy) between SRM7 and backend ECC 6.0 EhP4.  After we defined backend system as ERP_4.0 (LOG_MM_P2PSE_1 activated EhP 4) and setup PI, the PO was successfully created at backend via XML message. However, we noticed that the PO creator and item requisitioner were WF-BATCH but not the shopping cart creator.   Is there any setup that can resume both the PO creator and item requisitioner equal to shopping cart creator?
    We also tested in SRM7 to define backend system as R/3_4.6C (does not require PI), then the backend PO creator and item requisitioner are equal to shopping cart creator.
    Regards,
    Donald

    Hi Donald
    988490
    - CHECK CODE CORRECTION
    IF NOT ls_partner-requestor IS INITIAL.
          mc_assign_x ls_be_item preq_name ls_partner-requestor.
        ELSE.
          mc_assign_x ls_be_item preq_name sy-uname.
        ENDIF.
    Note 761630 - WF-Batch in change documents
    Reason and Prerequisites
    There are processes in which changes to the document are implemented in the background task in the background (for example, by the workflow). In this case, the system user WF-BATCH is displayed in the document as the last 'Changed by'.
    Solution
    This is not a general error because the change history correctly displays changes made by the workfow, for example.
    In some cases, it would make sense, from a business point of view, that the change history does not display the WF Batch but the user who triggered the workflow/background process (example: approval of a shopping cart by a manager). Due to the complexity of this development, which involves adjustments of all workflows and background processes, no solution can be provided in Releases SRM 4.0 and SRM 5.0. An advance correction is only possible for the special case when shopping carts are released (see Note 761293).
    by the way what are your rfc user names?
    Check with SAP.
    mUTHU

  • Difference in CIN configuration of depot sales and factory sales

    Hi all,
    I have just completed CIN configuration of a manufacturing plant. I want to know waht would be different in cin configuration of depot sales and factory sales. please guide me in this regard.
    thanks,
    Vikrant

    hi vikrant,
    first define the plant as either depot or factory. this can be dne by putting a chek mark against the plant in the depot column. then you need to knw if the depot is excisble or non excible. for excisible depot there will be an excise registration number maintained for the non excisble there will be none.
    then define the excise groups against each plant. here u again define the depot or non depot settings, the kind of excise invoices, the registers (RG1 for factory and RE23D for depot).
    saurabh

  • Table which stores both creator and requestor names

    Hi Experts,
    We are using SRM 7.0 with extended classic scenario.We got a requirement that when Shopping cart rejected  then rejection email should go to both creator and requestor in case of Shop on behalf.
    But as per standard SRM rejection email going only to requestor.As we are trying to figure out how to trigger the mail to creator aswell,
    Can some one help with the table name if any which stores both creator and requestor names so that we try to build some logic.
    Thanks in advance.
    Regards,
    Kalyani

    Hi Sankara,
    Thanks for your response.
    Yes i checked the FM bbp_pd_sc_getdetails it didn't solved the purpose.
    Thanks.
    Regards,
    Kalyani

  • Invoice List accounting and factorial Discount/Taxes

    Hi ,
    Is it possible to Post Invoice list ( Doc Type LR )Document to FI . If Yes then pl. tell me the procedure ? How can we use factorial Discount and Factorial Tax in Invoice list . if these two conditions are used the how to post in Customers account .
    pl. help to solve this matter
    Thanks

    Hello,
    the invoice list can be released to accounting, if there is sometinh to be released.
    If the pricing procedure includes Invoice list conditions, like RL00 and MW15, and they are found by price determination in the billing document, then when the billing document will be included in an invoice list, the invoice list will be relevant for accounting.
    Best regards,
    Ivano.

  • Java Studio Creator and JDK

    I'm trying to create a game application using java and i've downloaded both java studio creator and JDK. However i'm having problems of writing the program. Should i use notepad and compile it using JDK? Or can i simply use the java studio creator and type in my java codings? And i cant seem to type in any codings in the java studio creator.
    Can someone help me please? Thank you.
    Message was edited by:
    burpyjac

    Hello, Burpyjac!
    I don't understand what you want to do exactly. If you would like to write an applet for a website maybe Java Studio Creator is not what you want, it's an IDE for developing web applications running in an application server like Glassfisch, SJSAS, Tomcat and the like.
    If your game need animation, drawings in a panel and the like you would need another IDE like Netbeans for example to develop an applet. Of course you can just use Notepad, but a IDE like Netbeans is much more comfortable (syntax highlighting, project managment, debugging).
    Java Studio Creator is an IDE for web applications and it is based on Netbeans (if you saw both you will notice). If your game can live without graphics maybe you can use it - but be aware that this applications do not run alone, you need an application server.
    Cheers,
    Jan

  • Sun Creator and using the JNI

    Does any developer or Sun person have a direction for me to go in the use of the JNI within Java Sun Creator?
    It seems last weekend I was talking to a person from SUN in regards to tis issue and they have not got back to me. Has any one that uses searches looks through this user forum used the JNI within Sun Creator and to what extenet if you have.
    Thank you for your help...

    dupey00_ca , Sun support is trying to contact you.
    Please see the response to your posting from ELI-NB on Jan 4
    http://forum.java.sun.com/thread.jspa?threadID=5113212&messageID=9389707#9389707
    John
    from the Creator team

  • Design Patterns: 'Program to an interface, not an impl.' and Factory Method

    Design Patterns: 'Program to an interface, not an implementation' and Factory Method.
    Hi All,
    I've 4 questions. And 1M thanks for your precious input.
    1. OOAD steps:
    Requirement-->Use Cases-->Analysis Classes-->Sequence Diagrams-->CRC-->other UML diagrams if needed--> Domain/Business Classes.
    If we follow the rule 'Program to an interface, not an implementation',
    would that imply NECESSARILY we should have another set of Interface Classes for our Domain Classes? i.e Interface_ClassX for ClassX_Impl.
    2. If the point 1 is a MUST because of the rule 'Program to an interface, not an implementation',
    ie we should have an Interface classe for every one Domain classe,
    would that NECESSARILY imply we should have as many Factory Methods as they are Domain Classes to abstract the creation process?
    Interface_ClassX X= Factory.GetClassX() ( return new ClassX_Impl)
    Interface_ClassY Y= Factory.GetClassY() ( return new ClassY_Impl)
    Interface_ClassZ Z= Factory.GetClassZ() ( return new ClassZ_Impl)
    3. On the point 2, the underlying principle used is Factory Methods.
    Now on the surface, what are other possible business and/or technical naming for such Factory Methods? I mean should we call it a kind of Business Facade?
    4. Is the point 1 and point 2 considered to be the best practices?

    So the question here is whether we can predict having
    more than one possible implementations which required
    option c. Is this a dilema? I guess it's hard to
    predict the future.Right. Hopefully it's fairly obvious while designing things and
    deciding what objects are needed.
    Now, if the Presentation Tier, says JSP, needs that
    ClassNormal object. Would we still keep that line of
    code a.
    OR would we introduce an intermediate object to free
    JSP from the direct creational aspect using new
    keyword like the choice b. that you reject.
    The point here is to reduce the direct coupling aspect
    between the Presentation Tier and Business Tier. So
    what would that intermediate object be?In that case, you have to ask yourself if there is a valid
    need for reducing the coupling. If you simply make an intermediate
    object, what keeps you from making an intermediate object to your
    new intermediate object, ad infinitum.
    That intermediate object could be a Facade pattern, or simply
    an abstraction. We actually did that here, we began a massive
    java project, and we abstracted away from Swing J-classes and created
    our own "wrappers" that simply extended all the J-classes and we had
    all our programmers develop using our wrappers instead of the Swing
    classes. That allowed us to add some custom code, some temporary bug fixes, etc. Some of our classes were nothing more than "EPPasswordField extends JPasswordField" with nothing overridden. It does allow us a place to hook in and adjust or fix things if needed though.

  • I have i phone 4 and i didnt remove my i tune id and passward and i forgotton both and factory restored my i phone now it dosn't start plz help me ..

    i have i phone 4 and i didnt remove my i tune id and passward and i forgotton both and factory restored my i phone now it dosn't start plz help me ..

    Seriously, you can't remember either your Apple ID or Password? Well, since you're logged in here, you obviously can remember that Apple ID/Password.
    Regardless, I suggest you remember this info, 'cause if you can't, all you'll own is a paperweight. And no, Apple can't/won't help you.

  • TS1398 My Wi-fi on/off button in setting has stopped working and I can't even attempt to find anything does anyone know how I can fix it?? I've already reset the phone setting, network and factory settings

    My Wi-fi on/off button in setting has stopped working and I can't even attempt to find anything does anyone know how I can fix it?? I've already reset the phone setting, network and factory settings

    can you see the wi-fi address in the about? if it show N/A, your iphone needs to be repaired.
    if your ios is 5.1.1 or you can see the wi-fi address,you could try to  connect your iphone to the itunes to restore and update.

  • CATS Timesheet creator and approver

    All,
    We have two main roles we are dealing with in CATS. We have a Time Sheet creator and than a Time Sheet Approver. Right now it is setup mainly through the P_ORGIN auth. obj. I won't allow the approvers to approve their own time sheets but itlll allow them to approve everyone elses. so Infotype 0328 is setup with ' ' subtype and activity D, and P_PERNR activty M,R with infotypes 0000-0002 0007 0315 0315 2001-2003 2010 with subtype ' ' and it will allow the approvers to approve anyones timesheets but their own like we would like.. In the Time Sheet creators it is setup with infotype 0001 and ' ' subtype. with activity M in P_ORGIN and activty R for infotype 0007 & 0316 with subtype ' '. which allows the users to create timesheets for only themselves
    The issue is when those two roles are put together to the approver can't create a timesheet. We need the approver to be able to create timesheet for themselves only and approve timesheets for everyone but them selves. I understand the logic of how it is setup (well atleast I think I do) and I know by adding a * to the approver subtype it will allow them to create timesheets for themselves. Is there anyway around this or another way of assigning authorizations to get this to work properly.
    Thanks,
    -Daniel

    Hello,
    I have exaclty the same issue.
    have you found something please ?
    Do you use Pd profile or P_ORGINCON authorisation ?
    Regards
    Edited by: Cédric LEFRANCOIS on Dec 1, 2009 12:53 PM

  • Trigger Email to SC Requestor when SC Creator and Requestor are different

    Hi SRM Gurus,
    I need to trigger an email to SC Requestor when the SC Creator and Requestor are different.
    I searched in the forum but i couldn't get any details related to this.
    Please throw some light on this.
    Thank You.
    With Regards,
    P.Arunkumar

    Hi,
    A couple of approaches are possible:
    1) Incorporate the check into the approval-workflows. The information you need (both creator and requestor) are in the business-object (bus2121). This will require someone with knowledge of workflow, but it's not really all that difficult. Note that you use a notification-task and not a workitem to inform the requestor (you want them to get an email with info, not a workitem like an approver gets).
    Check out the workflow WS10400051 which is used at the end of all SC-workflows. It already contains checks on "sending mail" to approvers, reviewers etc. and a sub-workflow to generate mails to these agents. This would be an "easy" place to add your check and your mail-sending.
    2) Create a Z-copy of the BUS2121 and adapt the setreleased-function to handle sending the mail (less work but more invasive).
    If you have further questions, please report. I will check this thread in the coming time.
    If this helps you, please awards points.

  • My iPhone shut down and factory reset itself for no reason, and now when I plug it into my computer or any power source, the apple shines but it doesn't get any further than that. How can I fix it?

    My iPhone shut down and factory reset itself for no reason, and now when I plug it into my computer or any power source, the apple shines but it doesn't get any further than that. How can I fix it?

    Try Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    But... if the Device has been Modified... this will Not necessarily work.

  • Difference between Builder Pattern and Factory Pattern

    difference between Builder Pattern and Factory Pattern

    You are right Both of these patterns are creational design patterns Purpose of these two patterns is very different as Abstract Factory Patterns (which is commonly known as Factory pattern ) is used to create a object in a scenario when you have a product & there is a possibility of many vandors providing implementation for it. So it is good to come up with a abastract factory which provides create method for the product. Each vendor can implement you abstract factory & provide a concrete implementation which will return a product of Vendor implementation.
    Builder patter is used in case you have a very complex object creation process involved & you realy want to abstract the client from doing all those complex steps. In such situation you create a builder class which takes care of all complex steps & client just needs to use this builder class to create your complex object.
    Hope it clarifies your doubts.

Maybe you are looking for

  • Can i share iTunes music between my kids with different apple id's?

    Can i share iTunes music between my kids with different apple id's?

  • Deploying jClient app

    Another newbie question - I have an application with a model project and a view project in which I have built an ADF application mainly using the wizards so everything is pretty standard. The app connects to a local Oracle database on my PC. My littl

  • Simple image placement problem

    I just recnetly upgraded to Dreamweaver 8 and have a crazy problem that I don't understand. I'm unable to add picutres side-by-side. I don't quite understand what is happenening but when I try and add two images side by side it forces the other down

  • Multiple smartform output to single pdf file

    HI, I am new to ABAP. I have a requirement to combine multiple smartfrom output to  single pdf file.  I searched in this site. I got material but i did not get the complete concept. Can anybody tell me the methodology and sample code to do that. Than

  • (solved?) Virtual Box, kernel26-bfs, 1000hz?

    I switched to the bfs patched kernel, but I get an error when the kernel tries to load the virtualbox module. I assume this is because the default kernel is using a hz rate higher than 1000. I read 1000 is needed, or else you can break some things li