Download presentation
Presentation is loading. Please wait.
Published byEdwin Edwards Modified over 6 years ago
1
Java Interfaces: Using an Interface to Accomplish a Specific Goal
Kirk Scott
2
Barley From Wikipedia, the free encyclopedia Jump to: navigation, search For other uses, see Barley (disambiguation).
3
Barley (Hordeum vulgare L
Barley (Hordeum vulgare L.), a member of the grass family, is a major cereal grain. Important uses include use as animal fodder, as a source of fermentable material for beer and certain distilled beverages, and as a component of various health foods. It is used in soups and stews, and in barley bread of various cultures. Barley grains are commonly made into malt in a traditional and ancient method of preparation.
7
This is an introductory unit.
These are the units/chapters belonging to this section of the course: Unit 16, Iterator, book chapter 28 Unit 17, Template, book chapter 21 Unit 18, Strategy, book chapter 23
8
What will be given next is an extremely brief overview of these topics.
Although the patterns are different from each other, they can be viewed as having this broad characteristic in common: They make use of an interface to accomplish their goal Iterator and Template both show how to make use of characteristics of the Java API
9
Iterator Book definition:
The intent of the Iterator pattern is to provide a way to access the elements of a collection sequentially Comment mode on: Large parts of this should already be implicitly clear if you understood for each loops You will see that this pattern is used by the Java API in dealing with collection classes
10
Template Book definition:
The intent of the Template pattern is to implement an algorithm in a method, deferring the definition of some steps of the algorithm so that other classes can redefine them. Comment mode on: You will see that the template pattern is used in the Java API to support the ordering and sorting of objects in collection classes
11
Strategy Book definition:
The intent of Strategy is to encapsulate alternative approaches, or strategies, in separate classes that each implement a common operation. Comment mode on: This pattern is actually quite simple You can have multiple classes implementing the same interface—and thus the same method The implementations of the methods may differ in the classes
12
In Summary and Mnemonic Devices:
Iterator: Remember Java collections Template: Remember Java sorting Strategy: Remember multiple classes implementing the same interface
13
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.