1. Introduction and Goals
1.1. Requirements Overview
1.2. Quality Goals
1.3. Stakeholders
2. Architecture Constraints
3. System Scope and Context
We thereupon proceed to list the communication partners involved as well as their interfaces. We provide two distinct contexts to describe it, one domain-specific (Business) and another technical-related.
Chats created by an user may be either individual or groupal; following diagrams describe a one-to-one situation. Keep in mind, though, that groupal communications adhere to the same structure; the only difference being the number of interlocutor’s PODs chat and message info will be sent to.
3.1. Business Context
Business Context diagram
3.2. Technical Context
Technical Context diagram
4. Solution Strategy
4.1. Introduction
In this document, you will find the software decisions and solutions in order to ensure a quality app such as the technologies used and what is used for testing.
4.2. Decisions
The project is developed using the following :
4.3. Solution Aproaches
We started developing in javascript and node because we were inspired mostly by the great solid-chess application developed by Pieter Heyvaert.
5. Building Block View
This section consists of a decomposition of our system into building blocks, showcasing their inner dependencies.
5.1. Level 1
We begin the decomposition by displaying a white box description of the overall system -manifested in section III, Context Diagrams as 'DeChat' black box-.
It can be swiftly perceived that we have chosen a Model-View-Controller pattern for overall system architecture, reasoning being: * It is a fairly suitable and easy-to-grasp architecture for web applications such as ours. * We have created a few applications before using this approach.
Name | Responsibility |
---|---|
Service |
Performs an operation ordered by the Controller or another Service, working with user-provided data to persist or select information through Repository. Creates, joins and opens a chat, as well as storing and loading messages, either written by the user or received at his POD’s inbox. |
Repository |
Either persists the data provided by a Service -inserts or updates data in current user’s private POD folder as well as interlocutors' inbox- or selects stored/received data from current user’s POD. |
5.2. Level 2
5.2.1. White Box Service
It was determined that, in order to make the main logic more sustainable as well as comfortable to work with, it would be decomposed into 5 classes -services, since we opted for MVC-, which encapsulate the main features needed for basic chat communication. Those being the following:
-
BaseService. Contains basic functionality which is commonly needed and doesn’t fall under any category.
-
CreateService. Creates chats/groups, storing in user’s POD whatever information is needed and sending invites to all participants.
-
JoinService. Processes invitations to create a replica of the chat in invited user’s POD.
-
OpenService. Loads all information about stored chats and any messages it contains-.
-
MessageService. Looks for new messages in inbox to store them if necessary, as well as stores new messages created at current session and sends them to any participants' inboxes.
-
EncryptionService. Encrypts and decrypts data with TRUBIA algorithm.
Since there were common imports to all of them, sharing constructor as well, we abstracted a Service superclass to avoid duplicating code.
5.2.2. White Box Repository
There are three main clases conforming persistance functionality:
-
RDFJSSourceFactory. Given an URL, provides a RDFJS Source to make queries with Engine.
-
SolidLoaderRepository. Through the source provided by the latter, it collects chat info from any accesible URL to form a domain object, which will be used by whatever Service has required it.
-
SolidUploaderRepository. Executes SPARQL updates and insertions. Capable of deleting files, also.
The objective of this block is to provide CRUD operations for all of the Services, so that any chat-related information may be recovered or persisted. It plays a rather significant role, since it is the responsible of handling POD usage in both directions.
6. Runtime View
6.1. Scenarios
6.1.1. Main Scenario : the user’s journey flow.
User journey Flowchart
User journey in details
1 → Entering the main app
2 → Click on Login
-> Login or Sign up -> Confirm information
3 → The app loads all the data necessary including the user’s friends and invitations and messages.
4 → User wants to send or view messages
-> Already open conversation
-> Creating a new conversation -> group - user select the members he wants to add - click on add - the conversation is created and the members are notified - now anyone can join and exchange messages -> individual - user select the friend - click on it - the conversation is created and the friend is notified - now the users can exchange messages
6.1.2. Second Scenario : Login Process
Login flowchart
Login runtime view in details
When entering the webpage, there are two possibilities :
1 → the user’s already logged in or connected in solid.community/ for example
2 → the user’s not logged in, the user nust click on Login
-> If the user has an account - click on the provider and fill the login form.
-> If the user doesn't have an account - there is the possibility to register and create a personal POD. - Login using the entered informatin in the register process.
3 → the app will load automatically all the user’s data including the conversations, friends and invitations.
4 → now the user is in the main UI.
6.1.3. Third Scenario : User A Sends Message to User B
Sending messages Flowchart
sending messages in details
In the case of an already open conversation, the user User A selects it and decides to send a message to his friend User B
1 → User A send the messages.
2 → The app places this conversation for User A in the first place.
3 → User B receives it and the app places the conversation in the first place with a notification.
4 → The UI view is updated for User A and User B with the message sent.
7. Deployment View
7.1. Motivation
It was established as an early constraint that SOLID was to be used as the basis for our communication app. Thus, its presence in the infrastructure as the final step for data management is not a surprising view. However, we did decide to go for a Web Application, since a) we had the most resources to take as guidance, b) it provides ease of usage for the average user and c) GitHub provides an option to serve our web app. Hence, the presence of the Web Server and Web Browser blocks in the infrastructure.
As it has been stressed previously, its web server may be found at https://arquisoft.github.io/dechat_es6a2/, thanks to GitHub Pages feature. A secondary approach is provided, given the circunstances ask for it: after having cloned the repository, the user may run the command http-server at root directory; he will be provided with some IP directions to access (it is mandatory to add "/src" to the URL).
7.2. Mapping
Previously defined building blocks are always deployed the same way: a file is generated through the processing of ChatController, an action which in cascade maps all involved classes into a main.js file, with all of the Node dependencies solved. This file is linked to the View (index.html) as an script, so that related code is executed by the browser of choice in response to user’s actions on the presentation layer.
8. Cross-cutting Concepts
8.1. Concepts Mind Map
8.2. Concepts Detailed
8.2.1. User Experience concepts (UX)
The user interface is for the moment only available in English and it’s inspired and that’s because we want to the user to feel at ease and use a familiar UI instead of complicating it.
8.2.2. Safety and security concepts
The main objective of this whole app and Solid Specs is to ensure the security of the user by choosing the person who he’d like to speak and not having to worry about his data stolen because as we know, the messages and data shared is stored in his private pod and no one will see it except him.
8.2.3. Architecture and design patterns
The application is in main.js and it is managed by the ChatController.js which uses additional libraries and services included in the lib/ folder.
8.2.4. "Under-the-hood" Concepts
-
Persistency :
-
Transaction handling :
-
Exception and error handling :
-
Reporting :
8.2.5. Development concepts
-
Build
-
Test
-
Deploy
9. Design Decisions
9.1. Design Decisions Mind Map
9.2. Design Decisions Detailed
9.2.1. Chat Storage
Firstly, a decision had to be taken about the approach to data storage; two options were available for us.
Either we stored chat data at one of the interlocutors' POD (chat creator, presumably) or we stored the data at both sides.
The former required of some permission system to allow other users to access the host’s private folder, but reduced work volume by limiting storage to one user, instead of 2+.
However, we opted for the latter, since we consider that data being in custody of all participants was both a fairer deal for the parts involved as well as preferable to data integrity and fault-tolerance. This requires some more resources to proceed with the operations, but it doesn’t affect the user experience since the visual showing is done independently.
9.2.2. Encryption
We decided to encrypt all data stored at a POD, for we learned that they might not be as secure as one would like.
Hence, we created a simple encryption system which, actually, is nothing more than the combination of two popular ones: Enigma -which nowadays does not provide much, but serves as a signature of our work- and AES, which provides true security to the system.
We thought about making the encryption process invisible to the user, by autogenerating a password and storing it at the POD. However, this does not solve much, in the end, since if an attacker gains access to the container he’d have no trouble accessing the data. Therefore, we opted for a password input by the user after logging in, which is less conspicuous, but improves its security considerably. Besides, it allows for multiple encryptions at one POD, which work independently.
Salt is added to every field encrypted, so that two identical texts -commonly, users- are not revealed. Such salt is stored along the encrypted info, as it is conventional.-
Whereas every information stored at a private folder is locked by the chosen password, a decision had to be made about the data sent by one interlocutor and received by the others at the inbox, since they would need to agree a common password to work with it. To avoid making the system harder to use -a password would have to be established for every chat-, it is handled automatically and without affecting the user, by appending the key to the message.
Obviously, this makes it decryptable, if someone really wishes to do so. Since it is a temporal operation, it is a window of insecurity within the system. However, there is no time to implement a more complex system; its purpose is that of making it unintelligible for the casual, non-desirable visitor.
It’d be fine to improve it for the far future, though.
9.2.3. Front End
To design the UI and offer the best UX possible, we are using HTML and CSS and Bootstrap in addition to jQuery.
We chose to mix a popular chat UI style -in order to make it familiar and intuitive to new users- with a retrowave feel for a more unique touch. A set of random, slightly inspirational phrases is shown while chat is loading, so that the user is somewhat entertained for the duration of the process.
9.2.4. Back End
Moving to the functionality part, we are using basically JavaScript and Node.JS to manage dependencies and libraries such as n3 and Q to work with RDF and Linked Data.
Code was organized into sets of classes such as Services and Repositories to improve its clearance of purpose and maintenance ease. Such estructure has already been detailed at previous chapters, so we shall not explain it any further.
For the testing part, we are using mocha and nyc for unit tests, and cucumber-selenium for BDD tests.
9.2.5. Persistence and Data Storage
Following Solid specifications, all the data shared between users are private and stored in their respective POD.
9.2.6. Continuous Integration
We are using Travis for running the tests and checking the correct build of our app, Coveralls for code coverage to make sure of not forgetting any part of app and Code Quality .
10. Quality Requirements
10.1. Quality Tree
10.2. Quality Scenarios
11. Risks and Technical Debts
11.1. Problems Mind Map
11.2. Problems Detailed
11.2.1. Solid
Solid is a whole new world for us and it took us a while to adapt its specifications and functionality to our project.
11.2.2. JavaScript and Node.JS
Although we used JavaScript many times in the past but it was very difficult adapting to this language and managing node libraries as well as what dependencies and versions to choose.
11.2.3. Libraries
There aren’t much libraries to manage Linked Data and RDF resources and SPARQL and it was difficult to find them and use them but with time we got used to it.
11.2.4. Security and Confidentiality
We had to make sure all data stored in the user’s pod are encrypted. Therefore, we had to search an original and secure way to do it.
11.2.5. BDD
We have never used Cucumber and we are new to the Behavior-Driven Development world, so it took us a few days to learn how to use it with Node and adapting it to Travis to build our app.
11.2.6. Deployment
We were originally goint to use Docker to deploy our app. Howerver,at the end, we decided to use gh-pages for simplicity.
12. Glossary
Term | Definition |
---|---|
Arc 42 |
Template divided in 12 sections for architecture communication and documentation. |
Bootstrap |
is the most popular CSS Framework for developing responsive and mobile-first websites. |
BDD |
Behaviour-Driven Development is is a software development approach. its tests are written in a shared language, which improves communication between tech and non-tech teams and stakeholders. |
chai |
BDD assertion library used with Mocha and other JavaScript test frameworks. |
CI |
Continuous Integration is the process of automating the build and testing of code every time a team member commits changes to version control |
Code Coverage |
It is a measurement of how many lines/blocks/arcs of your code are executed while the automated tests are running. |
CSS |
Cascading Style Sheets describes how HTML elements are to be displayed |
cucumber |
It is a tool that supports BDD. It offers a way to write tests that anybody can understand, regardless of their technical knowledge. |
Decentralized Web |
it refers to a series of technologies that replace or augment current communication protocols, networks, and services and distribute them in a way that is robust against single-actor control or censorship. |
Docker |
is a tool designed to make it easier to create, deploy, and run applications by using containers. |
FOAF |
Friend Of A Friend is an RDF based schema to describe persons and their social network in a semantic way (in links to put it in simple words). It could get used within many wikis for annotating user pages, or describing articles about people. |
HTML |
is a computer language devised to allow website creation. These websites can then be viewed by anyone else connected to the Internet. |
JavaScript |
is the Programming Language for the Web. it can update and change both HTML and CSS OR calculate, manipulate and validate data. |
Linked Data |
it is used to describe a method of exposing and connecting data on the Web from different sources. Currently, the Web uses hypertext links that allow people to move from one document to another. |
Mocha |
JavaScript framework to run asynchronous tests on Node.js. |
n3 |
is a node dependency that lets us handle RDF in JavaScript easily. |
Node.JS |
is an open source server environment that uses JavaScript on the server. |
nyc |
is a JavaScript test coverage tool. |
POD |
Personal Online Data is where all the data is stored Photos or Videos you take, comments you write, contacts in your address book, calendar events,…etc. You give people and your apps permission to read or change them. |
POD Provider |
is a Person or Company that has one or more solid pod servers and uses them to store/host data. |
POD Server |
Server that allows the application store POD information on it. |
Profile |
is all the information related to the user including the full name, phone number , personal inbox , storage,…etc. |
Q |
is a node module that manipulates Promises instead of objects in JavaScript. |
RDF |
Resource Description Framework is a specification that defines how metadata, or descriptive information, should be formatted. This means the data can be transmitted in various syntaxes like JSON-LD (JSON with a "context") |
Selenium |
is a portable framework for testing web applications. It provides a playback tool for authoring functional tests without the need to learn a test scripting language. |
Solid |
Social Linked Data is a proposed set of conventions and tools for building decentralized Web applications based on Linked Data principles. |
SparQL |
is the standard query language and protocol for Linked Open Data on the web. |
Stakeholder |
is a person or group of people with an interest or concern in something, in this case, this project. It can be a technical or non technical user, a company, developers or even , in our case, our professor . |
Travis |
is a hosted, distributed continuous integration service used to build and test software projects hosted at GitHub. |
User |
is a person who uses/owns a Solid Pod. |
WebID |
is a standardized method for internet services and members to know who they are communicating with. |