From: Daniel T. on
blp(a)cs.stanford.edu (Ben Pfaff) wrote:
> 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.

I suspect that the above was the correct answer, but the question was
poorly asked. Maybe something like "What three words best describe the
Object-Oriented paradigm?"
From: Daniel T. on
"BGB / cr88192" <cr88192(a)hotmail.com> wrote:

> 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...

I haven't done too much Java, but I often put multiple classes in a
file, even in that language...
From: August Karlstrom on
On 2010-07-30 02:42, BGB / cr88192 wrote:
> 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...

Oberon is an example of a language where you can define several classes
inside a single module. In Oberon the module and not the class (type)
takes care of information hiding; in the context of OOP the only new
concept in Oberon compared with e.g. Pascal is inheritance (type extension).


August
From: BGB / cr88192 on

"August Karlstrom" <fusionfile(a)gmail.com> wrote in message
news:i2uhun$u48$1(a)speranza.aioe.org...
> On 2010-07-30 02:42, BGB / cr88192 wrote:
>> 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...
>
> Oberon is an example of a language where you can define several classes
> inside a single module. In Oberon the module and not the class (type)
> takes care of information hiding; in the context of OOP the only new
> concept in Oberon compared with e.g. Pascal is inheritance (type
> extension).
>

C++ also allows many classes per file, but still many people follow the
one-class-per-file rule, and it is annoying...

more so is combining this with using #include on *every* class one might
want to reference, or doing a single root source-file which uses #include to
merge every other source file in the project into some massive source file.



From: BGB / cr88192 on

"Daniel T." <daniel_t(a)earthlink.net> wrote in message
news:daniel_t-E1E2BA.08300830072010(a)70-3-168-216.pools.spcsdns.net...
> "BGB / cr88192" <cr88192(a)hotmail.com> wrote:
>
>> 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...
>
> I haven't done too much Java, but I often put multiple classes in a
> file, even in that language...


yes, but there are restrictions:
for cannonical Java, either the other classes need to be marked private, or,
more commonly, the classes are declared within other classes.

but, one can't just lump a bunch of classes together in the same way as in,
say, C# or C++, and expect it to still work.