Re: Flamage (was RE: Question)
Re: Flamage (was RE: Question)
- Subject: Re: Flamage (was RE: Question)
- From: Simon Stapleton <email@hidden>
- Date: Mon, 03 Dec 2001 15:45:08 +0000 (GMT)
>
From: "Smith, Bradley" <email@hidden>
>
To: "'email@hidden'" <email@hidden>, "Eduardo I. Jimenez"
>
<email@hidden>
>
Cc: email@hidden
>
Subject: RE: Question
>
Date: Mon, 3 Dec 2001 13:41:29 -0000
>
>
Ondra Cada wrote:
>
> That almost surely means that your design is flawed (making a
>
> number of unnecessary classes).
<snippage>
>
Sorry to everyone else for the rant but I had to get that off my
>
chest.
Hey, chaps. Time to calm it down, no? I'm noticing a distressing
tendency for people to jump in at the deep end recently, which is
making my newbie questions much less likely to be asked, let alone
answered ;-) Maybe it's to do with the time of year, or something.
Anyway. I tend to agree with Ondra here, and that's not a reflection
on what I think of anyone else's opinions. And here's why.
I'm currently (being paid to) work on a C++ project with > 1,200
distinct _leaf_ classes. Total inheritance tree - > 3,000 classes.
It's terrifying. And it's not that complex an application, really,
for a major financial institution.
This enormous class bloat is due to 2 things, mainly.
1 - Poor initial design
2 - Strong typing
I reckon that with Objective-C, this could be reduced to a couple of
hundred classes at most, without getting too radical. Less than a
hundred with a proper redesign. Really. Although a redesign in half-
way-decent C++ could get it down to 500 or so classes, IMO.
The main problem, and one that I'm suffering myself, when people come
from strongly typed languages to something like Obj-C, is that it is
very difficult to change the way you think. Subclassing
unnecessarily becomes a way of life, and a difficult habit to break.
I'm on the 4th refactor of my object modelling project. It's gone
from nearly 60 classes down to 18. It's got a lot less lines of
code. It does more. Faster. This is a good thing.
I'm beginning to think in terms of objective-C now. I'll think 'How
can I extend something to do this?' rather than 'What do I need to
subclass here?'. It's a wierd way of thinking, to someone who's
spent years doing C++. But Objective-C means manageable inheritance
hierarchies (with the odd downside of a number of categories on
existing classes, but those are generally **very** easily reusable)
So, I think Ondra's probably right here. That's not to say that he's
not, on occasion, a little *ahem* 'forthright' *ahem* from time to
time, but I can live with that ;-)
Just my $0.02 (probably overvalued at that price)
Simon
--
PGP Key ID : 0x50D0698D
--
If the answer isn't obvious, the question is a distraction. Go find
an easier question.