A very typcial and often annoying part of
enterprise applications is what is
euphemistically called "business logic". As
Martin Fowler says in his book
Patterns of Enterprise Application Architecture:
I find this a curious term because there are few things that are less logical than business logic. ... business rules are just given to you, and without major political effort there's nothing you can do to change them. You have to deal with a haphazard array of strange conditions that often interact with each other in surprising ways.
This is a bit exaggerated, but all to often true. Such parts of "busines illogic" usually are full of (
Jargon File)
warts and strange exceptions, and you
cannot clean it up as you would a
software design because it has become part of money-making
business processes.
An example Fowler mentions is that a salesman migh negotiate to have a yearly payment delayed a few days from its normal date because it fits the customer's accounting cycle better and this helped seal a multi-million dollar deal.
An example I have experienced personally, is that a customer at a certain bank can have two accounts with exactly the same account number. The reason: marketing decided that customers would like to have a combined checking and credit account, and the mainframe people decided to implement it by actually having two accounts that share certain balances and are displayed almost identically.
As any programmer can imagine, this means a big headache when you're working in a application framework which assumes that an account is uniquely identified by the account number...
Usually, business logic should be hidden from the user as much as possible, and (as you can imagine from the descriptions above) changes relatively frequently. Thus, it has become a standard wisdom of application development to separate business logic from both the presentation (client) logic and the data storage logic, although it has effects on both. In three-tier applications, the middle tier is where the business logic sits. For example, in the J2EE framework, EJBs are specifically meant to be used for business logic.