• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mutability
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mutability


  • Subject: Re: Mutability
  • From: Raphael Sebbe <email@hidden>
  • Date: Wed, 21 Nov 2001 18:06:07 +0100

Ondra,

I am not sure what you mean here, but one of the points of the OO approach, when compared to the procedural one, is to get rid of the "switch" and "if else if" sequences. This is accomplished because objects know how to handle a particular situation :

Procedural:
drawShape(shape)
{
switch(shape->id)
{
case CIRCLE:
drawCircle(shape);
case RECTANGLE:
drawRectangle(shape);
}
}

OO:
[shape draw];


At least, you demonstrated that it is possible to do procedural programming with Obj-C. And, although I prefer Obj-C over C++, I can assure you that OO programming is possible using C++.

Raphael


On Wednesday, November 21, 2001, at 02:57 PM, Ondra Cada wrote:

I beg to differ. It seems to me that the proper OO approach is "give any id
to me; I'll ask it what kind it is, and I'll behave accordingly".

The approach you advocate here -- ie. "give me an object we both know
beforehand which kind it is" seems to me like non-object-oriented, C++-way of
thinking.


References: 
 >Re: Mutability (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Clicking dock icon... (Still no luck!)
  • Next by Date: Re: Mutability
  • Previous by thread: Re: Mutability
  • Next by thread: Re: Mutability
  • Index(es):
    • Date
    • Thread