In this lesson we will introduce a framework
to architecture applications using modules. We will use the eBiddings
application to illustrate the framework
And this framework organizes the modules into
3 different layers. The bottom layer
is the Library modules layer. This layer contains modules
with functionality that is highly reusable
and business agnostic. An example of this is
the Google Static Map module that got from the Forge
and that we used in the previous lesson. Moving on to the middle layer
this the Core Business modules layer
and this layer contains functionality
that is business-related and is reused
by other modules. In our example both
the Supplier module and the Product module
are Core Business models. Finally
the top layer the End-user modules. This layer contains modules
with functionality for the end-user interaction
and that is not reused by other modules
An example of this is the eBidding module
in oour eBidding application. And we've seen in the previous lessons that
the eBidding module needs to reference the Suppliers
and the Product module, and also
the Google Static Map module. Now whenever you need to implement new
functionality
in your application or you are designing your application at the
beginning
you should ask yourself the following questions to determine
where you're going to put this functionality. The first question
"Is this functionality reusable or not?"
You already know from the descriptions of these layers that
reusable functionality should be placed
in one of these two bottom layers
the second question you should ask yourself
is: "Is this functionality business-related,
is it around the business concept or is this functionality generic?"
So if it is generic then it should be placed in the Library modules
If it is business related should be placed in the Core
Business modules layer. Finally if this functionality is not to be reused
Then it should be placed in the End-user modules
To make this a little bit more clear let's see
a few examples of how to put this framework into practice
First example I want to register significant events for Suppliers
you probably recall this from a previous lesson, but let's use our framework to
see where we're going to put this functionality
is this a reusable functionality or not?
We didn't use this in the eBiddings application
to register that the supplier placed the bid for a product request
but we can use this functionality for any other application
that needs to register events for Suppliers. For instance if we have a
Contract Management application
we might want to register that the new contract was signed
so this is reusable functionality. Is it business related
or is it business specific. The second question is
is this functionality business-related or is a generic?
We want to register events for
Suppliers and Suppliers here
this is a business concept, so this is business-related
and as such, it should be placed in this middle layer
the core business modules. Now we need to see
if we already have a module to place this functionality
And in these cases we actually have a module
already in our application to handle
the business concept of Suppliers so this module
is where we're going to put the functionality and actually you remember
from a previous lesson that we added here to the Supplier module
the SupplierActivity
Entity, and the action
to register these events. so this
example here is a functionality that we're going to add to the core business modules
to an existing module. Let's see the second example
I want to be able to create the Purchase Order when
requests are closed. So when I close a request in the eBidding application
I want to create with that action I want to create also
a Purchase Order for the winning Supplier
of that product request. So let's use the framework again
Is this reusable functionality. Well
I want to create a Purchase Order in the eBidding application but I may have
other applications that have the same need to create
a Purchase Order, just on a different event
other than the request to be closed. So this is
a functionality that I'm a want to reuse
in my applications so this is reusable
It should be placed in one of these two bottom layers. Second question
is this business-related or is this generic
This case I want to create a Purchase Orders
So the Purchase Order, again is a business concept
so I want to place this functionality
again in this middle layer in the Core Business Modules layer
Now, do I have a module
in my application, do I have a module already to handle
Purchase Orders. I don't, I have a module for Suppliers
and for Products they don't handle Purchase Orders, so
I need to add a new module in my
architecture that will handle Purchase Orders and that
we'll have an action to create a Purchase Order
That I'm going to reuse in the eBidding application
So again this a functionality
that we're adding to the Core Business Modules layer
Let's see the final example. I want to be able to manage these Purchase Orders
and to manage the Purchase Order, I mean that I want to handle
all the end-user interaction that involves
different people with different roles to manage these purchase orders
So again coming back to our framework. Is this usable functionality?
Well I don't want my end users to go to different applications
in order to manage these Purchase Orders. So
this is something that is not reusable. It should be handled by a specific
application
an as such it's not functionality that they're going to add to the eBidding application
but
it will still need to be placed in the End-user Modules layer
so I'm going to add a new application
to this layer, the Order Manager, where I'm going to have
an Order Manager module, and probably other modules as well
to handle the manage purchase order
functionality. So the see something that will go into the End-user modules
and just to complete here the example the OrderManager
module will need to reference the Orders module as well
And that's it