Mickey Williamson

Category Archives: Java

Program to an Interface

If you’re in the Object Oriented Programming world any length of time, you’re going to hear the design principle, “Program to an interface, not an implementation.” But what exactly does that mean? First, it can be a bit misleading because the word interface is not used in the sense of the OOP programming structure used […]

Android Fragments and Static Factory Methods

Typically when we create a class, we create one or more constructors for the class: We then use the “new” operator to instantiate the class and pass in an argument: This works in the more common scenarios but isn’t flexible enough in others. What if we needed to: Return an subclass of the class instead […]

Building blueprints

The Builder Design Pattern

Instantiating Objects with Many Properties Let’s build a house!  First, let’s decide what kind of house we want to build: Construction type = timber frame Stories = 2 Roof type = slate Siding = batten-board Basement = true Attic = true Size = 2000 sq ft Bedrooms = 3 Bathrooms = 2 Technology = alarm […]