• 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
Re: Newbie questions about XCode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie questions about XCode


  • Subject: Re: Newbie questions about XCode
  • From: Johan Lund <email@hidden>
  • Date: Wed, 3 Feb 2010 16:29:29 +0100

Quick note on this specific comment. There is a huge problem with automatically declaring a property, even ones that are IBOutlets. Properties don't always have to be @synthesize (they can be @dynamic or even nothing at all). They aren't always (nonatomic, retain) either, even ones are are IBOutlets can be (nonatomic, assign). The Table View Programming Guide for iPhone OS gives an example of this. If you automatically @sythesize properties, you will lead to a situation where you're causing the user to delete code for it to work properly. This is always a bad idea. A general rule of thumb with automatically generated code is that the user should not have to delete code to make it work properly. This is why stuff you have to delete in Xcode show up as tokens and not code (like the "initializations" token when you automatically create an init method).

I don't mean that it should be done automatically without you consent so that you later have to go delete or change code. That would be pretty counter productive.

Microsoft tried this in Word with a cartoon character named Clippy. Myself and many other developers would HATE this feature.

I also don't suggest that we resurrect Clippy and put him into XCode - God forbid! :)

To take the idea from IntelliJ. When you type in e.g. "IBOutlet UIPickerView *myPV" a small icon appears in the gutter area on the same line. If you click it a new user interface element (maybe a dialog) appears that let's you choose to add property, synthesize along with options or just immediately go with the settings you used last time. The whole process should not take more than 5 seconds unless you deviate from the default in which case it will take a couple of more seconds. No spelling errors or missing * or having to remember signatures. Same thing when you declare a method in the .h file. Click the icon and generate a method with the same signature in the implementation or vice versa unless XCode detects that it's a delegate method. 


3 feb 2010 kl. 15.05 skrev Matt Thomas:

On Wed, Feb 3, 2010 at 8:00 AM, Johan Lund <email@hidden> wrote:
When adding and outlet to a class I find myself adding a property declaration and then synthesizing it. This could all be done for me.

Quick note on this specific comment. There is a huge problem with automatically declaring a property, even ones that are IBOutlets. Properties don't always have to be @synthesize (they can be @dynamic or even nothing at all). They aren't always (nonatomic, retain) either, even ones are are IBOutlets can be (nonatomic, assign). The Table View Programming Guide for iPhone OS gives an example of this. If you automatically @sythesize properties, you will lead to a situation where you're causing the user to delete code for it to work properly. This is always a bad idea. A general rule of thumb with automatically generated code is that the user should not have to delete code to make it work properly. This is why stuff you have to delete in Xcode show up as tokens and not code (like the "initializations" token when you automatically create an init method).

Now, some of your comments are good ideas. I particualrly like this one:

If I nominate e.g. the fileowner in interface builder to be the delegate of some component, why does not XCode automatically offer to insert the necessary e.g. <UIPickerViewDelegate, UIPickerViewDataSource> in my .h file?

You should definitely submit them to http://bugreport.apple.com but keep in mind not all of your suggestions are a "correct" way to do things, they're just a personal preference. A good example is this:

Things like this is done for me if I want it to in IntelliJ for example, the call it intentions. "It seems like you intend to implement an adapter in this class..."
 
Microsoft tried this in Word with a cartoon character named Clippy. Myself and many other developers would HATE this feature.


-Matt

Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Newbie questions about XCode
      • From: Matt Thomas <email@hidden>
References: 
 >Newbie questions about XCode (From: Johan Lund <email@hidden>)
 >Re: Newbie questions about XCode (From: Ian Jackson <email@hidden>)
 >Re: Newbie questions about XCode (From: Johan Lund <email@hidden>)
 >Re: Newbie questions about XCode (From: Jack Nutting <email@hidden>)
 >Re: Newbie questions about XCode (From: Matt Thomas <email@hidden>)

  • Prev by Date: Re: Newbie questions about XCode
  • Next by Date: Re: Newbie questions about XCode
  • Previous by thread: Re: Newbie questions about XCode
  • Next by thread: Re: Newbie questions about XCode
  • Index(es):
    • Date
    • Thread