Please see this design. I have created two Core Modules that have entities only. One Module is Student and other one is Fee. Fee has dependency on student just to reference student entity.
I have Student_BL which is kind of application layer to expose functionality to Student Management UI App. It references Student core module only.
Then I have Fees_BL that referencec both Student and Fee core modules and serve as a kind of application layer to orchestrate fees related transactions.
I am not sure if I am able to explain my concept. But I have jumped in for discussion and get suggestions on this design
If you duplicate the information, it gets more confusing that it should be.
Fees_BL references Fee Core Module and Student Core Module.
Student_BL references only Student Core Module.
That's it.
Thanks for your response Nuno. However I am not able to understand where I am duplicating information. Do you mean just by adding dependency on Student_CS(producer).Student and class entity in Fee_CS(consumer) it creates duplicate table in consumer module instead of referencing it.
Regards,
Ajay
On your diagram you duplicated the entities.
Just because they are referenced in both BL, it doesn't mean you have to draw them twice.
A single rectangle for each module helps you to read if the structure is easy to understand or if it is becoming spaghetti.
Thanks Once Again Nuno,
I am new to Outsystems. Let me repeat it again for my learning. If I want to reference an entity from another core module then I will add dependency of that entity. I want to reference the entity to make sure I maintain referential integrity between two entities Student and Fees. I believe this is a basic pattern of doing it in outsystems.
Application Layer/Business Layer or Orchestration Layer pattern
We can create core modules by using functional decomposition pattern. For example Student_CS, Fees_CS and Exam_CS. At top of that we can create a business layer or orchestrator layer. We also call it application layer . This layer can expose use cases that span one or more than one core module.
When we need to reference entity of one core module then we will add dependency in the consumer module which we did for Student entity from Student_CS in Fees_CS.
However my diagramatic representation was not good .
Hi,
before creating core modules i always ask "Is this something which could exist on its own, or can it only exist as part of another business object (compund object)".
In your case the Student is definitly something which can exist on its own. The Student can exist without having any fees associates. The same is true for classes. Classes can exist without having any students and a student might not have an associated class at a given time.
Given that two you would the create
* One Core Module for Student
* One Core Module for Class
On top of it you create one Business Logic module eg. SchoolManagement_BL. The BL module exposes actions to manage students and classes and to assign students to classes. The entity which holds the combination between Student and Class is then in the BL module.
A single fee entry can only exist in combination with a Student. This is what i call a compound object. My way is, that i do not create separate core modules for compound data. I add that object (entity) directly to the core module of its parent entity. In that case and because this aggregate gets now more complex i create a separate BL module just for managing the aggregate. In your case that could look like the following.
Please note that in my StudentManagement_BL iam also exposing Data Retrieval actions. This is merely to keep references from consumer to a minimum. Actions from the StudentManagement_BL need also to be added to the SchoolManagement_BL so that a consumer from the SchoolManagement_BL just needs to reference that. Here you just create wrappers for the actions.
As it comes to architecture and "How do i..." there a multiple opinions. If you ask 3 people you may get 4 answers :-)
Best
Stefan
Thanks Stefan for your response. As per my understanding you are adding two entities Student and Fees in same Student core module. Now If I want to add another function/ entity called Exam then as per your pattern we will add it in Student core module since exam entity cannot exist on its own. However my driver for choosing Fees and exam as separate core modules is basically they can have different life cycle from student. I can publish them separately.
I also want to make sure that we maintain referential integrity between student and Fees, exam entity. So I think in outsystem we can add student as dependency in Fees and Exam module. PLease see this diagram.
Well yes and no. A specific exam can exist on its own. (at least that is true for most schools) :-) a
You are now referencing from Fee CS and Exam CS directly the StudentId from the Student_CS module. I personally dont like that side references but that is a personal flavor. I would rather aggregate the Exam and Student on the BL level. So, having an entity StudentExam in the Exam_BL module thus leaving the Exam_CS without referencing a StudentId. (in the BL the entity would also have the Grade attribute).
I have one doubt. If we aggregate Exam and Student on the BL Level how do we ensure referential integrity betwen Student and Fee entity.
Constraints for foreign keys are on the database level. So, when you have an entity in the BL module, referencing two foreign keys with a delete constraint set to protect, the database will fire an exception if you try to delete a record from the referenced entities.