Designing and Debugging Mobile Apps with an Embedded, Scriptable Web Server
1. Designing and Debugging
Mobile Apps with an Embedded,
Scriptable Web Server
Matthew Burke
matthew.burke@capitalone.com
All Things Open • Raleigh, NC • 14 October 2019
Just a taste of why you might want to do this and how you would do it.
Reach out to me via email and I’d be happy to discuss at length
2. General Points
• Value in a general-purpose, turn-key solution?
• Easy enough to role your own
• Security
• Increases attack surface for your app
• Do you trust your beta testers?
7. Desired Features
• Path variables
• Header processing
• URL-encoded Forms
Others are context dependent.
Unless you have specific needs, HTTPS support not needed.
10. KA SwiftTweaks
public struct ET: TweakLibraryType {
public static let tint = Tweak(“General”, “Colors”,
“Tint”, UIColor.blue)
public static let marginVertical = Tweak<CGFloat>(…
public static let defaultStore: TweakStore = …
Note one alternative with some history behind it is a “Tweaking system”
E.G. Kahn Academy’s implementation. Mention Facebook.
A lot of overhead due to creating UI to adjust these values.
11. Be careful with your UI.
Users will always
surprise you.
TAP Congress story
21. A few words about
Lua
Language choice: you want something light-weight and with a good API
22. Again, this is not necessarily production-quality code, although depending on your use case, it might be adequate.
The main point here is that Lua's first-class functions allow you to fairly easily implement a range of techniques.
23. smt = debug.getmetatable(“some string”)
smt.__mul = function(s, i)
local result = “”
for idx = 1, i do
result = result .. s
end
end
“foo” * 3 .. “bar” -- foofoofoobar
Perhaps a slightly less whimsical example...here I overload multiplication to give string repetition.
24. The Lua C API:
• fully re-entrant
• information contained in a Lua State
• communicate via a virtual stack of Lua values
• registry—predefined Lua table
• userdata for accessing host program data
“C API Details” Slide
31. Summary
• Embedding a webserver during development opens up a
range of techniques to ease development and explore the
design space
• Scripting naturally extends this capability—you don’t have
to decide everything up front
• Lua is a very solid choice for this purpose.
32. Thank You! Questions?
• matthew.burke@capitalone.com
• http://github.com/profburke — slides will go up soonish
• http://lua.org