What is the difference between data-centric and object-oriented application models?

前端 未结 2 1295
一向
一向 2021-02-13 23:37

What is a data-centric application and is there any difference with an object-oriented application model ?

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-14 00:36

    The two concepts are somewhat orthogonal, a Data Centric Application is one where the database plays a key role, where properties in the database may influence the code paths running in your application and where the code is more generic and all/most business logic is defined through database relations and constraints. OOP can be used to create a data centric application.

    Some of the large multi-tier architectures which people think of when they say OOP architecture implement business logic in code and just store the data in the database. However, it would be wrong to think Object Oriented design necessarily has to be a large business logic ridden system.

    Say you have to implement message passing between two systems. One way (although a bad way) is to have each of the systems write the messages to the database and the other system read from the database every so often to pick up messages. This would be a data centric approach as there is very little code needed other than reading and writing data.

    The same system could be implemented by having the systems open a socket connection to each other and send messages directly. In this way there is more code and less database access. This is the non-datacentric approach. Either of these could be implemented using OOP concepts.

    Another example from my work we implement servers for games, one type of server handles multi-player game play so user presses the button and spaceship fires missile at other player. This server is not datacentric it is event based. Another server stores the users high scores, friend lists etc this server is thin wrapper over the database which stores the score and lists.

提交回复
热议问题