The Storray Engine was originally published on November 23, 2006


As an independent .NET consultant, Steve gets called in to help smaller development teams to transition to the platform. Several weeks ago, a client had asked him to help rebuild some of their "core technologies" in .NET so they could offer it as a service to their clients. The first "technology" they wanted to upgrade was something called the Storray Engine.

At the requirements meeting, the brain behind the engine gave a quick summary: it's like having the benefit of a database without ever having to use SQL, ADO, or any of that stuff; just simple arrays. Then they dove into the code. First, they looked at the FindProducts.asp page. The beauty of it, the programmer explained, was that all you needed to do was include a single file, and you had access to all the products and could easily manipulate them with simple array functions ...

<!--#include virtual="/Code/StorrayEngine/Data/Products.asp" -->

Steve was curious how this include file might work, so they took a look ... 

<%
Dim STORRAY_Products(487, 7)
... 
STORRAY_Products(14,0) = "Black & Decker"
STORRAY_Products(14,1) = "Auto Tape Measure"
STORRAY_Products(14,2) = "ATM100"
STORRAY_Products(14,3) = "/products/images/bd_atm100.gif"
STORRAY_Products(14,4) = "<p>Extend and retract with the push of a button</p><ul><li>Blade ... " 
STORRAY_Products(14,5) = "21.99"
STORRAY_Products(14,6) = "2"
STORRAY_Products(14,7) = "True"
...
STORRAY_Products(212,0) = "DeWalt"
STORRAY_Products(212,1) = "Heavy-Duty XRP 18V Cordless Combo Kit"
STORRAY_Products(212,2) = "DC6KTGA"
STORRAY_Products(212,3) = "/products/images/dw_dc6ktga.gif"
STORRAY_Products(212,4) = "<p>This 6 pc. tool set comes with our top of the line 18V XRP ..."
STORRAY_Products(212,5) = "599.99"
STORRAY_Products(212,6) = "84"
STORRAY_Products(212,7) = "True"
...
STORRAY_Products(345,0) = "Ryobi"
STORRAY_Products(345,1) = "1/2 In. 18 V 2-Speed Cordless Hammer Drill"
STORRAY_Products(345,2) = "P210"
STORRAY_Products(345,3) = "/products/images/ry_p210.gif"
STORRAY_Products(345,4) = "<p>Increase your confidence when you undertake tough drilling tasks ..."
STORRAY_Products(345,5) = "54.99"
STORRAY_Products(345,6) = "16"
STORRAY_Products(345,7) = "True"
%>

With a grin from ear to ear, proud to be showing off his masterpiece, the programmer proclaimed, That's it! It's that simple! Although Steve was trying to figure out a professional exit strategy at this point, he just had to ask about maintenance. The programmer gleefully replied that's where the *real* Storray Engine lies.

The tour of the Storray Engine continued with the ProductsMaintenance.asp page. Maintaining is just as easy, the brain explained, all you need to know is arrays ...

<!--#include virtual="/Code/StorrayEngine/Core.asp" -->
<!--#include virtual="/Code/StorrayEngine/Data/Products.asp" -->

The rest of the Products Maintenance page contained a few array manipulation functions and a call to a save function. All the real work is in the Core libraries, the programmer explained ...

'Core.asp - Main Storray Engine Library
...
Function STORRAYLIB_SaveArray(name, ByRef storray)
  
  Dim fso, textfile, fileName, i, j

  Set fso = Server.CreateObject("Scripting.FileSystemObject")
  
  fileName = Server.MapPath("/Code/StorrayEngine/Data/" & name & ".asp", True)
  Set file = fso.CreateTextFile(fileName)

  file.WriteLine "<" & "%" & vbCrlf 
  file.WriteLine _
    "Dim STORRAY_" & name & "(" & UBound(storray, 1) & _
    "," & UBound(storray, 2) & ")" & vbCrLf

  For i = 0 To UBound(storray, 1)
    For j = 0 To UBound(storray, 2)
      file.Write _
        "STORRAY_" & name & "(" & i & "," & j & ") = " & _
        """" & Replace(Replace(storray(i,j),"""",""""""),vbCrLf,"") & """" & vbCrLf
    Next
  Next

  file.WriteLine "%" & ">" & vbCrlf

  file.close
End Function

As Steve gawked at the wonder that was the Storray Engine, the programmer commented yeah, I just can't figure out how to bring this into .NET; I'm thinking using classes instead, but man, it's hard to compile stuff at run-time!. Steve gave up all together on professionalism and, without saying a word, got up, left, and went to the nearest bar for a drink.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!