今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
The Decorator pattern
- [Instructor] A decorator is a design pattern that allows us to dynamically attach additional properties and methods to existing objects. For example, let's say you wanted to build a camper van. You could start from scratch and design a brand new camper van, and then build it so that you could live in it. Or you could simply start with a plain old work van and add the features that you need to the already existing vehicle. With this approach you don't have to worry about building an engine, axles, or van body. You already have all that. All you need to worry about is modifying the van so that it has a bed, a sink, and a stove. Sometimes in our applications we already have the base objects that we need. We can decorate these objects with additional methods and properties to create many custom variations of the same object. The Gang of Four defines the intent of the decorator pattern to attach additional responsibilities to…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
(已锁定)
The Adapter pattern2 分钟 20 秒
-
(已锁定)
Implementing an adapter6 分钟 24 秒
-
(已锁定)
The Proxy pattern2 分钟 11 秒
-
(已锁定)
Implementing a proxy5 分钟 48 秒
-
(已锁定)
The Composite pattern3 分钟 12 秒
-
(已锁定)
Implementing composites5 分钟 59 秒
-
(已锁定)
The Decorator pattern4 分钟 3 秒
-
(已锁定)
Implementing decorators4 分钟 24 秒
-
(已锁定)
-
-