• 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: "static" typing (Learning Cocoa Chapter 13)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "static" typing (Learning Cocoa Chapter 13)


  • Subject: Re: "static" typing (Learning Cocoa Chapter 13)
  • From: Ondra Cada <email@hidden>
  • Date: Sat, 29 Sep 2001 15:02:21 +0200

jgo,

>>>>>> jgo (j) wrote at Sat, 29 Sep 2001 05:04:56 -0700:
j> >NSString *s1,*s2,*name=[a objectAtIndex:0],*a,*b,*val=[d
j> >objectForKey:key];
j> >
j> >and the corresponding six lines is tremendous, and definitely
j> >in favour of the format above.
j>
j> C'mon! You're pullin' our legs. Talk about maximizing obfuscation!
j>
j> NSSTring * s1;
j> NSString * s2;
j> NSString * a;
j> NSString * b;
j> NSString * name = [a objectAtIndex:0];
j> NSString * val = [d objectForKey:key];
j>
j> is much clearer.

It is not. It is worse to read, much worse to grasp quickly, more bad to
orient yourself in the code. Whilst with "my" variant you more often than not
can see a complete method in a window, with the "one of yours" you have to
scroll to see either declaractions, or their usage, but they don't fit there
all. That makes a *WORLD* of difference.

Of course you can do that nonsense if you want to, just like you can do (as
I've often seen in programs of my younger and less experienced students)
things like

BOOL flag;
...
if (a)
{
flag=YES;
}
else
{
flag=NO;
}
if (flag) {
...
}

instead of the decent

if ((flag=a)) {
...
}

This is the very same thing. Nobody forces you to write a readable code;
*you* should force yourself to do that, though, for sake of easy maintaining
and upgrading.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


References: 
 >Re: "static" typing (Learning Cocoa Chapter 13) (From: jgo <email@hidden>)

  • Prev by Date: Re: NSArray behavior changes?
  • Next by Date: Re: NSArray behavior changes?
  • Previous by thread: Re: "static" typing (Learning Cocoa Chapter 13)
  • Next by thread: OT: IrDA in 5G64
  • Index(es):
    • Date
    • Thread