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.

Implement the Façade pattern

Implement the Façade pattern - Java Tutorial

From the course: Java Design Patterns: Structural

Start my 1-month free trial

Implement the Façade pattern

- [Instructor] In this example, I've got an app that's used for booking vacations. And I'm going to be refactoring it to use the facade pattern. So first of all, the app has a class called hotel, which has a single method called book. This method takes a start date and an end date as arguments. And then it prints out a message saying when the booking has been made for. There's also a similar class called car rental, which again has a method called book, which takes an argument of a start date and an end date and prints out when the car booking has been made for. Then there is a class called flight, which has two methods called book outward journey and book return journey. Similarly, these prints out messages saying when the booking has been made. Finally, there is a class called vacation client, which can be used for booking holidays. In the main method, there are two local variables for the start date and the end date of the…

Contents