题目详情

采用以下设计思路实现下图所示的目录浏览器:目录中的每个目录项被认定为一个类,其属性包括名称、类型(目录或文件)、大小、扩展名、国标等。为节省内存空间,要求不能将具有相同属性(例如类型、扩展名、图标相同)的相同文件看作不同的对象。能够满足这一要求的设计模式是( )。

中级软件设计师,模拟考试,2021年软件设计师模拟题5

  • A.Flyweight
  • B.Proxy
  • C.Command
  • D.State

正确答案及解析

正确答案
A
解析

根据目的和用途不同,设计模式可分为创建型(Creadonal)模弍、结构型(Structural)模式和行为型(Behavioral)模式三种。创建型模式主要用于创建对象,结构型模式主要用于处理类或对象的组合,行为型模式主要用于描述类或对象的交互以及职责的分配。根据题干的描述,适用于该要求的设计模式应属于结构型模式。Flyweight(享元)和Proxy(代理)属于结构型模式。Flyweight模式通过运用共享技术,有效地支持大量细粒度的对象。系统只使用少量的对象,而这些对象都很相似,状态变化很小,对象使用次数增多。Proxy模式可为某个对象提供一个代理,并由代理对象控制对原对象的引用。代理模式能够协调调用者和被调用者,能够在一定程度上降低系统的耦合度。因此本题适合于采用Flyweight模式。

包含此试题的试卷

你可能感兴趣的试题

单选题

Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.

  • A.Artificial Intelligence
  • B.Cloud Computing
  • C.Internet of Things
  • D.Big Data
查看答案
单选题

In project human resource management , ( )is not a source of power for the project manager.

  • A.referent power
  • B.expert power
  • C.reward power
  • D.audit power
查看答案
单选题

At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.

  • A.detail feasibility analysis
  • B.opportunity analysis
  • C.economic feasibility analysis
  • D.risk analysis
查看答案
单选题

( )is a grid that shows the project resources assigned to each work package.

  • A.Stakeholder engagement assessment matrix
  • B.Requirements traceability matrix
  • C.Probability and impact matrix
  • D.Responsibility assignment matrix
查看答案
单选题

Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.

  • A.digital
  • B.networking
  • C.intelligentize
  • D.informatization
查看答案

相关题库更多 +