You think about procedural languages ​​like C. This is not bad, because there are all kinds of uses for procedural languages, but that’s not the way you want to think with an object-oriented language like Objective-C.
In procedural language, you have some data, and you have code. These two are separate. Although you may have functions that work with data, these functions can be anywhere in your source, as well as data. There is no clear division of responsibilities unless you take care of developing your program in a certain way. One way to differentiate is to write C code that looks very awful like object oriented code.
In OOP, you have data and code that works with this data. Code and data go together. Data is the member variables of your class, and code is the member functions of your class.
You can create large objects by combining objects of simpler classes. For example, a car will contain objects of the engine class, body, four objects of the tire class, etc.
Objects can also connect to each other if one object uses another. The driver’s object will use the car, or the car will use the road.
Object Oriented Programming is not the Silver Bullet we have been looking for since computers were invented. This is just a good way to organize your code. As you become more experienced, you will quickly find that the object-oriented code can be the same rat nest as the procedural code. If so, you are not thinking about your problem correctly.
source share