by Wilfred Verkley >> Thu, 8 Jun 2000 4:28:22 GMT
I had a quick play around with an Idea ive been thinking of for a while but never got started, a Jade Version of "Active Server Pages".
It was suprisingly easy actually. Because i already had the architecture in place (we built our own web architecture here at Wang), all i needed to add was a pre-processor step that converted an ASP page written in JadeScript & HTML into a pure JadeScript source, which then gets compiled and executed on the fly using the JadeCompiler object.
Anyone thats done ASP, PHP3, or similar will be familiar with this example :
<%@ Language=JadeScript>
<%
vars
employee : Employee;begin
%>
<HTML>
<TITLE>Employees</TITLE>
<BODY>
<H3>Employees</H3>
<TABLE>
<TR><TD><B>Name</B></TD></TR>
<%
foreach employee in mySession.currentEmployer.allMyEmployees do
%>
<TR><TD><%=employee.name%></TD></TR>
<%
endforeach;
%>
</TABLE>
</BODY>
</HTML>
<%
end;
%>
Its an immensely cool way to write web applications since the integration between the HTML (presentation layer), the business logic, and the data is so clean (mostly thanks to Jade), and yet you can use the full power of Jade and all the features on the web browser to write your applications. Additionally, you can fully use tools like MS Visual Interdev or FrontPage to design and maintain all your web pages.
On the downside, executing JadeScript on the fly is relatively slow. Where perfomance is an issue, you would still code your web applications in pure jade. However you could prototype your application using these ASP-like pages, and once the design is stable, port the "compiled jade-script" produced by the ASP pre-processor into pure jade code.
Wilfred.