alogo

Coders Wishes for new GUI Generators

Okay the next generation of GUI is almost completely out of the gate – and each system has brought more new syntax and semantics to learn: Adobe has MXML and ActioinScript3(major update); Microsoft has XAML and one of a variety of Silverlight scripting tools, and Sun has JavaFX with JavaFX Scripting. All of them have a fair bit of XML/HTML. I will use an example from JavaFX:
        import javafx.ui.*;       
         class Item {
            attribute id: String;
            attribute productId: String;
            attribute description: String;
            attribute inStock: Boolean;
            attribute quantity: Number;
            attribute listPrice: Number;
            attribute totalCost: Number;
        }

        attribute Item.totalCost = bind quantity*listPrice;

        class Cart {
            attribute items: Item*;
            attribute subTotal: Number;
        }

        operation sumItems(itemList:Item*) {
            var result = 0.00;
            for (item in itemList) {
                result += item.totalCost;
            }
            return result;
        }

        attribute Cart.subTotal = bind sumItems(items);

        var cart = Cart {
            items:
            [Item {
                id: “UGLY”
                productId: “D100”
                description: “BullDog”
                inStock: true
                quantity: 1
                listPrice: 97.50
            },
            Item {
                id: “BITES”
                productId: “D101”
                description: “Pit Bull”
                inStock: true
                quantity: 1
                listPrice: 127.50
            }]         };

        Frame {
             content: Label {
                text: bind

                   “<html>
                       <h2 align=center>Shopping Cart</h2>
                       <table align=center border=0 bgcolor=#008800 cellspacing=2 cellpadding=5>
                          <tr bgcolor=#cccccc>
                             <td><b>Item ID</b></td>

                             <td><b>Product ID</b></td>
                             <td><b>Description</b></td>
                             <td><b>In Stock?</b></td>

                             <td><b>Quantity</b></td>
                             <td><b>List Price</b></td>
                             <td><b>Total Cost</b></td>

                             <td> </td>
                           </tr>

                           {
                             if (sizeof cart.items == 0)
                             then
 “<tr bgcolor=#FFFF88><td colspan=8><b>Your cart is empty.</b></td></tr>”
                             else foreach (item in cart.items)

                                 “<tr bgcolor=#FFFF88>
                                  <td>{item.id}</td>
                                  <td>{item.productId}</td>
                                  <td>{item.description}</td>

                                  <td>{if item.inStock then “Yes” else “No”}</td>
                                  <td>{item.quantity}</td>
                                  <td align=right>{item.listPrice}</td>
                                  <td align=right>{item.totalCost}</td>

                                  <td> </td>
                                  </tr>”
                           }

                           <tr bgcolor=#FFFF88>
                                <td colspan=7 align=right>
                                   <b>Sub Total: ${cart.subTotal}</b>

                               </td>
                               <td> </td>
                            </tr>
                         </table>
                      </html>”
                }
                visible: true
        }

Note here how much balancing of tags, brackets, parentheses, single quotes, and double quotes is extended over many lines . Also some lines require a terminator and others dont. Yes, for all ASP, JSP and PHP coders who have lived through this nightmare – we need help! Note, for example, the fourth to last line </html>” needs a closing quote that lies somewhere way up in the script. Help us spot the balancing double quote.

Here are the three suggestions:

1)Help us find the balancing XML/HTML tag, bracket, double quote (note we dont ask for single quote because as in “dont”, single quotes dont have to be paired). Make these coding aids work just like parentheses and brackets work right now in say Eclipse or NetBeans;
2)Permit the use of the back single quote => ` (not the normal single quote => ) as a substitute for the single quote. This comes in very handy with formating HTML and XML in complex, layered scripting contexts;
3)When there is a choice for syntax, require delimiters for statements; so that users can spot where mix mode statements within generated statements occur.
In short, if you are going to make us learn even more new syntax yet again – simplify the coding and error detection in a smart editor please.


(c)JBSurveyer 2007 If you liked this, let others know:
Slashdot Digg del.icio.us reddit newsvine Y! MyWeb

Pin It on Pinterest