课程: Programming Foundations: Design Patterns
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Understanding the Iterator pattern
- [Instructor] As we've seen, we've got two menus with two different implementations. One uses an Array, and the other uses an ArrayList. That means that the class responsible for printing the menus, the cafe, needs to use two different methods of entering through the menu items. So the two menus are exposing the details of how they're implemented to the cafe, which means that the cafe is dependent on those implementations. If someone decides to change the implementation of a menu, or say, add another type of menu, or say, add another type of menu, that will require code changes to the cafe. that will require code changes to the cafe. We can reduce the dependency between the cafe We can reduce the dependency between the cafe and the menu implementations by using the iterator pattern. and the menu implementations by using the iterator pattern. Here's the definition for iterator pattern. Here's the definition for iterator…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
-
(已锁定)
Encapsulating iteration1 分钟 44 秒
-
(已锁定)
Understanding the Iterator pattern2 分钟 28 秒
-
(已锁定)
Using the Iterator pattern3 分钟 36 秒
-
(已锁定)
Using built-in iterators1 分钟 19 秒
-
(已锁定)
The single responsibility principle1 分钟 20 秒
-
(已锁定)
The iterator pattern as language feature1 分钟 30 秒
-
(已锁定)
Challenge: The Iterator pattern57 秒
-
(已锁定)
Solution: The Iterator pattern36 秒
-
(已锁定)
-
-