Learn about Java implementation of visitor patterns.
- In this video, we'll implement the Visitor Pattern.…As described in this article from DZone.…First, we'll copy some classes and interfaces…from the article.…The first is the Visitable interface.…This indicates something that can be visited,…such as a book.…Next, the Visitor interface.…And this is an object, that will do the visiting.…In other words, it will visit a Visitable.…The Book class, implements the Visitable interface.…
Visitable has one method,…and Book implements the accept method.…We'll implement the PostageVisitor class,…and it implements Visitor.…Finally, we'll test all of these.…In the before method, we'll populate the VisitableList.…We'll create items.…We're instantiating the type…private ArrayList Visitable items.…We'll create a new Book, and add it to the list.…
A second new Book, and add it to the list…We'll create a test, testPostageCalculation.…We'll calculate an anticipatedResult.…Then we'll actually calculate the Postage using this method.…And finally, we'll assert that they're equal.…We'll run the test.…
- The IMQAV model
- Downloading software
- Installing and setting up a Java coding environment
- Mock tests
- Code coverage
- Using windows, views, and modes in IntelliJ IDEA
- Creating classes and attributes
- Creating constructors
- Casting variables
- Matching literals with regular expressions
- Regular expressions
- Design patterns
Skill Level Intermediate
Java: Database Integration with JDBCwith David Gassner2h 51m Intermediate
NumPy Data Science Essential Trainingwith Charles Kelly3h 54m Intermediate
1. Getting Started with Java
2. Test-Driven Development
3. IntelliJ IDEA
4. Object-Oriented Java
6. Regular Expressions (Regex)
8. Design Patterns
9. Applying Data Science
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.