hw7 done, please check

This commit is contained in:
Claudio Maggioni 2023-04-04 13:47:12 +02:00
parent 5d0f7aeebb
commit fbb2885e44
4 changed files with 84 additions and 6 deletions

View file

@ -1,4 +1,4 @@
## ADR #0003: Use RDBMS as main choice for database technology ## <a name="adr0003"></a> ADR #0003: Use RDBMS as main choice for database technology
1. **What did you decide?** 1. **What did you decide?**

View file

@ -0,0 +1,41 @@
## ADR #0004: HomeKit and MQTT are the supported protocols for smart devices
1. **What did you decide?**
HomeKit and MQTT are the protocols which shall be used to connect to user provided smart devices and sensors. Other protocols will be unsupported for the first release of SmartHut.
2. **What was the context for your decision?**
Due to SmartHut being an open ended system relying and integrating with user provided devices it is crucial to provide support to satisfy the userbase as much as possible. That being said,
the more protocols will be supported the higher the development cost in integration will be, and this can be especially hurtful in the MVP and hobbyist-oriented style SmartHut is currently being developed.
The protocols chosen shall have a maintained Java open source client library for ease of integration with the existing users and devices backend, which is implemented using the Spring framework.
3. **What is the problem you are trying to solve?**
Which protocols will cover a satisfactorily large number of smart devices from the userbase and which libraries can be used to with them?
4. **Which alternative options did you consider?**
- MQTT protocol, via the Eclipse [paho.mqtt.java](https://github.com/eclipse/paho.mqtt.java) library;
- Apple HomeKit Accessory Protocol, via the [HAP-Java](https://github.com/hap-java/HAP-Java) library;
- other protocols (such as Google home, Zigbee, or Alexa), of which I did not find a suitable library.
5. **Which one did you choose?**
- MQTT protocol, via the Eclipse [paho.mqtt.java](https://github.com/eclipse/paho.mqtt.java) library;
- Apple HomeKit Accessory Protocol, via the [HAP-Java](https://github.com/hap-java/HAP-Java) library;
6. **What is the main reason for that?**
The MQTT protocol is standardized and has a simple specification, while being widely adopted in both commercial and industrial IoT settings. Supporting this protocol is a way to future-proof SmartHut and potentially diversify the market of applications in which it can be installed.
The _HAP-Java_ library provides good support for HomeKit and it is well maintained, and supporting the protocol will provide an effective way to provide consumer devices which may be seldomly supported by using MQTT only.
Pros:
- Wide coverage of different applications by providing support for both an industrial-oriented protocol and a consumer-oriented one;
- Free and open source libraries for both protocols with non copyleft licenses, providing ease of support for free and compatibility with a possible commercial distribution of SmartHut;
Cons:
- Supporting two protocols instead of one has higher integration cost;
- HomeKit is not a widely-adopted standard when compared to Google home, Zigbee or Alexa, catering for a potentially smaller userbase.

View file

@ -0,0 +1,37 @@
## ADR #0005: PostgreSQL is the database implementation to use
_ADR depends on [ADR #0003: Use RDBMS as main choice for database technology](#adr0003)_
1. **What did you decide?**
PostgreSQL is the RDBMS implementation to be used in all stateful components of SmartHut.
2. **What was the context for your decision?**
A suitable RDBMS implementation shall be found to store the data for all stateful components in the component diagram. The technology shall be as ANSI SQL compliant as possible, battle-tested and provide easy JDBC integration, as the users and devices backend is already implenented using the Java Spring framework.
3. **What is the problem you are trying to solve?**
Which RDBMS implementation is the best choice for all stateful components?
4. **Which alternative options did you consider?**
- MariaDB
- PostgreSQL (postgres)
- Microsoft SQL Server (mssql)
5. **Which one did you choose?**
- PostgreSQL (postgres)
6. **What is the main reason for that?**
PostgreSQL is the only RDBMS technology in the list to be fully ANSI SQL compliant while also being widely adopted in industry. Additionally, PostgreSQL provides additional support for features like JSON-aware string queries and direct support for hierarchies, which may come handy when designing the schema of each component's database.
Pros:
- FOSS technology;
- Battle-tested;
- ANSI SQL compliance + additional advanced features.
Cons:
- Using advanced features may lock-in this choice more than necessary and make a future switch to another technology harder.

View file

@ -779,17 +779,17 @@ Exceed: Redesign based on >3 reused components (1 Logical View, >1 Process View,
## Component selection process ADRs ## Component selection process ADRs
<span style="color: red">TBD HAP-java + paho.mqtt.java</span> ![Architectural Decision Record 4](./decisions/0004-homekit-and-mqtt-protocols-smart-dev.madr)
<span style="color: red">TBD postgres (cite ADR #3 - reational DBs)</span> ![Architectural Decision Record 5](./decisions/0005-postgres-as-rdbms.madr)
## Chosen components ## Chosen components
| **Name** | **Version** | **Description** | **Price** | **Sources** | | **Name** | **Version** | **Description** | **Price** | **Sources** |
| -------- | ----------- | --------------- | --------- | - | | -------- | ----------- | --------------- | --------- | - |
| HAP-Java | 2.0.4 (2022-11-23) | Java implementation of the HomeKit Accessory Protocol | free (MIT license) | https://github.com/hap-java/HAP-Java/tree/hap-2.0.4 | | HAP-Java | 2.0.4 (2022-11-23) | Java implementation of the HomeKit Accessory Protocol | free (MIT license - non copyleft) | https://github.com/hap-java/HAP-Java/tree/hap-2.0.4 |
| Eclipse Paho Java MQTT client | 1.2.5 SR (2020-07-15) | Java client for the MQTT protocol | free (EPL 2.0 license) | https://github.com/eclipse/paho.mqtt.java/tree/v1.2.5 | | Eclipse Paho Java MQTT client | 1.2.5 SR (2020-07-15) | Java client for the MQTT protocol | free (EPL 2.0 license - non copyleft) | https://github.com/eclipse/paho.mqtt.java/tree/v1.2.5 |
| PostgreSQL | 15.2 (2023-02-06) | Relational DBMS | free (PostgreSQL license) | https://github.com/postgres/postgres/tree/REL_15_2 | | PostgreSQL | 15.2 (2023-02-06) | Relational DBMS | free (PostgreSQL license - non copyleft) | https://github.com/postgres/postgres/tree/REL_15_2 |
## Logical View ## Logical View