I've been thinking a lot lately about the cost of the shortcut, especially as it pertains to the early, brainstormy phase of design. Five minutes of Googling unearths a prefab piece of software which is almost but not quite completely like what you need to build. And suddenly the sirens are calling out, awakening the dream that you might have something impressive to show off this afternoon instead of next week. Fast-forward to six months later, when your code is hopelessly entangled with the now unsupportable prefab's source code, and you rue the day that Google learned its name.
Clearly there are cases where buying into a prefab can be a win. After all, code re-use is one of our core values. Case in point: when building a new website for my personal brand, I quickly decided on Radiant rather than write my own CMS from scratch. The site was up in a few hours. Prefab for the win.
But I have seen and experienced the darker side of co-option too: projects where we chose to get a head start with somebody else's code. Very quickly these problem projects can reach a point where we cannot easily subscribe to new improvements to the prefab for fear that they would countermand the design decisions we have made, or worse, for fear they would countermand the changes we have made to the prefab's code. Furthermore, the testing can become fragmentary and incomplete as we try to reconcile the prefab's testing approach with our own.
I'd like to discuss others' experiences with modules/libraries, frameworks and starter apps. Have you used things like BORT, Liferay, Spree, various web frameworks, business rule engines, etc. with success or failure? How about when your company acquires a proprietary new app, and hands down a mandate to make it the foundation of a brand-new vertical? Would love to discuss others' experiences with scenario like this.
I want to be clear that I don't want to bash any piece of freely available pre-built software. Rather, my sense about this design consideration is that when we adopt a prefab, we need to understand that the shortcut we are taking is not simply a shortcut in coding, it is a shortcut in design decisions. When we use a prefab, we are buying into a body of decisions made by the people who made the prefab; those wonderful folks never heard of you or your requirements.
What I'd like to explore:
- What's a good approach for deciding when to use a prefab?
- When does using prefab code improve/dis-improve the simplicity of a design?
- Is there a success threshold for the ratio of prefab functionality to completed app functionality? How do you measure or determine that threshold?
- Are there some good, pithy rules of thumb we can stick on the wall?
- What are the implications on TDD when you incorporate a prefab?
- Are there factors within the problem domain which may militate against or lend itself to the incorporation of a piece of prefab code?
Note: I'm purposely using the generic term âˆšÂ¢â€šÃ‡Â¨â‰ˆÃ¬prefab codeâˆšÂ¢â€šÃ‡Â¨Â¬Ã¹ because I'd also like to explore the different considerations at play when incorporating functionality at the service level, the module level, the framework level, and the application level.