Script Only Stack Architecture

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Mar 29 18:37:16 EDT 2016


 
I'm going blind here, eyes burning with the app contents open to the LC 8 application folder and looking at the 100's of .rev, .livecodescript and .livecode files.

So here's a thought experiment and me thinking outloud for this actual project in front of me.

Starting at square 1  

The script only stacks have zero "auto presence" path wise... relative to any .livecode stack  

Later you will need to explicitly find it (OK.. I know.. too obvious but let's declare it anyway)

on mouseUp
put specialFolderPath("Resources") into tMyHomePath
start using stack ( tMyHomePath & "/" &"libraries/CoreTextfieldFunctions.livecode") 
	#all things readable in fields
checkPath ("Yes, i Got It.")
End mouseUp

I tried to find where the revIDE stacks were setting up their root default folder but could not find it.

Looking for patterns we see e.g. 

/contents/Tools/Toolset/Libraries
/contents/Tools/Toolset/palettes
      /behaviors
      /dictionary
      /inspector
          /behaviors
          /editors

with .rev and .livecode stacks here and there.

I need a nap to absorb and create a picture of the incredible number of separate files in the IDE!

Though ""Everything is true, Everything is Permitted" one way is obvious -- use  the MVC model for the thought experiment -- this assumes one has had the discipline to draft a relatively complete functional specification for your app ahead of time... of course in AGILE mode this could change but you need to start somewhere. 

You have two classes of code: 

1) Code that serves as underlying end point of messages from coming from the views (mouse down/up swipes, taps typing, clicking)... pertains to the "back end" ...    then we organize by folders that relate to function.  Let;s use the RevIgniter core as an example.. and quite possibly this is adaptable to any given app.

config
controllers 
    # presumably you segregate the traffic cops here
    # but don't mix in more complex functions
cronjobs
db
errors
helpers
hooks
index.html # could be "MyApp.livecode"
language
libraries
models
plugins
stacks
views

2) Code that pertains directly to the presentation layer itself, main stack, substacks that are binary.livecode stacks, cards and controls. and they that the user actually sees and interacts with. Code that actually dynamically builds or manipulates the GUI... 

So these you can organize along the lines of your functional specification "Views" seems a reasonable uber way to think about it.
though perhaps "stacks" is enough and better term, since from HC days a stack is what we see (though now we have that line blurred with script-only stacks)

/stacks/
   home screen
   portals (navigation screens)
   user-account
   user Settings
   favorites
   readers # text displays, reading books, quotes
   web-browers # for cards with the browser widget
   my-exercises # exercise tracker or whatever
   image-puzzles # some game
   etc.
   assets
     /fonts
     /img
        stack-wide
        portals
        my-exercises
        image-puzzles.

Inside those folders, following on the LC teams patterns, you segregate behaviors from libraries, by criteria I have yet to fully grok.  I'll be looking into the msg path after that nap and possibly that will clarify things. 

That's a small beginning, I hope. perhaps we can find broad classes that work everywhere for #1 set of code above.. that would be ideal. Though I expect because of the "anything is permitted" law... it may also be somewhat subject depending on your style?

Comments?

BR
        
   
 

On March 29, 2016 at 10:58:48 AM, Richard Gaskin (ambassador at fourthworld.com(mailto:ambassador at fourthworld.com)) wrote:

> William Prothero wrote:  
>  
> > Organizing the code in a project is really important and there are lots of ways to go wrong.  
>  
> Can you describe some?  
>  
> While documenting good patterns can be useful, sometimes documenting  
> anti-patterns is just as useful.  
>  
> Several years ago at one of the LC conferences in Monterey Ken Ray and I  
> did a talk called "LiveCode Patterns and Anti-Patterns". So much has  
> changed since then (behaviors, before and after messages, script-only  
> stacks, etc.) that it would be very helpful to hear your concerns as I  
> prepare to dive into my archives for the old notes....  
>  
> --  
> Richard Gaskin  
> Fourth World Systems  
> Software Design and Development for the Desktop, Mobile, and the Web 


More information about the use-livecode mailing list