Object specific behavior?
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