R – Separation of Presentation layer from Business layer

Architecture

From an article i just read,

UI Layer Abstraction

Well are there any setbacks to a full separation between the presentation layer and the business layer?

This question actually came from a problem of tracing the progress of a process (certain series of instructions) and updating a progress bar accordingly for example.

Now the only one who knows the actual progress is the process itself, and that is in the business layer. So if both layers are pretty separate, how can I reach the progress bar from within the business layer without stepping on the presentation layer's domain? Or at least return progress values to the presentation layer?

Best Answer

IMHO the dialog about seperating layers misses one key fact: While layers need to be seperated for many reasons, that doesn't mean they can't do things to make things eaiser for the other layers.

We had a similar requirement - a progress bar for a long-running business process. What we did was define progress-events in the business layer code. These events would be called at vairous times - percentages complete, for example - and 'someone' subscribed to them. In our case, it was the UI layer!

So the layers are seperated, but 'business' has to understand that someone might want to watch it!

Related Topic