I have been maintaining legacy apps for as long as I can remember. Most of these apps are two tiered apps.

There is no standardization and some developers have prefered to put the business logic in the database, while others prefered to put that in the front-end code. My personal preference has been putting the business logic in the database. This is mostly because our database is used by more than one system, so this helps me avoid duplication of effort.

In the multi-tiered world, I realize there are several places where your business logic could reside. Most people prefer to have it in the "Middleware", which is essentially a series of assemblies or java classes that act as an intermediary between the database and the client app. Several front-end clients connect to the middle tier which acts like a traffic cop deciding, which requests will reach the database and which have to be rejected. I suppose, this reduces the load on the amount of traffic hitting the database.

If you had to move your client app to a new technology, but keep the same database, would you choose to

a) create a middleware component?
b) keep the logic in the database and build your client.


What is your preference for a two tiered application and a three tiered application? Why? Does your preference depend on the application? If so, why?