From the course: Java Object-Oriented Programming
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Challenge: Leverage abstraction to write simpler applications - Java Tutorial
From the course: Java Object-Oriented Programming
Challenge: Leverage abstraction to write simpler applications
(bright music) - [Instructor] In this challenge, you'll practice using abstraction to reduce application complexity and code duplication. Earlier in the chapter, we created an event interface with two method specifications. We had three different classes extend this interface, password change event, missed payment event, and account transfer event. All three of these classes have duplicated code for the get timestamp method. They also have the same attributes, create a timestamp and ID. Can you refractor this code so that the get timestamp functionality and the attributes live in one place? Note, all of the duplicated code has to do with what it means to be an event rather than a specific missed payment or password change event. Given this refactoring, the code in the main class should not change significantly. We should still be able to work with the events as event objects. In this challenge, I encourage…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
What is abstraction?1m 47s
-
(Locked)
Using abstract classes in Java to reduce code complexity5m 59s
-
(Locked)
Using interfaces in Java to provide conformity5m 1s
-
(Locked)
Discovering abstraction in Java source code4m 55s
-
(Locked)
Challenge: Leverage abstraction to write simpler applications1m 19s
-
(Locked)
Solution: Leverage abstraction to write simpler applications2m 58s
-
(Locked)
-