From: RDA on
So I had a phone interview not so long ago and it was going quite
well, but then the interviewer asked "What are the 3 rules of object
oriented programming?" and I was at a loss. I said "Well, I can
explain what OOP is...but I'm not sure I know what 3 rules you're
talking about..."

Does anyone?
From: Ben Pfaff on
RDA <roy.anderson(a)gmail.com> writes:

> So I had a phone interview not so long ago and it was going quite
> well, but then the interviewer asked "What are the 3 rules of object
> oriented programming?" and I was at a loss. I said "Well, I can
> explain what OOP is...but I'm not sure I know what 3 rules you're
> talking about..."

Encapsulation, inheritance, and polymorphism are principles or
aspects of OOP. I guess in some sense those are rules.
--
Ben Pfaff
http://benpfaff.org
From: Pascal J. Bourguignon on
RDA <roy.anderson(a)gmail.com> writes:

> So I had a phone interview not so long ago and it was going quite
> well, but then the interviewer asked "What are the 3 rules of object
> oriented programming?" and I was at a loss. I said "Well, I can
> explain what OOP is...but I'm not sure I know what 3 rules you're
> talking about..."
>
> Does anyone?

No, nobody does.

There are rules, but mores than three, and nobody agree on what rules
makes OO.



--
__Pascal Bourguignon__ http://www.informatimago.com/
From: Richard Heathfield on
RDA wrote:
> So I had a phone interview not so long ago and it was going quite
> well, but then the interviewer asked "What are the 3 rules of object
> oriented programming?" and I was at a loss. I said "Well, I can
> explain what OOP is...but I'm not sure I know what 3 rules you're
> talking about..."
>
> Does anyone?

I don't know about *the* three rules of OOP, but *my* three rules are:

1) OOP is not a silver bullet;
2) a single class hierarchy is a recipe for disaster;
3) don't try to shoehorn every OOP concept and language feature into
every program.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
From: BGB / cr88192 on

"Richard Heathfield" <rjh(a)see.sig.invalid> wrote in message
news:vOydnc9xaN8MiM_RnZ2dnUVZ8nednZ2d(a)bt.com...
> RDA wrote:
>> So I had a phone interview not so long ago and it was going quite
>> well, but then the interviewer asked "What are the 3 rules of object
>> oriented programming?" and I was at a loss. I said "Well, I can
>> explain what OOP is...but I'm not sure I know what 3 rules you're
>> talking about..."
>>
>> Does anyone?
>
> I don't know about *the* three rules of OOP, but *my* three rules are:
>
> 1) OOP is not a silver bullet;
> 2) a single class hierarchy is a recipe for disaster;
> 3) don't try to shoehorn every OOP concept and language feature into every
> program.
>

yep, agreed...

there are basically several of the major things which annoy me about many OO
projects.

I will add to this:
always using a single class per file is annoying.

sometimes, the class is very large, and options such as partial classes (in
C#) make sense;
other times (much more commonly), the classes are very small, and it makes
sense to lump them together (it causes much annoyance to have many source
files each with maybe only 10 or 15 lines...).

granted, the downside here is Java, which by design enforces this little
practice...