Separation Anxiety
secretGeek .:dot Nuts about dot Net:.
home .: about .: sign up .: sitemap .: secretGeek RSS

Separation Anxiety

(Okay this won't necessarily make any sense.

I've been thinking about three different but similar concepts.

They're all based on this template:

Separate your $x from your $y: how why and why not?

where $x and $y could be:

  • content and presentation
  • database and business rules
  • code and data

Let's start at the end: code and data. How are they separated?

First consider those three famous security holes: "buffer overflow, sql injection and cross site scripting (i.e. xss.) They're all caused by exploiting the blurry line between data and code.

So it's easy to jump to the conclusion that a blurry line between data and code is dangerous... we're only safe if we keep our data and our code separate.

But this is powerful magic: mingling code with data is powerful stuff! yes, it must be handled with care, but it must be handled.

Lisp is generally said to blur the line between data and code, because you can't interchange one into the other so easily. <rolls eyes... he's mentioning lisp again... here we go> chill winston! it will be okay!. But I don't see where this makes lisp so special. The whole von neumann processor architecture, is based on reading instructions and data from the same place.

Oh, here's a quote from Paul Snively that says it well:

So this incessant harping on data-as-code and code-as-data in Lisp merely obscures the fact that data is code and code is data in computing. That's the lesson of Lisp, but unfortunately it's gotten lost in the Lisp dogma.

This reminds me of something I heard at uni, and haven't thought about until now: There were apparently some early processor architectures in which data and instructions were kept in separate memory units. The 'instruction pointer' would be up to one place in the instruction memory, and the 'data pointer' would be up to a different place in the data memory. (Ah! It's called the Harvard Architecture, tanks agen, wikipedia)

This model died, and von neumann architecture won out. So, tody we have "instructions and data" in the same place, interchangeable and ultimately it's anybody's guess what makes for data and what makes for code.

You might say that code is 'whatever gets executed.' But, if code isn't yet executed it's still code, not just data. And just because code has been executed doesn't mean it stops being data. So I don't think there's a distinction between them at low levels. At higher levels, there can appear to be a distinction, but at the highest levels, the distinctions dissappear again, lisp etc. Anyway, I'm lost in this paragraph: i'll move on to the next biot: the separation of business rules from everything else.

Keep your business rules in your business rules layer.

This is pretty much accepted dogma in the n-tier custom software world where I live. But it's impossible to enforce absolutely.

What exactly is a business rule? How and when does it differ from everything else in the solution?

i like this quote from wikipedia:

"There exists no definition of business logic in any programming language specification or API, nor in any academic research. However, usage of the term persists in trade publications..."

but be careful -- if you stop believing in the existence of 'business rules' you might vomit up the kool aid -- spit out the red pill, and do a Gunderloy ;-).

So what am i saying? have i become a business rules atheist?

Never -- i've just started to realise that there's some business rules that live in the presentation layer. There are some business rules that live in the database. And there are some things that aren't business rules that live in the business layer. It's all fluid, like Thermodynamics, baby

