Disordered Operations

Tha magnus_a and magnus_b global variables are there just to help people reading the code.

They basically are there to answer the question

What bodily orifice hat did the code author pull these numbers out of, and how do I know they are right?

They supply the numbers with provenance, to borrow a term from the art dealers' world.

Better alternative would be to use local variables for those, to not clutter up the global name space of the app, and to keep the definition of those numbers close to the place where they are used and far away from the definitions of other numbers used in other formulas.

Another alternative would have been adding AI2 comment bubbles to the blue number blocks, filled with all sorts of text naming the values and telling how they fit into that formula. There is a risk to that, if the person testing parts of the app does a right-click Do It to evanluate that blocks and wipes out the text.

Thank you for that observation, as it is still unclear to me My question in the second example is how to call the equations. It seems (to me) that that the: to save_Enthalpy block should contain the mathematics but the math has a key and the block has a "slot." How might I place that blue mess of equations into a procedural call that is activated upon a click of checkbox 28?

Got it. Thank you for the clarification. It just seems (to me, here and now) that one goes through so many extra steps to make a "programmatically correct" file. I just don't have the bandwidth to figure out procedural calls, with respect to variables. Even the procedures guide you connected me with likening a procedure to telling your child to brush his/her teeth doesn't touch on the orange variable names in the procedure block headers. I wish someone had an "App Inventor for Dummies" handbook in which I could look up a particular block function and find examples of all of the various ways to utilize said block(s).

Thank you for your support through my "I thought I was wrong, but I was mistaken" plase of learning AI2.

http://www.appinventor.org/content/howDoYou/procedures/param

Does this help ?

image

Yes, yes, yes! I have been stopped by trying to initialize a global name, not understanding that it was a specific variable. So, initializing a global _______ will create a variable named _______ and place into it whatever is attached by a key. I have been ascribing variables as having some kind of all-knowing aspects when, in fact, they were dictated by sub-routines. I think you gave me the blueprint for properly assembling the enthalpy function in a more readable form. I will do so and see how the data comes out. Thank you for that great lesson in procedure assembly!

David Wolber and YouTube.

You can't get better than that.

1 Like