Separating action server logic and business logic

I am interested to know how we can separate the action server logic ( slotset, dispactcher, tracker ) and core business logic. I face the below challenges when try to separate these code blocks.

  1. Need to create an instance of the business logic class in each action class wherever required.
  2. If I just want to use dispatcher in my business class objects, is there a way without deriving from Action class.

Or what is the best practices to be followed here.

hi @siriusraja - I can see what you mean. What are the kinds of things

Regarding your question:

  1. What is wrong with having an instance of the business logic class in each action class?
  2. You could probably solve this by having the methods of the business logic class return events, which is what the action class does. But why exactly are you trying to avoid subclassing the action class?

Hi @amn41

Thank you. Somehow I missed your response.

My idea is to keep action class free from business logic code and vice versa.

There is no one-size-fits-all answer to this question, as the best way to separate the action server logic and core business logic will vary depending on the specific application. Guys from https://transformagency.com/ might help you out with this task. However, some tips that may be helpful include: -Creating a separate action server class that handles all the slots, dispatchers, and tracker logic and then calling into the core business logic as needed. -If you only need to use the dispatcher in your business logic objects, you can create a dispatcher singleton that can be accessed from anywhere in your code. - following best practices for object-oriented design and separation of concerns.

1 Like