Good post!

I hate reading badly formatted code...specielly code that follows standards 
from the 90's. Which evern language it is.



On v.47 tis 23 nov 2010, at 18:52:58, Jerry Krinock wrote:

> General recommendation: If you want people to read your code, please spend 
> some time to make it neat and readable.  Stuff which is formatted like this:
> 
> @interface ComboscAppDelegate : NSObject <NSApplicationDelegate> {
>       IBOutlet NSComboBox *countryCombo;
> NSMutableDictionary *theCountries;
>       NSMutableArray *myKeys;
>       IBOutlet NSWindow *window;
> }
> 
> or this:
> 
> @synthesize window;
> - (void)applicationWillFinishLaunching:(NSNotification *)notif {
>   theCountries = [NSMutableDictionary dictionaryWithObjectsAndKeys:
>                                        [NSMutableArray 
> arrayWithObjects:@"AAABBB", @"AABBB", @"AAACCC", nil], @"A",
>                                        [NSMutableArray 
> arrayWithObjects:@"BBBAAA", @"BBBBBBBB", @"BBBCCC", nil], @"B",
>                                        [NSMutableArray 
> arrayWithObjects:@"CCCDDD", @"CCFGGGFF", @"CCCDDDFFF", nil], @"C", nil];
> 
>       myKeys = [NSMutableArray arrayWithObjects: [theCountries allKeys], nil];
> }
> @end
> 
> makes it look like like the author doesn't really care that much.  I've read 
> that this list has thousands of subscribers; therefore when posting code you 
> should value their time by spending little of yours, as though you were 
> giving a presentation to thousands of people.
> 
> Apple's Mail.app indents a tab character by 8 spaces, so that if you copy 
> code from Xcode, which you have typically set for 3-4 spaces per tab, you end 
> up with indentations that are too large, as in the bad example above.  Since 
> I post alot of code here, long ago I wrote a little AppleScript which 
> processes the text on the clipboard, converting each of the tab characters 
> inserted by Xcode into 4 spaces.  I set it as a menu item in QuicKeys.  You 
> can put it in your Dock or other favorite app launcher.
> 
> <ClipboardTabsToSpaces.scpt.zip>
> 
> (P.S.  If the clipboard has alot of text on a slow Mac, wait a few seconds 
> before pasting.)
> 
> Also, if some lines in the code are too long, shorten them by defining 
> intermediate variables (and re-test before posting!).  I understand that 
> modern compilers will remove such intermediate variables, so there is no 
> performance penalty.
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/mk%40xybernic.com
> 
> This email sent to m...@xybernic.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to