• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Apples's code examples... Poor coded or it is just me?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Apples's code examples... Poor coded or it is just me?


  • Subject: Apples's code examples... Poor coded or it is just me?
  • From: Yanko Ivanov <email@hidden>
  • Date: Wed, 6 Feb 2008 12:05:17 +0100

Hello all!

Some uncomfortable thoughts do not leave me alone after taking a look at the recent "Low-Level Core Data Tutorial" update on ADC.

Please take a look at the code at http://pastie.textmate.org/148159

It is clear that the code's intention is to instantiate the managed object context only once... however it seems to me that a new instance will be created every time the method is being called.

It this the case or there is something I should learn first and then criticize? :)

I also noticed the following pattern used in the Docs for creating instance members that are expensive to create:

begin method
    if instance_member not nil
        return instance_member

    instantiate instance_member
    return instance_member
end method


Why just not use:

begin method
    if instance_member is nil
        instantiate instance_member

    return instance_member
end method


Thank you in advance.

Regards,
Yanko
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Apples's code examples... Poor coded or it is just me?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Re: Deployment target for a Leopard only app
  • Next by Date: Re: Use of Mac OS X 10.5 / Leopards Garbage Collection Considered Harmful
  • Previous by thread: Re: Deployment target for a Leopard only app
  • Next by thread: Re: Apples's code examples... Poor coded or it is just me?
  • Index(es):
    • Date
    • Thread