Considerations and recommendations

Something we should consider is that once we share our custom view, it might be used for many Android applications. If our custom view has errors and crashes, it'll crash the application using it. The application's users will not consider the custom view at fault but rather the application itself. The application developer, or developers, might try to open an issue or even submit a pull request to fix it, but if the custom view gives them too much trouble, they'll just replace it.

This applies to your own applications as well; you don't want to use an unstable component or custom view as you might end up either rewriting it or patching it up. As we've just mentioned, we should always aim for the highest quality. If our custom view is only used in one single application, the impact of finding a critical issue once it's at the production stage or the application is published to the store or stores only affects one application. However, if it's used by several applications, the impact and cost of maintenance increases. You can imagine the impact of detecting a highly critical issue of an open source component and having to make new releases of all the applications using it.

In addition, you should try to keep your code clean, well-organized, properly tested, and reasonably documented. It'll be easier for you, as well as your colleagues if you're sharing the custom view at your company, to maintain the custom view, and if it's open source, it will encourage contributions and won't actually scare external contributors. As with many other things, common sense applies. Don't over-document your custom view as basically nobody will read it; keep it as simple as possible and straight to the point.

In the following screenshot, we can see the open issues of the retrofit library, an open source Android library widely used in many applications:

Also, we can see there are many pull requests submitted by several developers, either fixing issues or adding functionality or features. In the following screenshot is an example of a pull request submitted to the retrofit library:

We've previously covered it already, but it's also important that the custom view behaves properly. Not only must it be crash-free but it also has to work properly on several devices and resolutions and have good performance.

We can sum up the list of recommendations with the following points: