michielbdejong/solid-panes

View on GitHub
src/form/psuedocode-notes.txt

Summary

Maintainability
Test Coverage
These notes are about the user interaction flowchart
for the process of chosing a workspace and if necessray
making one, chosing an account or if necessary signing up for one.
This is yet to be coded up mostly (2013-07).

Could reflect as to whether to build the flow
is data or RDF or do it with futures or just code it up in AJAX normal.

________________________________________

Allow cancel back to here at any time directly or indirectly
    
    If preferences not loaded, load preferences.
        on error, explain problem and what trying to do, offer to cancel or try again.
    In preferences, find workspaces.
    
    workspace dialogue:
    offer create a new workspace
        if so, refresh workspace form
    offer select a workspace
    if selected, continue returning ws.
    
    activity dialogue:
    if workspace not loaded, load workspace
    look for suitable activity
    if only one, return that.
    If none or more, make form.
    offer to create a suitable activity
    offer to select an activity.
    on activity selected,
        return the activity

    create the form in the activity's store.



In normal synchronous form this would look like:

 createForm(getActivity(selectWorkspace(loadPreferences(me))))

or p = loadPreferences(me)
   w = selectWorkspace(p)
   a = getActivity(w)
   x = createForm(a)
   
World futures really help?  You would end up with

    loadPreference(me).then(function(p){
        selectWorkspace(p).then(function(w){})})
             .... etc

or 
    loadPreference(me).then(function(p){
        selectWorkspace(p)})
    .then(function(w){
    });