Code Refactoring 15

Replace Primitive Type with a ClassIn this part of my code refactoring tutorial, we’ll look at how to replace a primitive type with a class.

Type safety is very important! So, what we want to do is to eliminate all operations on values that are not of the appropriate data type by protecting the program from bad input. One way we can do this is by replacing primitive types with classes. I’ll walk you step-by-step through the process. The code below will help you along.

If you like videos like this, it helps to tell Google+ [googleplusone]

Code From the Video

ATMAccessBad.java

ATMAccess.java

7 thoughts on “Code Refactoring 15”

      1. It would be great if you made that specific thing.
        I quite accustomed to your easy to understand lessons in OOP design 🙂

        Thanks, anyway

  1. Hey Derek,

    Why not use Enums instead of creating a class as internally an enum is converted to a class and values in enum to objects?

Leave a Reply

Your email address will not be published. Required fields are marked *