Many people is asking me, what is a "good" SPEAK component. It is a really good question. As SPEAK is really focused on Components and making them work together, writing "good" component is a key for success when building your own SPEAK application.
I will try to answer with this non-exhaustive list.
- A Component must be generic (this is the most important one)
- a component must work consistently across scenarios/pages
- no Ajax call inside a component (except in DataSources).
- Ajax calls must be gathered in a DataSource.
- It is "ok" to write your own DataSource. For basic scenario, the GenericDataSource provided in 7.2 will be enough.
- The data coming back from the server must be set in a property (enabling bindings)
- Interacting with a component must be done by setting values on a parameter (to empower Bindings)
- A component must have a single UI responsibility
- Be as granular as possible when defining your component
- Use as much as possible the Knockout API
- Use Require to load your dependencies (do not put component dependencies in your layout)
- Use as much as possible the existing components defined in the Business Component Library (they are supported by Sitecore)
- If it is not in the Business Component Library, could I change the UI/UX in order to prevent me coding anything? If yes, you should do that.
- Relying on Bootstrap for styling is fine.
Hope those lines could help you to get started when designing your custom components (do you really need it ?).
Please, feel free to share your opinion in order to refine this list.