Skip to content

Contributing: Structuring a Component

Jonathan Niles edited this page Mar 23, 2016 · 2 revisions

NOTE: This document is a work-in-progress. Please check back frequently for updates.

The core of bhima-2.X development are small, modular components that have well-defined inputs and outputs. Using components has many advantages, some listed below:

  1. Testability - writing small unit tests for components is easier and faster than large end-to-end tests.
  2. Modularity/Reusability - once tested, a component can be used anywhere with confidence.
  3. Maintainability - by removing view or validation logic from controllers, they can focus on implementing logic specific to their function.
When should I use a Component?

In general, you should use always create a component if you have to write specific view logic three or more times.

Writing a Component

When writing a component, the first thing you must define is the inputs and outputs. What should the component receive and what should it return? These will be the bindings for the component.

TODO