In this chapter, we are going to refactor the standard D3.js bar chart we reviewed in the second chapter. It will become a professional-grade bar chart component. We will see how the Reusable API pattern proposed in the previous chapter allows us to encapsulate D3.js charts.
The resulting chart component is going to be extensible, and it will specify an explicit interface to interact with it. The Reusable API pattern supports that interface because we can create new getters and setters by adding a few extra lines of code.
The Path to Professional Code
We have seen the issues of example ...