1 Reply Latest reply on Jan 25, 2010 12:43 AM by Alessandro Belmonte

    How to build dynamically specified GUIs/Forms

    Alessandro Belmonte

      Dear forum members:

       

      As Flex newbie I still have got some questions concerning the Flex technology.

       

      I've got to modernize an existent catalog-based ordering system in which a ShopManager (the 1st kind of enduser and an "enduser programmer" at the same time) shall be able to *declaratively specify* some customer groups, products, product bundles, product- and group-specific prices (via pricing rules) and product selection rules. Then, a customer (2nd kind of enduser) shall be able to place orders through a GUI that behaves exactly as specified before by the ShopManager.

       

      In a non-enduser-programming scenario I normally would use a MVC-framework (like Cairngorm or Swiz, I guess for the Flex world) and hard-code the controller logic as need.
      The problem I have in this enduser-programming scenario is that I cannot figure out how to transform the declaratively specified behaviour into running controller code!?!!!

       

      Perhaps a rudimentary example in order to clarify issues:

      Let's say we have a ShopManager and a Customer, and that the "workflow" is as follows:

       

      A) the ShopManager specifies via his/her ShopManagerTool the following topics, ignoring further topic-specic properties for now:

       

         1. customer_groups = {cg01, cg02}
         2. products = {prodA, prodB, prodC}
         3. product_bundles = {{bundle01, prodA, prodB}, {bundle02, prodB, prodC}}
         4. price_rules = {
                              //atomic product prices, cgroup-specific:  (*1)
                              price_rule(cg01, prodA, 20.00USD),        
                              price_rule(cg02, prodA, 18.00USD),
                              price_rule(cg01, prodB, 25.00USD),
                              price_rule(cg02, prodB, 22.00USD),
                              price_rule(cg01, prodC, 30.00USD),
                              price_rule(cg02, prodC, 27.00USD),

                              //bundle prices, cgroup-specific:
                              price_rule(cg01, bundle01, 39.99USD),
                              price_rule(cg02, bundle01, 37.99USD),
                              price_rule(cg01, bundle02, 59.99USD),
                              price_rule(cg02, bundle02, 55.99USD),
                          }
           
         5. selection_rules = {                                           
                              sel_rule(cg01, dependsOn(prodC, prodA)),   (*2)
                              sel_rule(ALL , dependsOn(prodC, prodB)),
                              sel_rule(ALL , includes(prodA, prodC)),    (*3)
                              sel_rule(ALL , excludes(bundle01, prodC)), (*4)
                              //...
                           }
           
      B) the Customer uses the ordering GUI to select products and/or bundles and place his/her order.

          The GUI components always follow the pricing and presentation/selection rules imposed by the ShopManager specification done before.

       

      Explanations:
      (*1) This is a kind of pricing matrix and should be obvious.
      (*2) This selection rules should be read as follows:
           (*2) "for cg01 holds: whenever he selects prodA then prodC becomes selectable (as prodC depends on the selection of prodA)".
           (*3) "for all customer groups: the selection of prodA automatically includes prodC".
           (*4) "for all customer groups: the selection of bundle01 automatically excludes prodC".

       

       

      That's basically the kind of app to realize, and as far as I can figure it out with my current Flex-understanding, I'll need some model element classes (Product, Customer, CustomerGroup, RuleSet, Rule, PricingRule, SelectionRule, etc.) used by the ShopManager to specify things, and further also let him define some kind of "model element (property) to view element (property)" mapping for visualizing the specifications.

       

      1. How could this problem be solved the best way? I.e., what would an appropriate solution architecture look like?

       

      2. How would I transform the declarative ShopManager specifications into concrete MVC code in general and into concrete controller code
      in particular?

       

      3. Could anyone of you provide me with a rudimentary example of such "dynamically specified forms"?

       


      Please, due to the current importance of these issues, I would be very very thankful for any helpful solution hints.
      Thank you very much in advance.

       

      Best regards
          Alessandro