BlueCell wrote:
I seem to be drowning in definitions. Could you perhaps clear some things up for me?
- Is a 'Manager' the same as a 'Façade'?
- Is a 'Manager' the same as a 'Mediator'?
- If both statements are not true, then what is a 'Manager'?
I hope someone can answer this, as I find this really frustrating.
Just my 2 cents.....
Welcome to the world of OOP....It took me a while and some books to fully understand this.
According to the Manager Pattern [Sommerland], it acts as a Factory [GoF] for its subjects, it's created as a singleton[GoF] and behaves as a Client-Dispatcher-Server [Buschmann].
All this means is that you have a manager creating instances for your business objects. For example, if you have an order entry system, your "manager" class would probably look like this:
public class InvoiceManager
{
public MyInvoiceEntity getInvoice(int invoiceNumber)
{
MyInvoiceEntity invoice = new InvoiceEntity(invoiceNumber);
.....
prefetchPath.Add(InvoiceEntity.PrefetchInvoiceItems).SubPath.Add(InvoiceItem.PrefetchItem)
......
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.fetchentity(invoice);
}
.....
}
so you get in your UI layer an instance of the invoice with all its related objects (line items, items, etc). You work on them and pass it back to the manager in order to save it....This will let you work on object instances without having to know about the DB connection....The manager instance can take care of other business rules like updating inventory status and generating inventory stock transactions.
I personally think that there are sometimes where you need to combine a domain model with the manager approach....specially with complex object models.
Hope it helps
Alfredo