PDA

View Full Version : Bindings - would someone explain what they are?




glossywhite
Apr 6, 2009, 12:31 PM
Hi all!. I'm finding the Obj-C/Cocoa learning curve a little steep, and I find it pretty hard to grasp concepts of OOP. I am mildly autistic, which I think may be something to do with my not being able to absorb things fully at times, but once I grasp concepts I usually rocket up the learning curve.

If someone would explain to an intelligent, but rather confused n00b to Cocoa, what "bindings" are, bearing in mind that my programming knowledge is rather limited, and I have only JUST grasped the concept of pointers in C/C++ and am willing to learn, as I wish to develop something nice for App Store, soon. I know learning is never overnight (well, usually not) but I have been to IRC channels etc for iPhone/Mac dev, and all I get is rather snooty members telling me to go away, or pointing me to Apple official docs, which just appears to me as if they can't be bothered to encourage me :(.

If someone would be willing to donate 1/2 hour or so of their time to clear up a bit of confusion I have, I would really be extremely and eternally grateful, as I am EXTREMELY technically minded and highly proficient with all computers, but OOP just seems to blow my mind at times.

So many thanks, if you can! :D



PhoneyDeveloper
Apr 6, 2009, 01:41 PM
Bindings are not supported on iPhone OS so are really not a topic for discussion on this forum.

Bindings aren't a beginners topic so you might want to wait a while before learning about them. Obviously the way to start reading about them is to read the Apple docs, as apparently others have told you. You could also subscribe to cocoa-dev or Google Cocoa Bindings for lots of info.

Taum
Apr 6, 2009, 02:08 PM
The point of bindings is to be able to link your models and views without efforts. It builds on KVC and KVO so you also need some understanding of these topics.

Bindings are basically a good implementation of the Observer pattern which is fairly common in OOP. You can probably google that around and find a much better and in-depth discussion that what I could ever explain in a few minutes.

With Bindings, you basically tell the view to "observe" the model and update it's representation every time it is changed, but also to update the model when the view is changed by the user. For example if you had a model with a "Sound Volume" property, you could have a slider bounds to that property so that the model is updated whenever you touch the slider, but the slider would also update if you changed the model by other means (e.g. hitting Vol+/Vol- on your keyboard, but that's just to make it more explicit and this example is probably not very well chosen).

Anyway bindings are not supported on iPhone OS (at least not yet). Not sure exactly why, as we are seeing CoreData coming to the iPhone and I thought bindings were introduced in Mac OS before CoreData :rolleyes:
So you can basically try to tinker with it on Mac OS, have some fun since it's a good technology imho ... but you won't make anything out of it on iPhone OS.

glossywhite
Apr 6, 2009, 04:37 PM
The point of bindings is to be able to link your models and views without efforts. It builds on KVC and KVO so you also need some understanding of these topics.

Bindings are basically a good implementation of the Observer pattern which is fairly common in OOP. You can probably google that around and find a much better and in-depth discussion that what I could ever explain in a few minutes.

With Bindings, you basically tell the view to "observe" the model and update it's representation every time it is changed, but also to update the model when the view is changed by the user. For example if you had a model with a "Sound Volume" property, you could have a slider bounds to that property so that the model is updated whenever you touch the slider, but the slider would also update if you changed the model by other means (e.g. hitting Vol+/Vol- on your keyboard, but that's just to make it more explicit and this example is probably not very well chosen).

Anyway bindings are not supported on iPhone OS (at least not yet). Not sure exactly why, as we are seeing CoreData coming to the iPhone and I thought bindings were introduced in Mac OS before CoreData :rolleyes:
So you can basically try to tinker with it on Mac OS, have some fun since it's a good technology imho ... but you won't make anything out of it on iPhone OS.

Ahh okay :) thanks for taking the time to try and explain to me (it did and does make sense now!). See, the post before yours is the kinda reply I have been getting, just brushing me off which isn't very helpful to me, instead of actually saying "no, I'm gonna help this guy out, no matter if it's not applicable, because it's what he's struggling with, regardless of the fact that maybe it was the wrong forum to ask in". The fact that bindings are not yet applicable on the iPhone is not something I would have known about until now, but just passing the buck seems to be something that those in the know, tend to do a lot, as IRC channels have taught me.

How can we learn, if those with the knowledge are never willing to break off for a bit, and take the time to explain?. Web pages and PDFs are all very well, but you can't beat the one-to-one, human approach sometimes. I have a lot of knowledge, and if I think it can help someone's learning curve, then I'm usually delighted to impart this to them, in order to make a better world.

"Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime."

Thankyou for taking the time - I'd buy you dinner if you were here.

