Skip to content

Commit 92c8dad

Browse files
committed
docs: solution strategy
1 parent 164ce39 commit 92c8dad

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/src/04_solution_strategy.adoc

+26-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,32 @@ Pull Requests were the main method of contributing to the project, these needing
6060

6161
Regarding the code style, we must make two important distinctions: the frontend and backend. In the latter, we will mainly use Object-Oriented Programming because our language of choice is Java, which strongly favours it. Regarding the former, it will be more of a case-by-case approach, as for instance, OOP-oriented React is deprecated in favor of a functional approach, but sometimes we may need OOP's strengths.
6262

63-
* In the backend, the structure will be that of a typical Maven project.
63+
==== API
64+
In the backend, the structure will be that of a typical Maven project, using different packages for different modules of the project:
65+
66+
* The `auth` package is used for *authentication* related endpoints and configuration.
67+
* The `game` package is used for *game* related endpoints and logic
68+
* The `questions` package is used for *question* related endpoints and logic
69+
* The `statistics` package is used for *statistics* related endpoints and logic
70+
* The `commons` package is used for common logic that may be used among different packages, such as *utils* classes or *user* logic.
71+
72+
In each of this packages, the following structure is followed:
73+
74+
* The `dtos` package stores *Data Transfer Objects*, used for sending or receiving data
75+
* The `mappers` package stores classes used for mapping from *models* to *DTOs* or vice versa.
76+
77+
In our Spring Boot project the following structure is found in each of our modules, following a Domain Driven Design approach:
78+
79+
* A `Controller` handles the requests done to our API.
80+
* A `Service` handles the retrieval of the *Models* from the database using *Repositories*.
81+
* A `Model` is retrieved and handles its domain logic.
82+
* A `Repository` is used for retrieving *Models* from the database.
83+
84+
A crucial part of the design is that the models are the ones handling the logic, as described in Jimmy Bogard's talk: https://www.youtube.com/watch?v=UYmTUw5LXwQ
85+
86+
With regards to testing, a Test First approach was employed when possible, and the logic of the *Models* and the *Services* was tested, as well as the responses given by the *Controllers* in different situations.
87+
88+
==== Frontend
6489
* In the frontend, the structure will be quite different:
6590
** The `src/components` will contain single components which we may reuse.
6691
** The `src/pages` will contain the endpoints and will follow a simple structure. For instance, given a `/statistics/personal` and a `/statistics/general` endpoints, both will be independent React components that will return the page and be placed under the `src/pages/statistics` folder.

0 commit comments

Comments
 (0)