Building prototypes with staying power
When requirements are unclear, or successful outcomes of projects are difficult to gauge, prototypes are often built. They can illustrate a team’s ability to deliver results quickly and can verify a particular development direction. Often, these proofs of concept are discarded or only partially reused (referenced and mined for code).
Despite knowing that prototypes might end up in the trash bin, it’s still worth investing time and effort in their development. After all, high-quality prototypes can become the basis of final products. In this blog entry, I will provide a few tips for creating prototypes with staying power.
Write clean code and test it
Deciding how much effort to expend on code will depend on the goal of the prototype, whether it’s implementing maximum functionality, writing and weighing several solutions, or testing architectural decisions. Still, regardless of goals, invest the time to write simple, easy-to-understand, well-structured code. Then, write tests for it. Such tests ultimately enable the reuse of more pieces of code.
Decide whether to use framework functionality
Although you should build your prototype around business logic, sometimes it can be most efficient to use framework functionality (rather than building an abstraction layer). As an example, the popular Java framework, Spring Boot, can be set up with Spring Data and an embedded H2 database with almost no configuration and in less than a half-hour.
If you go that route, take care to remove the framework at the right time (waiting could lead to complex, tiresome migrations), and be forewarned that some frameworks are difficult to remove. If, on the other hand, you are not familiar with the framework or library, coding from scratch would likely take less time.
Remember, trashed prototypes are not a waste of time
Naturally, developers tend to get attached to source code they’ve written. Yet, abandoned prototypes are not wasted efforts. After all, as code kata exercises illustrate, repeating exercises over and over ultimately helps turn out superior programmers. Plus, spending time on prototypes aids programmers in learning domains and solving problems.