eddietr
Apr 6, 2009, 05:17 PM
"no, I'm gonna help this guy out, no matter if it's not applicable, because it's what he's struggling with, regardless of the fact that maybe it was the wrong forum to ask in".


I think the moderators would have a hard time of it if people were just free to ask questions in whatever forum regardless of relevance. Why not just ask a mod to move your question if you made a mistake?

I'm usually delighted to impart this to them, in order to make a better world.

Oh, there are a lot of people here who are very helpful actually. This is easily one of the better set of forums for that. Lots of real experts here who aren't talking out of their you-know-what's. :) That's rare.

eddietr
Apr 6, 2009, 05:25 PM
Oops, neglected to mention there is another member learning about bindings in a recent thread over on the Mac Programming forum. Maybe something to check out:

http://forums.macrumors.com/showthread.php?t=678674

glossywhite
Apr 6, 2009, 05:47 PM
Oops, neglected to mention there is another member learning about bindings in a recent thread over on the Mac Programming forum. Maybe something to check out:

http://forums.macrumors.com/showthread.php?t=678674

Thanks, eddietr - I actually happened across that earlier :). I just found a VERY useful page in Hillegass' book "Cocoa programming for Mac OS X":

How to Learn
All sorts of people come to my class: the bright and the not so bright, the motivated and the lazy, the experienced and the novice. Inevitably, the people who get the most from the class share one characteristic: They remain focused on the topic at hand.

The first trick to maintaining focus is to get enough sleep. I suggest ten hours of sleep each night while you are studying new ideas. Before dismissing this idea, try it. You will wake up refreshed and ready to learn. Caffeine is not a substitute for sleep.

The second trick is to stop thinking about yourself. While learning something new, many students will think, "Damn, this is hard for me. I wonder if I am stupid." Because stupidity is such an unthinkably terrible thing in our culture, the students will then spend hours constructing arguments that explain why they are intelligent yet are having difficulties. The moment you start down this path, you have lost your focus.

I used to have a boss named Rock. Rock had earned a degree in astrophysics from Cal Tech and had never had a job in which he used his knowledge of the heavens. Once I asked him whether he regretted getting the degree. "Actually, my degree in astrophysics has proved to be very valuable," he said. "Some things in this world are just hard. When I am struggling with something, I sometimes think 'Damn, this is hard for me. I wonder if I am stupid,' and then I remember that I have a degree in astrophysics from Cal Tech; I must not be stupid."

Before going any farther, assure yourself that you are not stupid and that some things are hard. Armed with this silly affirmation and a well-rested mind, you are ready to conquer Cocoa.

I couldn't have said it better myself - this is PRECISELY how I feel and think at times - and I am a certified electronics engineer - FAR from stupid! :D

PhoneyDeveloper
Apr 6, 2009, 06:57 PM
You're not really going to tell us that reading those couple paragraphs by Taum has given you a good understanding of bindings are you?

I doubt that you have a clue what KVO, KVC, and the Observer pattern are.

I find it impossible to understand why you think that those couple paragraphs are better, for some definition of better, than the 'What are Cocoa Bindings' chapter in Apple's documentation, which will take you a half hour to read and took the authors more than five minutes to write.

You may call me snooty but I don't believe that you know one whit more about bindings now than you did before you read Taum's post.

glossywhite
Apr 6, 2009, 07:01 PM
You're not really going to tell us that reading those couple paragraphs by Taum has given you a good understanding of bindings are you?

I doubt that you have a clue what KVO, KVC, and the Observer pattern are.

I find it impossible to understand why you think that those couple paragraphs are better, for some definition of better, than the 'What are Cocoa Bindings' chapter in Apple's documentation, which will take you a half hour to read and took the authors more than five minutes to write.

You may call me snooty but I don't believe that you know one whit more about bindings now than you did before you read Taum's post.

Actually yes - he has explained VERY clearly what the basis of bindings is. Some people instinctively get to the point, and no - he hasn't covered all bases, BUT he HAS given me a very firm grounding on which to build, clarify and work on this, using a process of elimination. Don't underestimate the autistic person's mind - we don't think like the average person! :D

I don't mean to be rude, but have you noticed something here; taum wrote ONE post, and taught me something immediately. You have written TWO replies, both of which have taught me nothing apart from that you're more ready to point me elsewhere than actually take time to TRY and explain, no matter how basic and irrelevant YOU may personally feel it would be to me. Can't tell you why, but taums words just sank in - clicked instantly, the very basic idea of what bindings are. Please don't deride other people's efforts to educate, unless you have a better way of making the same point?.

The personal touch counts for a LOT - maybe it's the fact he took the time to TRY and teach me, no matter how vague and minimal his information was (it was very concise, tbh).

Thanks.