Using the debugger with local variables was Re: is this badly written code?
Using the debugger with local variables was Re: is this badly written code?
- Subject: Using the debugger with local variables was Re: is this badly written code?
- From: Erik Buck <email@hidden>
- Date: Tue, 15 Apr 2008 10:46:48 -0700 (PDT)
>1) Write each portion of the code by assigning to intermediate ivars.
>This of course is easiest if you just type them in-line as you write
>them, but then of course they will not show up in the debugger so it
> is better to go ahead and type them in the @interface section.
Say what ? Local variables show up perfectly fine in the debugger. Creating an instance variable just to store intermediate results is of dubious value.
Even with nested messages, no special magic is needed. To see intermediate values, just use the po command.
> po [NSURL URLWithString:@"somestring"]
> po [NSURLRequest requestWithURL:[NSURL URLWithString: @"somestring"]]
I also highly recommend F-Script for this type of interactive testing/debugging: http://www.fscript.org/
_______________________________________________
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