Migrating to Cocoa
Quote from Forum Archives on July 5, 2010, 3:05 pmPosted by: fblistserve <fblistserve@...>
On Jul 5, 2010, at 10:26 AM, Deep wrote:> I saw your post on the main FB list and the "DemystifyingObjects.zip"
> example, really helpful in our learning curve so thanks for that.
Yes, a good example showing how the internals of messaging operate at a low level. I’m sure experienced programmers will be able to relate to the pointer methods used. Amateur programmers who are already intimidated by pointers are less likely to benefit IMO. As Robert’s demo shows, objects are really pointers to objects ( and pointers to methods/functions ). The programmer must be aware that objects are really pointers ( possibly more so if managing memory manually versus using Obj-C 2.0’s garbage collection ) but most of those lower level details are not visible ( nor do they need to be unless required ) during everyday coding.> Was wondering how feasible it would be for you to make that example using
> that very same NIB and detailsRobert’s example creates an instance of a class in code. In a Cocoa nib( which is different from a carbon nib ), all the bits in it are objects that are instantiated when the app is launched( i.e. automatically - no code written by the programmer to make this happen ). The nib objects ( i.e. buttons, text fields etc. ) need something to communicate with such as IBAction in a user-defined class( usually a ‘controller’ class following the MVC model ). In other words, when the button is clicked, the button object needs to inform something of the button click. In XCode/IB this is facilitated by dragging connections between the controller class ( an object that needs to be created in the nib ) and the nib objects such as buttons etc. Doing such nib connections in code using Robert’s code might be possible but it looks problematic to me. Moreover, I’m not convinced such a demo is less confusing than simply following and reading the explanation ( barring some typos I found ) in that doc. If you have any questions about how the implementation in the doc operates I’d be happy to respond.
Brian S
Posted by: fblistserve <fblistserve@...>
> I saw your post on the main FB list and the "DemystifyingObjects.zip"
> example, really helpful in our learning curve so thanks for that.
Yes, a good example showing how the internals of messaging operate at a low level. I’m sure experienced programmers will be able to relate to the pointer methods used. Amateur programmers who are already intimidated by pointers are less likely to benefit IMO. As Robert’s demo shows, objects are really pointers to objects ( and pointers to methods/functions ). The programmer must be aware that objects are really pointers ( possibly more so if managing memory manually versus using Obj-C 2.0’s garbage collection ) but most of those lower level details are not visible ( nor do they need to be unless required ) during everyday coding.
> Was wondering how feasible it would be for you to make that example using
> that very same NIB and details
Robert’s example creates an instance of a class in code. In a Cocoa nib( which is different from a carbon nib ), all the bits in it are objects that are instantiated when the app is launched( i.e. automatically - no code written by the programmer to make this happen ). The nib objects ( i.e. buttons, text fields etc. ) need something to communicate with such as IBAction in a user-defined class( usually a ‘controller’ class following the MVC model ). In other words, when the button is clicked, the button object needs to inform something of the button click. In XCode/IB this is facilitated by dragging connections between the controller class ( an object that needs to be created in the nib ) and the nib objects such as buttons etc. Doing such nib connections in code using Robert’s code might be possible but it looks problematic to me. Moreover, I’m not convinced such a demo is less confusing than simply following and reading the explanation ( barring some typos I found ) in that doc. If you have any questions about how the implementation in the doc operates I’d be happy to respond.
Brian S