<[?Pragmattism: that's the ticket!. Given a particular fact in our system, what is the likelihood of it changing: based on our own experience? and where can we place this fact so that it fulfills some optimum combination of:
  • cheap to change,
  • not repeated,
  • easy to use,
  • available when needed

Much to say -- but no motivation to share it (right now).

The final topic is separation of content and presentation... but right now the brain is overloaded. Discuss quietly amongst yourselves. Teacher has a headache.





'Scott' on Fri, 29 Jun 2007 13:03:23 GMT, sez:

Don't forget to separate your software from your users. After that, everything is easy.



'Ryan Smith' on Fri, 29 Jun 2007 15:49:28 GMT, sez:

"Vomit up the kool aid and do a Gunderloy"
Classic.



'Matt Blodgett' on Fri, 29 Jun 2007 16:49:02 GMT, sez:

The Gunderloy reference was perfect.



'lb' on Sun, 01 Jul 2007 08:59:08 GMT, sez:

@Matt/Ryan
"The Gunderloy reference was perfect."

No, it's an unfair mischaracterisation. I never liked that bit, and i almost cut it out. I left it in cause it's funny, but it's definitely a little bit wrong. ;-)

thanks though!



'Doekman' on Sun, 01 Jul 2007 14:47:16 GMT, sez:

Harvard Architecture ain't dead:
http://en.wikipedia.org/wiki/8051

OK, it's not very much alive, but the 8051 derivates are still in use.



'Chui' on Wed, 04 Jul 2007 08:07:17 GMT, sez:

Insofar as code and data are concerned, we can delve into mysticism and see that verbs have no meaning on it's own, and only has meaning if nouns exist.

Therefore, code and data are merely mental constructs for something that's inherently One.

Similarly the distinction between business and presentation layer starts to get blurred when data entry with validation occur. The business layer cannot work without cooperation of the presentation layer. Taken to singularity, the presentation becomes a representation of a business layer, so instead of MVC, we have Model-Representation architecture.



'Joe Reddy' on Wed, 02 Apr 2008 17:12:35 GMT, sez:

"i've just started to realise that there's some business rules that live in the presentation layer. There are some business rules that live in the database. And there are some things that aren't business rules that live in the business layer."

Do you still believe this?




name


website (optional)


enter the word:
 

comment (HTML not allowed)


All viewpoints welcome. But the right to delete any post for any reason is reserved. Don't make me do it. Comments may be republished, emailed to your loved ones or printed and used as toilet paper. Who reads this legal bit anyhow?

TimeSnapper is a life analysis system that stores and plays-back your computer use. It makes timesheet recording a breeze, helps you recover lost work and shows you how to sharpen your act.

TimeSnapper won last year's Developer Competition at Larkware.com, and is used by over 10,000 people.

Articles

Alan Kay on 'The Camel has Two Humps' Alan Kay on 'The Camel has Two Humps'
is the music inside the piano? is the music inside the piano?
The Bluffer's Guide To Yegge: Business Requirements R Bullsh*t The Bluffer's Guide To Yegge: Business Requirements R Bullsh*t
Prototype Ready for Launch Prototype Ready for Launch
Idea: a poor man's eye-tracking heatmap for win forms Idea: a poor man's eye-tracking heatmap for win forms
'The Register' seems to have plagiarised Mary Jo Foley 'The Register' seems to have plagiarised Mary Jo Foley
A magic goal for software businesses A magic goal for software businesses
A to Z of Software Methodologies A to Z of Software Methodologies
TimeSnapper in Music! TimeSnapper in Music!
Fixing problems can give you a glimpse of something terrible Fixing problems can give you a glimpse of something terrible
Web Tablet: Toward Less Complexity Web Tablet: Toward Less Complexity
Do they store the code for TFS in TFS? Do they store the code for TFS in TFS?
Sudden TimeSnapper Discount! Sudden TimeSnapper Discount!
How Can Microsoft Beat Google? How Can Microsoft Beat Google?
TimeSnapper 3.1: Attack of the the Red/Green Stripes TimeSnapper 3.1: Attack of the the Red/Green Stripes
21 tools used in our MicroISV 21 tools used in our MicroISV
Lost Treasures of the DOS World: tree! Lost Treasures of the DOS World: tree!
The Virtual Machine Machine and the Virtual Virtual Machine The Virtual Machine Machine and the Virtual Virtual Machine
Should Linq To Sql Go Should Linq To Sql Go "Open Source"?
Redux: New Synchronisation Idea Overlooked By Microsoft Redux: New Synchronisation Idea Overlooked By Microsoft
New Synchronisation Idea Overlooked By Microsoft Live team New Synchronisation Idea Overlooked By Microsoft Live team
Visual Studio UX Taskforce, Office UX Taskforce... etc. Visual Studio UX Taskforce, Office UX Taskforce... etc.
How to be Jeff Atwood How to be Jeff Atwood

Archives .: secretGeek :: Complete Archives :.
25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Top 10 SecretGeek articles Top 10 SecretGeek articles

Downloads

TimeSnapper -- Automated Screenshot Journal TimeSnapper.com    
Version 3.1: instant productivity profiles

ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Next Action NextAction
Managing the top of your mind



[powered by Google] 


World's Simplest Code Generator (html edition) World's Simplest Code Generator
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker
How to be depressed How to be depressed
You are not inadequate.



Recommended Reading

The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Reginald Braithwaite
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Joel Pobar
Eric Sink
Joel Spolsky
Des Traynor

Aggregated Links

programming.reddit.com
dzone
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
n links today
new and notable
morning coffee
learning .net
weekly link post
(my del.icio.us account)

LinkedIn profile
 
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2006 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2006 .: privacy