-2

Strange grammar, but I want to ask if there are cases where if I don't KVO (Key Value Observation), the app just can't do certain things/features?

Thanks

Undo
  • 25,519
  • 37
  • 106
  • 129
mskw
  • 10,063
  • 9
  • 42
  • 64
  • And KVO stands for... – Undo Apr 08 '13 at 20:45
  • @ErwaySoftware Key-value observation. Notification system for when values change. Check out: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html. I didn't know either, had to look it up. – Paul Richter Apr 08 '13 at 20:46

2 Answers2

5

Key Value Observing offers functionality and behaviors that are unique and certainly useful to a developer, in same cases offering a glimpse at values that are otherwise opaque.

For example, if you want to know the precise duration of an animation in Cocoa that is otherwise a black-box (for example, the keyboard disclosure animation duration), KVO is the only way I know of that you could establish that.

Beyond that, it's a useful pattern for programming applications that involve data (go figure). As such, it is yet another tool in a developer's toolkit.

Can you get by without it? Sure. There are many tools you can get by without, and this one takes a little bit of effort to wrap your head around initially. But should you make a point of avoiding it? No, I don't think so - why would you?

isaac
  • 4,867
  • 1
  • 21
  • 31
1

You nearly never need KVO.
Only when you need some special things, or want to circumvent Apple sw design.
And for that few cases, you will find demo code, so dont worry about KVO much.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • 1
    While I agree that you rarely _need_ KVO, as applications grow in complexity, it's a wonderful tool. I wouldn't have described it as being useful "to circumvent Apple sw design", because if you're doing that, you're probably not doing it right. It's a very useful technique provided by Apple to automate notifications. When used properly, it's effective and very useful. But I agree that a new developer doesn't generally need to avail themselves of this somewhat advanced feature. But if you're writing your own setters (which you rarely do, anyway), I'd suggest you call the KVO methods. – Rob Apr 08 '13 at 21:04