I saw him again and again. A computer programmer proudly declares, "Yes, my code is intended for objects. Refer? My data members are all private, and can only be accessed through general member functions. That's what the object is all about." I've even heard that this type From leadership comes from the mouths of computer science graduates – people who are supposed to have studied the orientation of objects in the classroom, or who have had a great opportunity to teach themselves.
Visitors can bargain about the nuances of pointing objects; however, one thing is certain: the mere presence of private data and public functions does not constitute a suitable design for the object. Instead, the correct orientation of the object requires more.
One of the key elements is hiding information. This means that objects should only provide information that is to be seen; that is, they should provide a coherent and well-chosen interface for functions – do not betray the contents of the data and internal separations. In other words, the way the functions are implemented remains hidden from the user, allowing the developer to change the application as needed. (Some also refer to this “packaging”, while others indicate that packaging is just a way to hide information. I am inclined to the last view; but for the purposes of this article, this distinction is insignificant. Suffice it to say that this information hiding is a key element in designing Object oriented.)
When a programmer declares that its code is intended for objects by virtue of the presence of private data and public functions, it places the cart before the ideal horse. The use of private data and public functions is just a way to achieve concealment of information; it is not an end in itself. For example, consider a design that has each of the data members individually "get" and "set" identical (for example, the data member "x" will have the functions "getx ()" and "setx ()"). In this example, the information is poorly hidden, because choosing jobs (really, their names!) Betrays the way the data is executed.
Inheritance is another major component; that is, specific classes to be drawn from are more general. Genetics is a method of performing abstraction. This means that it allows the user to define objects with common properties, which should therefore use the common code (or at least, common interfaces). This is an integral part of thinking in terms of He wills , Unlike thinking primarily in terms of functions and procedures.
Another fundamental feature is the polymorphism, which allows the sloping object to bypass the functions of the parent organ. With polymorphism, the descending object doesn't have to respond to the message just as its predecessor does; instead, it can have its own implementation. Note that descending objects do not have to bypass these functions; instead, they should simply be allowed to do so, as needed. There is much to say about the nature of the object's direction; in fact, scholars often discuss its precise definition and main ideas. Whatever the case, the point remains: just keeping private data and a set of public functions does not constitute a object-oriented design – not in any meaningful sense of the term.