A little about history of OOP, its motivation, and core concepts.
Object persistence — for example, saving/loading objects to/from a database — is easy, especially when using an ORM framework. It is easy because it breaks principles of OO design.
In recent years, Entity-Component Systems (ECS) has been recognized as the most notable architecture for game development. There are many good articles about the architecture that can be found on the Internet, some of them are:
- Entity Systems are the future of MMOG development
- What is an entity system framework for game development?
- Why use an entity system framework for game development?
- Understanding Component-Entity-Systems
- Entity Systems Wiki
- Entity component system [Wikipedia]
Of course these articles are excellent and well-written, but one thing I don’t like about them is that they are not fair at comparing OOP and ECS. They think that class inheritance is fundamental to OOP thus they blame OOP in order to praise ECS as a preference of composition over inheritance.
All software are about functions operating on data. Data come with the concepts of structure  and state; concepts of functions include prototype and implementation. We can change data structures at coding-time and change data states at run-time. But the prototype and implementation of a function cannot be changed at run-time, they are allowed to be changed at coding-time only. Another different is that data are passive while functions can access data and/or call other functions. These differences between functions and data should be carefully considered when designing software.
Many programmers when concerning about OO design usually say: “Static methods are bad because they encourage procedural paradigm”. In this article, I would argue that static methods are not always bad and they have nothing to do with procedural paradigm.
Nếu tôi hỏi bạn: “tại sao phải phân loại các class vào các package” bạn có thể sẽ trả lời: “để dễ quản lý”. Tất nhiên câu trả lời này là đúng, nhưng chưa giúp ích được gì nhiều. Và câu chuyện của chúng ta sẽ còn kéo dài hơn thế.