The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Widget interface

We want to offer a really clean simple widget xml interface to our service, where servercode is permitted to execute.
(There is danger in that, but we have that part covered)
This is a work in progress, and we are trying to figure out better and easier ways to do this all the time.

The api is defined as a serverscript by the author, and the access from the client to it is by default ajax, and is triggered by (any number of) events, like onclick, onload, etc..
The serverscript has the exact same range of access to the inline elements as clientside dhtml, including style/css.
There's basically no need for clientside jscript for anything one wants to do.

The question is whether there are ways to further simplify this, making it quicker to work with?
Any comments on that, what we should change or add, would be greatly appreciated.
(If you dont like ajax or xml, period, point taken - dont mind this post)

Below is a calculator example.
Code put in the serverscript block has unrestricted access to the server and it's internal database/objects, making it easy to create an email application or similar this way.

----

<window
class="application"
copyright="Somebody"         
icon="calculator_logo.gif"           
resize="no"
maximize="no"
caption="A simple calculator"
height="170"
width="230"
type="hidden"
top="130"
left="230">
<serverscript
 allow="setSum:getSum:clearSum">
<![CDATA[

function setSum(str)  {
var d=myIDresult.text;
if(d=="0"){d="";}
myIDresult.text=d+""+str;
}

function getSum() {
var d=myIDresult.text;
myIDresult.text=eval(d);
myIDresult.text=myIDresult.text.replace(/,/g,".");
}

function clearSum() {
myIDresult.text="0";
}

]]>
</serverscript>
<style>
<!--
#myRef{height:170;width:220;background-color:black;background-image:url(fillbar.png);background-repeat:repeat-x;scrollbar-base-color:black;scrollbar-track-color:black;}
#myRef table{margin:10px;margin-left:auto;margin-right:auto;}
#myIDresult{color:white;background-color:black;border:silver 1px solid;width:100px;height:20;text-align:center;margin:2px;}
-->
</style>
<center>

<table border="0" cellpadding="0" cellspacing="1">
<tr valign="top">
<td align="middle" id="myDtarg" colspan="4">
<button id="myIDresult">
0
</button>
</td>
</tr>
<tr valign="top">
<td load="setSum(1)" box="myDtarg">1
</td>
<td load="setSum(2)" box="myDtarg">2
</td>
<td load="setSum(3)" box="myDtarg">3
</td>
<td align="right" load="setSum(0)" box="myDtarg">0
</td>
</tr>
<tr valign="top">
<td load="setSum(4)" box="myDtarg">4
</td>
<td load="setSum(5)" box="myDtarg">5
</td>
<td load="setSum(6)" box="myDtarg">6
</td>
<td align="right" load="setSum('+')" box="myDtarg">+
</td>
</tr>
<tr valign="top">
<td load="setSum(7)" box="myDtarg">7
</td>
<td load="setSum(8)" box="myDtarg">8
</td>
<td load="setSum(9);" box="myDtarg">9
</td>
<td align="right" load="setSum('-')" box="myDtarg">-
</td>
</tr>
<tr valign="top">
<td load="setSum('/')" box="myDtarg">/
</td>
<td load="setSum('*')" box="myDtarg">*
</td>
<td load="clearSum('.')" box="myDtarg">CE
</td>
<td align="right" load="getSum()" box="myDtarg">=
</td>
</tr>

</table>

</center>
</window>
Mikael Bergkvist Send private email
Tuesday, July 11, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz