Logo Sapienza Logo Sapienza Gamification Lab

WASA - Web and software architecture

Frequently Asked Questions

1. Is this course in English?

The course will be in English. I can accept the Italian language in oral examinations for Informatica students (not Acsai).

2. Are online lessons available on Zoom or Google Meet?

No. Lessons are only in person. Aula 2L via del Castro Laurenziano

3. Will you make available recordings?

Some recordings will be available on the website.

4. Does the Unitelma course “Programmazione per il web” cover the same topics?

Yes.

5. How can I follow this course and another at the same time

Unfortunately there are overlapping courses. I will provide slides before each lesson and recordings of some lessons. Anyway, I strongly suggest to follow this course in person.

6. Where can I find the deadlines for homework?

There are no deadlines. Please read the exam page for further information.

7. Can I use GitHub Copilot (or similar tools)? What about Swagger code generator?

No, you can’t use GitHub Copilot or any code generator, they are known for injecting bugs that you might not aware of. You can use IDEs with “IntelliSense” functionality (method/variable names suggestions, error checking, etc.).

8. Can I copy the code from the internet?

No. But you can look at it if you need some ideas. No 1:1 copy is allowed (variable/method renames count as 1:1, of course).

You can copy code snippets for utilities (things that are not part of your homework, like some test applications) from the internet. Please check their license first.

9. I already finished the current homework, can I start the next one?

We strongly advise against it. Please start homeworks at the end of each part.

10. Can I replace framework/library X with Y in the Fantastic Coffee (decaffeinated) template?

No. You can add libraries, but you must use the template (and current libraries, like for example Go httprouter and Vue.js) as a starting point for your homework.

11. How can we implement the login API without cookies? Can I use JWT/tokens as a user identifier? How do we manage the “HTTP session”?

There is no HTTP session. There are plenty of ways to implement the “simplified login” without using cookies. If you’re at homework 1, just trust the project document. If you’re at homework 3, re-read the slides and materials again to understand why.

12. The Swagger editor doesn’t show any error; why the evaluation says that my OpenAPI document is invalid?

Automatic evaluation tools are not perfect. Tools are often limited; for example, the Swagger Editor does not support validating semantic errors, like loops in definitions, or some syntactic errors, like those in $refs.

If our evaluation says the document is invalid, please recheck your document against YAML and OpenAPI specifications. In particular, errors are often in $ref (invalid types, non-existing destinations, loops, etc.).

13. Can I use another DB engine, like MySQL/Postgres/etc.?

No. You can either use SQLite, or implement a database using maps and slice.

Note that, if you’re implementing a DB using maps and slices, you need to manage the concurrent access (i.e., use Mutex or other synchronization primitives).

14. Can I use Go Generics?

No.

15. My build works when I use npm run dev, however there is a Javascript crash in my grading notes that I can’t reproduce

There are some errors in the code, however they are somehow ignored by vite when used in development mode (e.g., npm run dev). Refer to the README in the Fantastic Coffee (decaffeinated) project for details on how to solve these: https://github.com/sapienzaapps/fantastic-coffee-decaffeinated#my-build-works-when-i-use-npm-run-dev-however-there-is-a-javascript-crash-in-productiongrading

16. I have an “Axios error” in the evaluation, but I can’t reproduce it.

To evaluate your homework, we may start the frontend and the backend in two different machines using different IPs and ports. You should not restrict the CORS Origin (leave it set to *), and keep the __API_URL__ constant unmodified (file webui/vite.config.js).

17. Can I update the Go language version from 1.17 to a different version?

No. You must use go 1.17 in the go.mod source file. However, you can still use newer versions, such as Go 1.21, for compilers and command line tools (new compilers are able to compile old source versions).

18. I use SQLite, and foreign keys constraints are ignored!

Short answer: in the cmd/webapi/main.go, replace the line:

dbconn, err := sql.Open("sqlite3", cfg.DB.Filename)

with

dbconn, err := sql.Open("sqlite3", cfg.DB.Filename + "?_foreign_keys=1")

Long answer: foreign keys constraints are disabled by default in SQLite for compatibility reasons. They must be enabled manually if you need them.

Note that db.Open() returns a connection pool (not a single connection!), so you cannot safely issue the SQL statement PRAGMA foreign_keys = ON as indicated in the SQLite documentation because, in that case, you may end up executing the statement in only one connection of the pool.

TL;DR: a “connection pool” is a set of pre-established connections to the database. When some code execute a statement, the one connection is picked randomly from the pool and the statement will be executed there. Then, the connection is returned to the pool.

They are used for a number of reasons - mostly, performance. Go automatically manages a connection pool for database connections.

The solution, as stated above, is to add a parameter for the go-sqlite3 library to automatically issue the PRAGMA statement for each connection of the pool.