Today I met up with Ty, my 15-year old homeschool friend, at a coffee shop near his house. An hour and ten minutes later, he had built a working temperature conversion calculator app. We were both so jazzed!
This is Ty’s first real project; so far he has just made little experimental throw-away things with LiveCode. He has also been making his way through the LiveCode University app. His “total beginner” status made him eligible for a free license from the LiveCode folks. I don’t know how long they will offer this deal, but at the time of this writing it was still being promoted on their home page.
Our guiding principles were:
- keep it simple – this exercise is about learning, not about impressing anyone
- make it functional before making it pretty
Ty had used an online currency converter before, but never a temperature converter. We started by doing some rough sketches of what the thing might look like. That helped us identify the essential parts:
- an “input” text entry field
- an “output” text display field (not editable)
- a dropdown list of unit names (Fahrenheit, Celsius, Kelvin) under each text field
- a “Convert” button
Once we figured out the parts, we needed some conversion formulas. Wikipedia was our source. We used this one for Celsius to Fahrenheit:
[°F] = [°C] × (9 ⁄ 5) + 32
With object name substitutions, the code that did the conversion looked like this:
put field “input” * (9/5) + 32 into field “output”
It worked! We tested the code using 100 as the input Celsius number and got (drum roll…) 212 as the Fahrenheit equivalent.
That’s as far as we got in the coffee shop. Ty’s homework is to add other formulas, following the above pattern in his code.