objective c - Bundle declarations into one statement or not? -
given following objective-c example, matter of style , ease of reading keep separate statements or bundle them one? there actual benefits of either? waste of memory declare individual variables?
nsdictionary *thedict = [anobject methodtocreatedictionary]; nsarray *thevalues = [thedict allvalues]; nsstring *theresult = [thearray componentsjoinedbystring:@" "];
or
nsstring *theresult = [[[anobject methodtocreatedictionary] thevalues] componentsjoinedbystring:@" "];
i take following consideration when declare separate variable:
- if might want see value in debugger.
- if accessing variable more once.
- if line long.
there no practical difference between 2 approaches, however.
Comments
Post a Comment