• 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: newbie questions about objective-c, ruby, python, groovy and cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie questions about objective-c, ruby, python, groovy and cocoa


  • Subject: Re: newbie questions about objective-c, ruby, python, groovy and cocoa
  • From: Wade Tregaskis <email@hidden>
  • Date: Thu, 10 Jun 2004 21:01:59 +1000

Method overloading is a convenience provided by the compiler so you don't have to think of a different name when you have two methods that are conceptually the same but take different arguments. But in Objective-C, when you have different arguments, the *natural* thing to do is to name the method accordingly. I see this as a good thing because it makes code more readable [...]

Objective-C arguably does support method overloading. It's just it happens to always be the same method that's called, so it's up to the programmer to perform the appropriate distinctions.

For example, I have a couple of frameworks which all work in similar areas, but are built primarily to be independent of each other. Consequently many methods within them will accept object's of both Apple's classes and my own (with support for my own done in a weak fashion, so the frameworks are truly independent).

C++ doesn't offer this. If I want to overload a method, it must be done at compile time, which removes the possibility that I'll upgrade my class at a later time. It also means I have to link against everything that has an overloaded version of the method, which means no nice weak linking. At least, nowhere near as easily as in ObjC.

The biggest thing people new to ObjC need to understand is that it's not Java or C++. The sooner they accept that, and stop trying to face them off against one another, the sooner they'll appreciate it's unique features, and understand it's trade offs in traditional functionality or methodologies.

Also, fwiw, this Java vs ObjC vs C++ vs whatever argument has been done to death before... there's bound to be heaps on it in various list archives, and similarly there's some very good articles floating around on the web about it - google them.

Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: newbie questions about objective-c, ruby, python, groovy and cocoa (From: "KlunkyRobot" <email@hidden>)
 >Re: newbie questions about objective-c, ruby, python, groovy and cocoa (From: Andy Lee <email@hidden>)
 >Re: newbie questions about objective-c, ruby, python, groovy and cocoa (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: newbie questions about objective-c, ruby, python, groovy and cocoa
  • Next by Date: Re: Autocompletion
  • Previous by thread: Re: newbie questions about objective-c, ruby, python, groovy and cocoa
  • Next by thread: Re: newbie questions about objective-c, ruby, python, groovy and cocoa
  • Index(es):
    • Date
    • Thread