Software Engineering——A PRACTITIONER'S APPROACH (english edition · eighth edition)

CONTENTS AT A GLANCE

 

PART TWO    MODELING

        CHAPTER 10  Component-Level Design  276

10.2 DESIGNING CLASS-BASED COMPONENTS

The Open-Closed Principle (OCP). "A module[component] should be open for extension but closed for modification"

  简单说明一下,按照软件过程,我们先进行需求分析。因为我们是做游戏开发商,所以需求来源于策划文档,所以我们直接对策划文档进行需求,建模在需求建模过程中,可以分析用例和类。然而困难是类方法的参数和返回值,而最近出了流程及界面,在进行前后端交互的接口定义上我和前端人员进行沟通。前端对接口的要求是界面上有什么参数在接口的返回值上就需要包括什么参数。作为后端,我对接口的要求是不是面向界面,而是面向与功能,也就是在建模时分析出的类操作。这样的话,那的参数就可以根据前端界面,以及游戏的玩法确定返回值只需要给出前端需要的动态数据。

  这样做有以下几个好处,第一个好处是符合开辟原则,也就是对拓展是开放的,对修改是关闭的。那么这样在游戏需要添加新的功能,或者在后期开发,我们不需要改动原先的接口,而只需要添加新的接口。第二个好处是提高了接口的复用率,前端按功能模块的展示需求,去请求后台相应的接口,从而组装成前端见面,所需要的数据,这样就不必每出一个见面,后端就需要提供一个接口,第三个好处是当没有对实体进行更新操作时那么前端就不需要请求后端只需要访问缓存数据,而且缓存数据与服务器数据也是同步的。

 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

?ARCHITETUAL DESIGN

Record at P261

Choosing the right architecture style can be tricky. Bushman suggests two complementary concepts that can provide some guidance. 

Problem frames(wikipedia linked)  describe characteristics of recurring problems, without being distracted by references to details of domain knowledge or programming solution implementations.

Supplement

The first problem frames identified by Jackson included:

  1. required behavior
  2. commanded behavior
  3. information display
  4. simple workpieces
  5. transformation

The intuitive idea behind this problem frame is:

  • There is some part of the physical world whose behavior is to be controlled so that it satisfies certain conditions. The problem is to build a machine that will impose that control.
ProblemFramesRequiredBehaviorFrame.svg
 
 

Domain-driven design suggests that the software design should reflect the domain and the domain logic of the business problem you want to solve with your application.

 

 

posted @ 2017-05-12 10:57  孝感天地工作室  阅读(639)  评论(0编辑  收藏  举报