views:

53

answers:

1

I'm curious about how everyone handles code duplication across multiple platforms/tiers.

As an example, in our application we have a screen that displays claims. A claim is deemed to be outstanding if it satisfies certain critera and users want to see which claims are outstanding in their lists, so there is one piece of code in the application that does this.

We then also have reports that are entirely separate from the application, and users want reports of all their outstanding claims. As there is no way to create a claim entity and see if it is outstanding from the report it seems that we necessarily have to have some duplication of code.

You could have a function or something in the database that provides this information and your single piece of code, but you're then solely relying on the db for business logic and you'd have to do a round trip to the db for each claim you want to check in the app, not exactly ideal!

So, how does everyone handle situations like this and are there any best practices I should be aware of?

A: 

Specifically in your case if your business logic is contained in a business domain tier. You could then create two Applications that consume that business domain independently of each other.

See 100,000 foot view.

          DataProviders
               |
          BusinessDomain
          |           |
    Application   Reporting Services
Matthew Vines