• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calculate formulas in elegant way?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

This is my first post (i think) and I was wondering if I could have a opinion from you all.

Today, the system I'm working on has a terrible design for business logic. The application is basically a bunch of formula "calculators" for every different client. All of them have their input/outputs and logic on it. The problem is that every single calculator is derived from a big superclass with some common procedures (and eventually subclasses overrided them ).

Well I really want to refactor this crap. I was thinking of the Interpreter pattern which I could take the similiarities of the calculators and mount its complexity based on those simple procedures.

It would look like a tree:



However, I don't want to reinvent the wheel and possibly somebody else has come across this problem. I just need to know if there is a framework, standard, pattern, whatever... to solve this problem.

I appreciate your help in advance!

Valdir.
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Valdir Mendes wrote:Hi guys,

<snip>

I was wondering if I could have a opinion from you all.

Today, the system I'm working on has a terrible design for business logic. .



If it ain't broke ...
 
Valdir Mendes
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It wouldn't be a problem if I had to create more 20 of those

I've seen Drools the business rules engine as an alternative, but I might create more complexity than simplicity. Anybody with Drools experience to share thoughts (or any other business rule engine)?
 
Ranch Hand
Posts: 96
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Strategy and/or template pattern come to mind when I read this.

But I agree that you should make sure about the value you'd get from redesigning this system. If it's a new 'calculator' every day then I'm sure you can get whoever it is that decides to at least consider something more flexible. If it's a new one every year ... (or any other period of time that is considered 'long'

Cheers,
Wim
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic