[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: little ObjectiveC poll.
From: |
Marcel Weiher |
Subject: |
Re: little ObjectiveC poll. |
Date: |
Fri, 3 Feb 2006 09:03:51 +0000 |
On 2 Feb 2006, at 05:28, Lloyd Dupont wrote:
I haven't really programmed in ObjectiveC since a long time now.
But I have to work with my boss's source, developed on MacOSX all
in ObjectiveC.
Something puzzles me and I wonder if it's normal in
"ObjectiveC" (or C)..... (or if I'mjust unlucky ;-)
His files are very long (most of them over a few 10 of thousands
lines) and some methods are very long too (up to 1 to 2 or 3
thousands line. 1 thousands line is common, 3 is rare).
Statistics from my Kits:
marcel@tpol[Kits]loc-count
72826 351109 3024156
marcel@tpol[Kits]find . -type f | egrep '(.java|\.c$|\.m$|\.h$)' | wc
1172 1172 44987
So that's 72826 non-empty, non-comment source code lines spread over
slightly over 1000 source files, for around 70 lines per source
file. Of course, that's skewed a bit because header files tend to be
small, so let's look at just the .m files:
marcel@tpol[Kits]find . -type f | egrep '.*\.([m])$' | wc
534 534 20045
marcel@tpol[Kits]find . -type f | egrep '.*\.([m])$' | xargs cat |
egrep -v '^[[:space:]]*$' | grep -v '^[[:space:]]*{[[:space:]]*$' |
grep -v '^[^[:alnum:]]*}$' | grep -v '^[[:space:]]*//' | grep -v '^
[[:space:]]["![:space:]]*"[[:space:]]*$' | wc
43175 136649 1613933
marcel@tpol[Kits]stsh
> 43175.0 / 534
80.85206
So looking just at the .m files gives us 43 KLOC in 534 files, for an
average of 80.852 non-comment, non-space lines per file.
Now I wonder, is it "common practice" in ObjectiveC, or is it just
my boss?
Well, I don't think it has anything to do with Objective-C. In fact,
in Objective-C, short methods ( 3-7 lines ) with intention-revealing
selectors are encouraged. However, it appears to be common practice
in the industry :-(
For example right now I'm looking at porting mouse selection /
dragging to windows.
The last 2 methods I looked at
- moveSelectedGraphicWithEvent:
- reparentSelectedGraphicsWithEvent:forced:offset:
are 1300 and 1500 lines long....
what do you think?
OUCH!
Marcel