douhuan5073 2010-07-13 21:13
浏览 38
已采纳

oo程序与业务规则的变化

I am maintaining a custom built and highly OO e-commerce application. The original designer made a few assumptions like: - there will never be more than 3 types of sales tax (state, national & hamonized) - each type of sales tax can have only one rate. - each state will be assigned one of the three tax types.

He should have known better, but I guess it seemed reasonable at the time... All of a sudden each state is settings its own "harmonized" tax rate.

Problem: 3 levels down the object stack, I have a tax calculation method that uses only amount and tax type. Now I am faced with the task of a pretty big restructure of a application that I have little understanding or little budget to learn

I am inclined to stuff the state code into a session value and do a bit of hard-coded calculations on the other end. (1 day) instead of a re-structure (1-2 weeks??)

Is it my imagination or do OO applications have a bigger learning curve and can be harder to maintain when the business rules take an unexpected turn?

  • 写回答

1条回答 默认 最新

  • doulan8846 2010-07-13 21:17
    关注

    Is it my imagination or do OO applications have a bigger learning curve...

    Somewhat. I consider the curve to be steeper, but much shorter than an app built in functional code. An OO app is more likely to follow patterns, adhere to some kind of coding standard, and add structure or a framework to an application. While functional code is much more free to do as it pleases so long as the end-result is a working product. This produces an environment ripe for developer(s) to circum to the spaghetti-code mentality.

    ...and can be harder to maintain when the business rules take an unexpected turn?

    Depends. But this could be true regardless of the coding style used. In your case, this would appear true. However, OOP and patterns, historically, have made it easier for experienced programmers to maintain an application vs one written entirely of spaghetti, functional, code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog