Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I've never encountered a well written business layer. Any advice?

I look around and see some great snippets of code for defining rules, validation, business objects (entities) and the like, but I have to admit to having never seen a great and well-written business layer in its entirety.

I'm left knowing what I don't like, but not knowing what a great one is.

Can anyone point out some good OO business layers (or great business objects) or let me know how they judge a business layer and what makes one great?

Thanks

like image 401
Scott McKenzie Avatar asked Oct 14 '08 03:10

Scott McKenzie


1 Answers

I’ve never encountered a well written business layer.

Here is Alex Papadimoulis's take on this:

[...] If you think about it, virtually every line of code in a software application is business logic:

  • The Customers database table, with its CustomerNumber (CHAR-13), ApprovedDate (DATETIME), and SalesRepName (VARCHAR-35) columns: business logic. If it wasn’t, it’d just be Table032 with Column01, Column02, and Column03.
  • The subroutine that extends a ten-percent discount to first time customers: definitely business logic. And hopefully, not soft-coded.
  • And the code that highlights past-due invoices in red: that’s business logic, too. Internet Explorer certainly doesn’t look for the strings “unpaid” and “30+ days” and go, hey, that sure would look good with a #990000 background!

So how then is possible to encapsulate all of this business logic in a single layer of code? With terrible architecture and bad code of course!

[...] By implying that a system’s architecture should include a layer dedicated to business logic, many developers employ all sorts of horribly clever techniques to achieve that goal. And it always ends up in a disaster.

like image 57
Alex B Avatar answered Nov 12 '22 07:11

Alex B