How to separate Data definition from the Presentat

Results 1 to 2 of 2

Thread: How to separate Data definition from the Presentat

  1. #1
    Join Date
    Dec 1969

    Default How to separate Data definition from the Presentat

    This is an architectural question.<BR><BR>How can the serving of HTML be separated into 2 parts; 1. Data-Definition and 2. Data-Presentation. Once the data content has been defined every page passes through the presentation layer.<BR><BR>I have achieved this with Java Servlets. What would the main architectular parts to achieve this on an ASP platform. How capable is VBScript at creating, for example, a user-defined column object with attributes (Data Def&#039; Layer) that determine how the presentation layer creates a string of HTML to be served?<BR>

  2. #2
    Join Date
    Dec 1969

    Default But where will you save the info?

    How did you achieve that with the Java Servlets??<BR><BR>The actual work involved is pretty trivial. But the big question is how you connect the presentation definition to the data definition.<BR><BR>You could certainly *easily* do it on a per page basis using just arrays:<BR><BR>&#060;%<BR>defs = Array( "$2 dbCurrencyField", "&R30 dbTitleField", .... )<BR>%&#062;<BR><BR>And then you "interpret" the meaning of the prefix in each of those array elements. Maybe "$2" means "FormatCurrency(xxx,2)" and "&R30" mean "Right( Space(30) & xxx, 30 )" where xxx represents the data value to be substituted in.<BR><BR>Alternatively, you could simply use an enumeration and a SELECT CASE to choose which of several functions you use. (Or you could use--blech--Eval if you don&#039;t mind the performance hit.)<BR><BR>But still...<BR><BR>The acid question is *WHERE* do you store the association between data and format? Assuming you want something less transitory than just the current ASP page?<BR><BR>I guess you could use include files. And the include files could have either just the Array-based info as above or could have the specific functions as well. (Hmmm...sounds like servlets?)<BR><BR>Personally, I&#039;d tend to want to store the info in...what else...a database table! <BR><BR>Finally, you asked if VBS could create a "column object". Sure. Why not. You could create a VBScript class and then invoke a new instance of the appropriate class. The problem: VBS doesn&#039;t support inheritance, so no enforced polymorphism. Oh, okay, that&#039;s not really a problem. If *you* create the classes and *you* enforce the method naming and arguments and return types, then it&#039;s pretty indistinguishable from the class user&#039;s viewpoint. But there&#039;s still one other problem: VBS has no equivalent to Java&#039;s "Class.forName( )" and so no way to create an instance of a class given the name of the class. Except, once again, by using a SELECT CASE or (shudder!) the Execute statement. Ehhh...if you don&#039;t have more than a dozen or so classes, then the SELECT CASE isn&#039;t too onerous (you only have to write it once and then package it as a standard function) and will outperform the heck out of Execute.<BR><BR>So... Interesting. But how and where do you save the connection between the DB and the presentation? *That* is your real job.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts