server icon indicating copy to clipboard operation
server copied to clipboard

Refactoring the Startup.cs and Program1.cs

Open Freezor opened this issue 11 months ago • 3 comments

Description

This PR aims to refactor the Program1.cs and Startup.cs files in the project. The original files were confusing and did not adhere to Clean Code or SOLID principles, making it difficult to understand the server's behavior. The changes are intended to improve clarity and maintainability, as well as to lay the groundwork for future enhancements.

Motivation and Context

The motivation behind this change is to enhance the codebase by following best practices and establishing a clearer structure. By refactoring the code, we aim to improve understanding, maintainability, and scalability of the project.

This PR includes the following changes:

  • Renamed Program1.cs to BlazorServerStarter for better readability and to avoid confusion with the existing Program class.
  • Cleaned up BlazorServerStarter to simplify the understanding of the server initialization process.
  • Extracted dependency registration into DependencyRegistry.cs and server configuration into ServerConfiguration.cs from Startup.cs.
  • Refactored ServerConfiguration.cs into smaller parts, adhering to Clean Code and SOLID principles.

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

These changes have been tested locally by running the application and verifying that it starts up successfully without any errors. Additionally, manual inspection of the refactored code has been performed to ensure correctness and adherence to the intended changes.

Screenshots (if appropriate):

N/A

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [ ] I have added tests that prove my fix is effective or that my feature works -> Impossible to write tests here at this moment as I would first need to refactor more in order to have good quality tests, which also is a pain point that I'm not able to do that here right now.

Freezor avatar Mar 26 '24 09:03 Freezor

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 26 '24 09:03 CLAassistant

Hi @juileetikekar thanks for the review, but I'm still not able to merge. Can you help me with that?

Freezor avatar Apr 02 '24 05:04 Freezor

Hi @Freezor,

Thank you very much for the PR.

However, in my opinion, there are some checks missing in the PR. I have already asked @martafullen and @AlexanderWollbrink to look into it. In summary, I am waiting for their response, before I merge the PR into main.

juileetikekar avatar Apr 02 '24 09:04 juileetikekar