Article based on a blog post by Mobile Mentor consultant Shane Sloan
There is a clear advantage in using Microsoft PowerApps to empower inexperienced ‘citizen developers’ to build real, usable, useful mobile apps with little or no coding experience.
With Microsoft’s excellent documentation and a vibrant PowerApps community, building an app has become a simple matter of constructing it out of pre-made parts, much like building flat-pack furniture.
However, with PowerApps’ simplicity and visual nature comes limitations, including a major one - code reuse, or more specifically, the lack thereof.
What is code reuse?
In traditional computer programming, developers often find that they need the program to perform the same set of commands over and over again, sometimes in quite different parts of the program.
Rather than coding the same sequence of commands every time they’re needed (and possibly doing it incorrectly in one or more instances), a good programmer will create a function that contains the commands, and simply “call” the function as needed from the main program.
This approach provides a couple of advantages:
The function works the same way every time it’s called, so there’s no risk of it working one way in one part of the program and a different way in another.
A miscoded function would work wrong every time it’s called, but the advantage here is that it needs to be fixed in only one place.
Code reuse and PowerApps
As useful and beneficial as code reuse is, it’s conspicuously absent from PowerApps’ capabilities and there are any number of situations where it would come in handy.
For example, it is often necessary in mobile apps to display or hide an input field according to the value of a related “on/off” toggle control. Turn the toggle “on” and the field appears, ready for input; turn it off and the field disappears.
With PowerApps, the programmer has to define this functionality explicitly for each field - you can’t code up a “hide/unhide” function and call it when needed. This sort of limitation can be frustrating for traditional developers and is even more so for these PowerApps ‘citizen developers’, especially if they have to do it frequently.
It is worth hoping that some future version of PowerApps will give people the option of lifting the visual-programming covers long enough to implement at least some of the standard features of traditional coding, such as code reuse.
Far from being overwhelming to non-coders, who would still have the visual-only option, it would give them something to work up to as they gain experience with the platform.