I know the strategy pattern is a behavioral pattern that encapsulate an algorithm in a class. Also that the builder pattern is to separate the construction of a complex object.
Now, I have to create different views of map (seller view, customer view) (each map has: houses, buildings, streets) depending on a type that in be selected in the UI by the user. I want to do this as extensible as possible as maybe some other views will be added to the program. In this case, should I create a strategy which encapsulates the algorithm to create the different views? or should apply the builder pattern? or should I create a strategy with a builder inside?.
public class Map
{
private List<House> Houses { get; set; }
private List<Building> Buildings { get; set; }
private List<Street> Streets { get; set; }
}
In the UI:
- Select with: Seller view, Customer view.
- Map: shows the map with all his things and depending on the select, depends the view that is shown.
Seller view: houses and building in green are for sale, and in red are sold.
Customer view: house in blue is the selected to buy and only appears houses in sale.
Thanks and wish you understand my problem!