MVC中的模型系统的作用

源自《cocoa设计模式》

 

    The Role of the Model Subsystem Consider the role of the Model subsystem in a ModelView Controller application.The model is composed of the objects that provide the unique capabilities and information storage for an application. Models contain the rules for processing application data. Mod- els provide the in-memory representation of application data to be viewed, edited, or processed.

    Models are also usually responsible for persistent storage of application data.The model must load or store data in some way. Common forms of persistent storage include files on a disk drive, client-server databases, and more recently,“cloud” computing where data is stored on an anonymous remote server and accessed using Universal Resource Lo- cators (URLs).

   Some models need to work with vast amounts of data, and it’s not practical to keep all of the data in memory at once. In such cases, models sometimes include search features or filters to limit the amount of data in memory at one time.

    Models contain the logic or rules for manipulating data. Some data may be calculated from other data using application-specific algorithms. Data may be constrained to specific types like “dates” or “positive integers.” Data values may have defined minimums and maximums. Models provide data validation to ensure that constraints are met.

    Models manage relationships between objects. For example, a model that stores infor- mation about books and publishers might contain the following rules: “each publisher has a list of zero or more books that have been published,”“each book has zero or one identified publisher,” and “whenever a book is added to a publisher’s list of published books, the book’s identified publisher must be set to correspond.”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值