• 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
Object specific behavior?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Object specific behavior?


  • Subject: Object specific behavior?
  • From: "Frank Bettger" <email@hidden>
  • Date: Thu, 25 Oct 2007 10:00:58 +0200

Long time ago I use to make simple programs using HyperCard. IMHO this is
the simplest programming environment ever created. There were some things I
was accustomed to and that I looked for in Cocoa.
Let's say I want to create a simple application with just one button. When
the user clicks on the button a beep should be heard.
In HyperCard (and in Macromedia Director) each object has attributes which
you can configure with an inspector. One of the attributes is a script
window where you can add object specific code. For instance to make the
button beep you would write

on mouseUp
   beep()
end mouseUp

Now when we look at Cocoa there is an inspector where you can change
attributes of the button, but not the code (of the button instance). Instead
I'm forced to create an extra object called AppController or something
similar and I'm forced to use target action mechanism. And this just beacuse
all code is in the class while the data (ivars) is in the objects.
This division between data and code seems somewhat arbitrary. We know from
such languages as Lisp that there is real difference between data and code;
that is if the language implementors do not force it on us.
What I'm saying is that Cocoa could be simpler to use if you could attach
code as one attribute to your objects. I'm not Cocoa savvy, but this seems
reasonable.
Maybe I'm missing something. Is there a simple way to create a beep without
creating a new class?

Any thoughts on this?
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Object specific behavior?
      • From: glenn andreas <email@hidden>
    • Re: Object specific behavior?
      • From: Uli Kusterer <email@hidden>
    • Re: Object specific behavior?
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Re: Bindings Problem: [change valueForKey:NSKeyValueChangeIndexesKey] always returns NULL!!
  • Next by Date: Re: Troublesome app when scaling it up, how to proceed?
  • Previous by thread: Re: Bindings Problem: [change valueForKey:NSKeyValueChangeIndexesKey] always returns NULL!!
  • Next by thread: Re: Object specific behavior?
  • Index(es):
    • Date
    • Thread