Facade controller, is it efficient?

669 views Asked by At

Using a facade controller pattern in .net. It seems as if though it is not efficient BECAUSE, for every event that happens in a domain object(Sales, Register, Schedule, Car) it has to be subscribed to by the controller(use case controller) and then the controller in turn has to duplicate that same event to make it available for the presentation, so that the presentation can show it to the user. Does this make sense? Please comment!

1

There are 1 answers

0
djna On BEST ANSWER

In general there may well be a trade-off between maintainbility and performance. Having code structured with well-defined responisbilities, decoupling the Domain objects from Presentation will probably increase the number of function calls to get a job done.

The art of engineering is to manage these trade-offs. In this particular case our collective wisdom tends to be that the actual extra costs are relatively small and the benefits of maintability are so high that we are content to pay such costs.

Some general principles:

1). Make it work, then make it work quickly.

2). Set clear goals. The objective should not be "make it as fast as possible" but "make it this fast".

3). Do early performance "sniff" tests. Get an early measure of performance and then as you make changes spot deviations early.