课程: Node.js: Design Patterns

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

The Adapter pattern

The Adapter pattern

- [Instructor] We're going to take a look at the adapter by looking at a real world analogy, a skateboard. A skateboard is a wooden board with wheels. There's a grippy surface that you stand on, but you're not attached to it. If you're good at skateboarding, you might know how to do an ollie or a kick-flip. These are tricks where you jump in the air with your board and hope to land on it. Let's say you wanted to transfer your skateboarding skills to a different surface, other than concrete. Let's say you wanted to skateboard on snow. You're probably thinking you'll need a snowboard. But are they really the same? You can't kick-flip a snowboard, because you're always attached to it. There's no grippy surface that you stand on. Recently a new snow sport has popped up called snow skating. A snow skateboard is a wooden board with a grippy surface that you stand on, but instead of wheels, its trucks are mounted on skis. If you…

内容