From the course: Java Design Patterns: Structural

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: The Bridge pattern

Challenge: The Bridge pattern - Java Tutorial

From the course: Java Design Patterns: Structural

Start my 1-month free trial

Challenge: The Bridge pattern

(upbeat music) - [Narrator] Let's look at our next challenge. This one is going to be to refactor an app for drawing different types of buttons on a canvas. You don't need any knowledge of user interfaces to do this challenge. To keep the app really simple, it doesn't actually draw anything, it just prints out to the console that it's drawing a shape. For example, if I run the app, it prints out a message to the console saying the size of the button it's going to draw, and then the type of the button. This app has a similar hierarchical structure to the shapes app that I demonstrated in the previous videos. There is an abstract class called button, and underneath that, there are three more abstract classes called checkbox button, dropdown button, and radiobox button. Under this level are the concrete classes. Each type of button has a small, medium, and large version. So there are two hierarchies being mixed here,…

Contents