1 / 13

Java Interfaces: Using an Interface to Accomplish a Specific Goal

Java Interfaces: Using an Interface to Accomplish a Specific Goal. Kirk Scott. Barley. From Wikipedia, the free encyclopedia Jump to: navigation , search For other uses, see Barley (disambiguation) .

preston
Download Presentation

Java Interfaces: Using an Interface to Accomplish a Specific Goal

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Interfaces: Using an Interface to Accomplish a Specific Goal Kirk Scott

  2. Barley • From Wikipedia, the free encyclopediaJump to: navigation, searchFor other uses, see Barley (disambiguation).

  3. Barley (Hordeumvulgare 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.

  4. 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

  5. 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

  6. 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

  7. 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

  8. 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

  9. In Summary and Mnemonic Devices: • Iterator: Remember Java collections • Template: Remember Java sorting • Strategy: Remember multiple classes implementing the same interface

  10. The End

More Related