如何为不同的模块开发不同的过程逻辑 [英] How do I develop different process logic for different modules

查看:64
本文介绍了如何为不同的模块开发不同的过程逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





假设,我的要求是建立一个基于部门的工资计算模块,我该怎么办呢?



例如,如果我的部门是Sales,那么我的工资计算必须经过一个特定的过程,即输入字段,值,工资成分计算等。

如果假设它是市场营销,则必须遵循不同的计算程序。如何根据所选部门管理不同模块的不同计算逻辑?



我已经有开发3层应用程序的经验,那么我在业务层或其他东西中嵌入了什么?请帮忙。

Hi,

Suppose, my requirement is to build a salary calculation module, based out of department, how do I go about it?

For example, if my department is Sales, then my salary calculation has to go through a specific process viz., input fields, values, salary component calculation etc,.
If suppose it's Marketing, then a different calculation procedure has to be followed. How do I manage different calculation logic for different modules, based on the selected department?

I have experience in developing 3-tier applications already, so is there anything which I embed in the business layer or something? Please help.

推荐答案

我认为你需要通过为部门创建一个新的界面来抽象出具体类的计算逻辑。



您需要使用CalculateSalary方法创建IDepartment界面。需要在每个部门的具体实现中覆盖此接口,例如ex。 Sales和Marketing类具有自己的计算逻辑。



所以在运行时你不需要写if .. else但只需要调用高级抽象方法。



希望这会有所帮助:)
I think you need to abstract out calculation logic to concrete classes by creating a new interface for department.

You need to create an "IDepartment" interface with "CalculateSalary" method. This interface need to be overridden in concrete implementation for each department like for ex. "Sales" and "Marketing" classes with its own calculation logic.

So at run time you don't need to write "if.. else" but just need to call high level abstract method.

Hope this helps :)


这篇关于如何为不同的模块开发不同的过程逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