Thursday, February 17, 2011

For God's sake people, keep your business logic in one place! - Part II

So what's the big deal about keeping your business logic in one place?

Well, for starters, you're going to save your company a lot of money down the road and save probably yourself or another programmer tons of headache every time a little thing goes wrong.

So what can go wrong? Well, if you've been in the reporting business, or written many programs that actually got used, or built out any infrastructures for businesses to hold and move and display their data (like I've been doing the last 15 years) then you know that there's plenty that can go wrong.

The simplest and possibly the most frustrating is simply the customer saying to himself,

"Hmmm... these numbers don't look right. I was expecting something a little different. I bet something's wrong with the data."
So they write up a trouble ticket or send you an email or IM you with this deep logical distrust of your data.

What do you do?

Well, you can do like most IT people do. Say,
"Nope, the data looks good here. Must be something on your end"
If that don't work, option #2 is,
"That would be something caused by so-and-so process at my source. Sorry I can't do anything. But here's the name of the guy that might be able to help you."
(Options #1 and #2 basically are just "he-did-its" pointing North and South, upstream or downstream, to somebody else in line... an ancient IT tactic going back to the pyramid-building Jewish slaves in Egypt.)

But ultimately, if the customer is hard-headed, and other distracting "emergencies" don't pop up instead, it'll come back around to you and you'll have to investigate whether or not the data is getting screwed up somewhere. And where do you go? Well, you have to go top to bottom, beginning to end or where the data starts to where the data ends. And why? Because business logic is everywhere.

Now, if you are just a reporting geek, then that's not so hard because IT hasn't given you any real access to see all the magic they do. (Remember how the Wizard of Oz preferred to hide behind the curtain?) In that case you use option #2 and give them the company salute--that's where you shrug your shoulders and mumble "mmi-donno."

If you're IT, or a reporting geek with privileges, then you have to chase down the problem. And since you or someone else was stupid or lazy enough to toss the business logic all over like an angry baboon slinging feces on the walls, then you get to hunt and dig and use your genius analytical skills and your vast amount of extra hours to try and figure this thing out.

And if there is no problem, THEN, you get to try and hold the hand of the customer and explain over and over again all the different places the data changes at and prove to him that 2 + 2 is supposed to equal  5 and if you're lucky another crisis will crop up and this customer will go away.

NOW.....

If you had obeyed my simple rule of For God's sake people, keep your business logic in one place! you could pleasantly schedule a half hour meeting with the customer, share your desktop, and go,
"Well let's look and see if we can find your data problem Mr. CussToMe",

pull up the whole data flow and go,
“Well, here 2+2=4, ... and next right here 2+2=4, and downstream further yes, 2 plus 2 still equals 4... now we get to the BUSINESS LOGIC layer... hmmmmm ... ah yes... well what's this? Ole' Bobby here must have changed my code! Because it says here that 2+2-5. Heck, I’m pretty sure that’s not right. I'll fix it right away Mr. CussToMe. Thank you for bringing this to our attention. Wow, if only we had someone with your brains working for our team!"

And your job would be done.

Now isn't that a lot nicer?

Labels: , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home