-
-
Notifications
You must be signed in to change notification settings - Fork 6
Coding Standards
Here you will find some documentation on the coding standards to follow for this specific project.
We are actively trying to avoid the use of hardcoded values spread all around the code, instead, we have used the approach of a Constants class, in the Common project, any constant value needs to have a constant defined in some of the subclasses.
As part of generating a differentiated code signature we are purposely avoiding having member variables prefixed with "_", instead class will have private properties named using PascalCase.
All class properties must be private.
The names of variables and properties must specify what the variable contents are: e.g. videosList, userVideos, etc.
- The methods must be named using a verb, e.g. "GetUserVideos"
- The methods must always have the parameter CancellationToken cancellationToken, as the last parameter.
- For small endpoints prfer using Minimal APIs.
- The methods must always have the Http Verb Attribute, with "[action]", so that the endpoint is generated with the same name of the method:
- [HttpPost("[action]")]
- [HttpPut("[action]")]
- [HttpDelete("[action]")]
- [HttpGet("[action]")]
- use a ClientService class in the "{MainProject}.ClientServices" project, use the same prefix than the one used in the Controller for a name
- Generate the client using Kiota.
- Components that load data must have the "Loading" component so that the spinners are shown while data is being load.
- Razor pages will have the following order
-
@page
-
@attribute
-
@implements
-
@using
-
@inject (of interfaces)
-
@inject (of classes)
-
Main html code
-
@code section
Check FairPlayTube's Home Page
-
- Tables must not contain more than 20 columns, if a table is about to reach that many columns, chances are many columns can be converted into an "AdditionalAttributes" kind of table.
- All async methods( except the endpoints ) must be suffixed with Async
- All aynsc methods must received a mandatory "CancellationToken cancellationToken" as the last parameter
- When invoking a method, used named parameters.
- No usage of mocking nor fakes libraries
- Services tests classes will map 1 to 1, a test class for a test service
- Services test methods will be named in the format "Test_{ServiceMethodName}"
- Each test will create each of the required objects to pass to the service constructor
- Each test will create all of the required data
- Each Test class file will clean the test data through the [TestCleanup] methods
Fund the project today: Become a GitHub Sponsor
- Home
- Business Ideas
- Who Could Benefit from the "FairPlay" platform?
- Technical Information
- Developers Guides
- FairPlayCombined Applications
- FairPlayDating
- FairPlayTube
- How to setup FairPlayCombined?
- How to deploy FairPlayCombined?
- How to troubleshoot FairPlayCombined?
- Tutorials
- Entrepreneurship Guides
- Improve Your Website SEO
- Upgrading Strategy