Apmannen / MichaelKjellander

Upcoming michaelkjellander.se site. WORK IN PROGRESS. Built with Blazor (.NET/C#), using the Wordpress API to fetch all existing posts and pages from the old (current) site. Tailwind is used for styling.
https://new.michaelkjellander.se/
0 stars 0 forks source link

Clarify each class' and layer's responsibility and relationships to other layers #31

Open Apmannen opened 3 months ago

Apmannen commented 3 months ago
Apmannen commented 2 months ago

Should also comment what every directory's responsibility is. This is the structure I have in mind at the moment, but it's not fully finalized.

Skärmbild 2024-06-17 100434

https://docs.google.com/presentation/d/1dLPUZMCz4Qs986NKqG-_TKJNOmn4RRrZfc1GUctCZqc/edit?usp=sharing

Apmannen commented 2 months ago

Maybe merge util and tools? Otherwise, they need a clearer distinction.

Apmannen commented 2 months ago

I think tools should be independent from the rest of the system, but could be used by most other layers

Apmannen commented 2 months ago

https://learn.microsoft.com/en-us/aspnet/core/blazor/call-web-api?view=aspnetcore-8.0

To follow the examples here, a service could be called ClientBlogService with HttpClient as parameter. Will not be called from the client though, but from the SSR razor-pages.

Then the controller could call a ServerBlogService to get items from the DB.

Apmannen commented 2 months ago

Suggestion: rename Component to Views and its related utils/tools/services (ViewServices, ViewUtils).

Or put Components inside a root Views folder and also have services etc. in that Views folder.

Apmannen commented 2 months ago

I think the popular Clean Architecture example strucutre would suit my project. https://github.com/jasontaylordev/CleanArchitecture/tree/main/src

I think it would suit my project better than the Vertical Slice architecture and the current struture is similar, even though it would be interesting to try out both. The point of this project is to experiment and try out different architectures after all.

A src/Source directory would be benificial either way to keep startups, Files and Scripts

ApiResponse would fit in domain, while the models (called Entities in the link) could be a subdirectory.

Controller could be in a Api parent directory.

I still like the name Communicator, I think it makes the responsibility more clear. Translation Service is not just a communicator though, but maybe that's the problem?

Btw, I'm not sure why I write in English when the site is 100% Swedish.

Apmannen commented 2 months ago

I should remove ApiUtil. Maybe call it ApiClient? Or have an abstract generic ApiServer/Communicator