DEV Community

Discussion on: Understanding MVC-Services for Frontend: VanillaJS

Collapse
webdevken profile image
Web Dev Ken

I just stumbled upon your post and carefully studied your code. I think your code is well structured and organized, from the folder structure to the code itself. The namings are good that not even code documentation is needed. I enjoyed reading your code!

However, I would like to add some further thoughts to it. These are by no means criticism:

  • In the User class, the member function uuidv4 could be outsourced in order to use it for future use cases
  • I see you always map the users list in all cases, having a small number it probably doesn't affect the performance, but once 10000 users or more are stored, it might lead to some performance hickups, especially when getting to the limits of the local storage
  • There are no tests, e.g. there are no unit tests for the controller or the service
Collapse
webdevken profile image
Web Dev Ken • Edited on

Another remark is that the id in the user class gets always re generated, even after reading an existing user from the local storage. So you can't rely on a particular user in this case.