So you want your enterprise to reuse the same component in different apps? Smart move. Let’s say your component is a barcode scanner or signature capture. What happens? Your development organization creates it for one app. Then, they copy the code and change it slightly for the next app. Right? Wrong! The minute you change one line of code, your component is no longer reusable. Here’s what your team should do instead….
First, understand that none of your reusable components can ever change.
Very few mobile app developers have been exposed to this concept, so you’ll need to get your organization thinking differently about what reuse really means. If you have to change a component – even just a little – to meet the requirements of a new app, then your component wasn’t really reusable.
What it takes to create a truly reusable component.
Start by listing the features that different apps will need from your component. Suppose your reusable component is an API for signature capture. Then, the signature color might need to be blue in one app, but black in another.
- Take this list of features, and build them as options into your component. The same component should be capable of creating both blue and black signatures (and probably a lot of other things, too – such as adapting to different screen sizes or capturing the signature image in different formats).
- Create a separate configuration component to drive the behavior of your reusable component. This configuration component will tell your reusable component how to behave in different apps – blue signatures for this app, black for that app. Instead of having to change the code in your reusable component, you’ve externalized its configuration.
An app can have 20 or more reusable components, but only one configuration component.
Your configuration component tells all the other components what to do. Because their code never changes, these components are 100% reusable. This slashes development costs, reduces risk, ensures quality, and speeds your time to market.
What will you developers do with all that extra time on their hands?
Instead of having to reinvent the same components with every new app, your development teams can focus on building the functions that truly differentiate the app.
Learn more best practices for building a reusable component architecture.
Download our free e-book: The 2014 Bottleneck Report on Enterprise Mobile.