I'm running into a problem understanding the semantics of Java's interfaces. I am modeling a problem with interfaces before I fill them in with code. I do this by seeking out the nouns in the problem and creating an interface for them, for example:
Every house has at least one person in it. Each house may also contain exactly one bicycle and may contain at least one car.
So, I would create the interfaces IHouse, IPerson, and IVehicle (since we may have different types of houses, peoples, and vehicles in the future).
The problem comes when I get into the adjectives of these nouns, for example:
Each house, bicycle, and car may have a certain color.
Instead of creating the following methods in each vehicle and house class, I create the following interface:
public interface IPainted {
public Paint getPaint();
public void setPaint();
}
and apply it to the vehicle and house interfaces:
public interface IVehicle extends IPainted {
}
Is this the best way of representing adjectives?