Learn about Java implementation of decorator patterns.
- [Instructor] The Gang of Four authors say…that the decorator patterns attach…additional responsibilities to an object dynamically.…Decorators provide a flexible alternative to sub-classing…for extending functionality.…Let's begin by creating an interface…and we'll call it a Car Interface.…It defines two methods, getDriverType…and getFavoriteSaying.…Every class that implements the Car Interface…must implement these two methods.…OrdinaryCar implements the Car Interface.…
Note that it defines those two methods,…getDriverType and getFavoriteSaying.…If I comment out these methods,…we'll get an error message, in particular,…"'OrdinaryCar' must either be declared abstract…"or implement abstract methods 'getFavoriteSaying'…"in the Car Interface."…Let's uncomment these.…Note that we're marking this class as final.…This means that other classes can't extend OrdinaryCar.…
For example, let's try to extend OrdinaryCar.…If I uncomment this class, you'll see we get…an error message "Cannot inherit from final…"'com.yourname.decorator.OrdinaryCar'."…
- 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.