Currently I’m developing two solutions (first for country A, second for country B), which are very similar. I’m using wpf, c#, mvvm, sql server.
Some of modules are identical in every solution, some of them are partially different (ex. some classes have additional fields or methods), and some are completely different (ex. VAT module). For me, developing completely independent solutions is not the best solution (time cost).
So, I was thinking of creating two solutions (A and B) which will contain only main screen where would I prepare user interface. Then, in third solution (C) I would have project (=modules) and link them from A or B.
If module is identical for both version – no problem. If it is completely different – ok, I must develop it independently. But, the question is how to design modules which are slightly different?
Should I use abstract factory design pattern and put in AbstractProduct everything that is identical, and in ConcreteProducts put additional fields/methods? For WPF forms I can’t use this pattern – I must develop a form for every version.
Thx.
what you really want to use is Dependency injection.
First you create an Interface then have your concrete impls implement this interface per country.
Then register these Interface to impl mapping at composition root.
Then you ask the container to give you an instance of ISolution. and it will provide you the correct impl.
You can do the same for CountryB.
You can have auto wiring or late binding, something more dynamic. and you can switch impls.
Take a look at structuremap for examples.