-
Notifications
You must be signed in to change notification settings - Fork 68
Home
Tobie Langel edited this page Feb 9, 2016
·
5 revisions
Welcome to the automotive wiki!
- API style
Choices | Pros | Cons |
subscribe() style (Current style) |
- Possible to disable by 'unsubscribe'. - Can save CPU, memory consumption? |
- 'Subscribe' is not common style. No good reputation for developers. |
Event-based (Suggested from Generic Sensor API, DOM events, etc.) |
- Common style. Developers are familiar to this. | - Unsubscribe using either EventTarget.removeEventListeners() ) or setting eventhandler (e.g. onchange to null )- Multiple callback supported using EventTarget.addEventListeners()
|
- Interface grouping (encapsulation)
Choices | Pros | Cons |
Current style (e.g. Fuel.subscribe()) |
- Possible to get group of values by one get()/subscribe(). - Easy to use when only coarse values are needed. |
- Not possible to get()/subscibe() by only one attribute. - Not possible to set different interval/threshold to attributes |
Separated style. (e.g. something like Fuel.level.subscirbe()) |
- Possible to get()/subscribe() by only one attribute. - Possible to set different interval/threshold to each attribute |
- Need to set get()/subscribe() for each attributes one by one. |
- Constructor or not
Choices | Pros | Cons |
Current style (e.g. navigator.vehicle.door.subscribe()) |
- Simple and at least usable. | - Not modern. Not flexible. - Global name space pollution? |
Using Constructor (e.g. var door = new Vehicle.Door() ) |
- Modern style. - Flexible to use. |
- Memory consumption? |
- Other topics
Choices | Pros | Cons |
- | - | |
- | - |