I was watching the WWDC ARC introduction video and I saw something I\'ve never seen in ObjC before when some Apple engineer talked about a Stack example.
The followi
I am new to Objective C, and I found the practice of declaring ivars in the header very very odd. It means declaring the internal state of an object in its public header, which defies the concept of encapsulation.
For example say you own an IPad. Apple does not want you to break the IPad open and pry around , and mess with the elements inside. If they want you to modify something, the IPad will have a setting that let you change that.
Similarly I dont want other programmers to see the ivars of my objects. Its the internal state of my object. If I want you to acess the internal state, I will declare properties for it.
So, as in other languaes, I would hide my ivars inside the implementationfile, and not declare them in the header.
Declaring ivars in the header just strikes me as very very odd. Those ivars are implementation specific, and should simply not be part of the header file.