"Discussion" is starting to get a little annoying. Object-oriented, don't know how you see
Source: Internet
Author: User
"Discussion" is starting to get a little annoying. Object-oriented, do not know what you think?
Remember the earliest contact object-oriented is Java
Later PHP was made, object-oriented features inherit package polymorphism.
1. Inherit, inherit more you do not know where the object (of course, this is the designer's problem, but it seems that most of the programmer's code is not very good, especially after the business complex).
Web site data source A lot, some cache (here specifically memory) Some of the files are database, error, do not know where the data. To exclude. The package is directly blocked.
2. Encapsulation, originally to ensure that the upper layer without the lower layer, while the data is sealed up to provide only methods, will not be externally modified. But the general company division of Labor is not someone specifically written data source layer Logic Layer so division of the bar. But basically according to the division of business. No one dare to say that my data access layer is no problem, no one dare to say that my class does not have problems. As for the encapsulation of data in the web, it really doesn't make much sense.
3. Polymorphism. PHP is not supported, only method overrides.
In addition, the PHP object calls to check the hash table multiple times, performance is not high. In fact, the PHP class using a hash table to achieve, plainly and array than he is in the array above the hash table encapsulated. It's better to use array.
For object-oriented applications in PHP, I think it would be quite appropriate to encapsulate these places with the action of encapsulating pictures, for example, to generate a thumbnail database.
Welcome to the discussion.
------Solution--------------------
Object-oriented, is a way of thinking
Object-oriented programming is a method
Software engineering: top-down analysis, bottom-up programming. Describing a process-oriented programming approach, he needs to have a deep understanding of every detail involved.
The object-oriented programming approach is top-down analysis, top-down programming. He does not need to know the details from the beginning, but gradually unfolds in the process. Temporarily do not know the link to put an empty object on it.
Object-oriented programming brings a lot of convenience, and inevitably brings more system overhead
This is why the Windows operating system from the beginning of the 10M into the present 300, 400M, the function increased a lot, but the speed is more and more snail
------Solution--------------------
Upstairs, that's the point.
Traditional programming is the data structure + function, with the object-oriented thought, it becomes the method of the database and operation of the structure, that is, the division of function is more clear.
C language has pointers and even function pointers, you can directly manipulate the memory of the specified address, using C to implement object-oriented derivation, polymorphism and the like is very simple, but for most languages, they are not so flexible features, so all provide classes these language features specifically support object-oriented, do not blame them.
In addition, the object-oriented focus on cohesion, it also means that the communication between different objects is very dependent on the explicit message, so the development of the interface design becomes more need to think about design.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.