设计模式之Application Programs and Toolkits
Application Programs 应用程序
If you're building an application programsuch as a document editor or spreadsheet, then internal reuse, maintainability, andextension are high priorities. Internal reuse ensures that you don't design andimplement any more than you have to. Design patterns that reduce dependencies canincrease internal reuse. Looser coupling boosts the likelihood that one class ofobject can cooperate with several others.For example, when you eliminatedependencies on specific operations by isolatingand encapsulating each operation, you makeit easier to reuse an operation in different contexts. The same thing canhappen when you remove algorithmic and
representational dependencies too.
如果你建立了一个应用程序比如说文本编辑或电子数据表,然后内部重用,可维护性和 扩展是高优先级。内部重用保证你不需要再一次设计和实现已经有的内容,设计模式就是减少依赖来增加内部重用。松耦合性提高增强了几个人合作来做一类对象的可能性。例如,当你通过使用孤立或者封装的运算,淘汰了使用依赖性很强的运算,在不同的文件中就可以很容易的重用运算,当你移除算法和有代表性的依存关系的时候,你都可以做和上面类似的事情。
Design patterns also make an application more maintainable when they're used to limit platform dependencies and to layer a system. They enhance extensibility by showing you how to extend class hierarchies and how to exploit object composition. Reduced coupling also enhances extensibility. Extending a class in isolation is easier if the class doesn't depend on lots of other classes.
当你用有限制的平台并且分层放置一个系统,设计模式就会使应用的可维护性增强。扩展类的继承和利用类的组合会提高其扩展性。减少链接也会提高类的可扩展性。
如果一个类不依靠大量其他的类,扩展一个孤立的类是很容易的。
Toolkits 工具包
Often an application will incorporateclasses from one or more libraries ofpredefined classes called toolkits. Atoolkit is a set of related and reusable classes designed to provide useful,general-purpose functionality. An example of a toolkit is a set of collection classesfor lists, associative tables, stacks,and the like. The C++ I/O stream library isanother example. Toolkits don't impose a particular design on your application;they just provide functionality that can help your application do its job. Theylet you as an implementer avoid recoding
common functionality. Toolkits emphasize code reuse. They are the object-oriented equivalent of subroutine libraries.
经常性的,应用会调用工具包中一个或更多库中预定义的类。工具包是和重用、通用功能的相关并且重用类设计会提供这些重用、通用功能。举个简单的例子工具包是一套包含链表类、关联表和栈等等像这样的类的集合。C++ I/O流库是工具包的另一个例子。在应用中,工具包不能强加特别的设计;它们只是提供了帮助你应用工作的功能。它们只是帮助你避免重新编写普遍的实现。工具包强调的是代码的重用,它们是面向对象的子程序库。
Toolkit design is arguably harder than application design, because toolkits have to work in many applications to be useful.Moreover, the toolkit writer isn't in a position to know what those applications will be or their special needs. That makes it all the more important toavoid assumptions and dependencies that can limit the toolkit's flexibility and consequently its applicability andeffectiveness.
工具设计可以认为难于应用设计,因为在应用中工具包会起效。更多的是,工具不是在应用需要或特殊的位置编写。这些使避免承担和依赖变得很重要,可以限制工具包的灵活性,应用性和有效性。
设计模式之Application Programs and Toolkits的更多相关文章
- writing concurrent programs
Computer Systems A Programmer's Perspective Second Edition To this point in our study of computer sy ...
- Linking code for an enhanced application binary interface (ABI) with decode time instruction optimization
A code sequence made up multiple instructions and specifying an offset from a base address is identi ...
- Application binary interface and method of interfacing binary application program to digital computer
An application binary interface includes linkage structures for interfacing a binary application pro ...
- C++开源库集合
| Main | Site Index | Download | mimetic A free/GPL C++ MIME Library mimetic is a free/GPL Email lib ...
- Computer Networking: A Top Down Approach
目录 Chapter 1: Computer Networks and the Internet 1. What is the Internet? 2. The Network Edge 3. The ...
- Computer Neworking: A Top-Down Approach
目录 Chapter 1: Computer Networks and the Internet 1. What is the Internet? 2. The Network Edge 3. The ...
- 极客时间-左耳听风-程序员攻略-异步I/O模型和Lock-Free编程
异步 I/O 模型 异步 I/O 模型其中的设计模式或是解决方法可以借鉴到分布式架构上来. 史蒂文斯(Stevens)在<UNIX 网络编程>一书 6.2 I/O Models 中介绍了五 ...
- Introduction to Sound Programming with ALSA
ALSA stands for the Advanced Linux Sound Architecture. It consists of a set of kernel drivers, an ap ...
- software engineer's resume(帮助你写程序员简历)
关键词 参考 简历模板 参考 下面开始是正文(关键词原文) 介绍 本项目由海外兔 (https://osjobs.net) 维护,海外兔团队由一线互联网面试官组成,提供海内外公司一对一入职套餐以及算法 ...
随机推荐
- Swift之高德地图自定义标注弹出气泡样式
在用到地图类的sdk,sdk自带的样式必定不能满足开发者的需求,于是开发者不得不进行自定义,由于官方同样是object-c 版语法,不得不将其转为swift语法,以满足项目需求. 新建两个类 Cust ...
- 在VM中安装Android4.4连接小米手环 之 在VM中安装Android4.4
今天刚买了个小米手环,系统须要4.4及以上,但自己手机系统版本号不匹配.故打算在VM中安装Android4.4连接小米手环. 这一节先介绍在VM中安装Android4.4(怎么安装VM就不介绍了) 1 ...
- 如何解决svn图标不显示呢?
svn图标不显示解决 确保设置正确: 右键->TortoiseSVN->setting->Icon Overlays->Status cache->default/She ...
- oracle之时间转换
:取得当前日期是本月的第几周 SQL> select to_char(sysdate,'YYYYMMDD W HH24:MI:SS') from dual; TO_CHAR(SYSDATE,'Y ...
- mybatis的详解
最新不知道脑子怎么想的,突然对mybatis特别感兴趣,之前在学校的时候学过两天,有了一个简单的认识,工作以后,项目中也有用到,趁着兴趣还在,抓紧整理一个文档,方便学习mybatis,同时,自己也在巩 ...
- vs开发常用快捷键
Ctrl+K+D:快速对齐代码///按D的时候K快速弹起 如果出现语法错误则无法对齐Ctrl+Z:撤销Ctrl+S:保存Ctrl+J:快速弹出智能提示Shift+End.Shift+Home//快速选 ...
- Senparc.Weixin.MP SDK 微信公众平台开发教程 索引
Senparc.Weixin.MP SDK从一开始就坚持开源的状态,这个过程中得到了许多朋友的认可和支持. 目前SDK已经达到比较稳定的版本,这个过程中我觉得有必要整理一些思路和经验,和大家一起分享. ...
- javascript 冒泡和事件源 形成的事件委托
冒泡:即使通过子级元素的事件来触发父级的事件,通过阻止冒泡可以防止冒泡发生. 事件源:首先这个东西是有兼容行问题的,当然解决也很简单. 两者结合使用,形成的事件委托有两个优势: 1.减少性能消耗: 2 ...
- SpringMVC学习简单HelloWorld实例
首先还是从一个简单的Hello World项目说起: 我机器的开发环境为: Ubuntu12.04(不同操作系统对本系列项目没有影响): 开发工具:Eclipse For JavaEE: 数据库:My ...
- C#Log4net日志记录组件的使用
一.Log4Net介绍 Log4net是基于.NET开发的一款非常著名的记录日志开源组件.它通过一套XML配置的日志引擎,将日志分不同的等级,分别是:FATAL . ERROR. WARN. INFO ...