View Page Source

Revision (current)
Last Updated by Randomno on 7/2/2023 10:49 AM
Back to Page

The TASVideos website is [https://github.com/TASVideos/tasvideos|open source] and contributions are encouraged. However, certain coding standards should be followed.  This page documents the guidelines around code style, architecture, and approach the site code uses.

!! Code Style

Code should be warning free.  Stylecop is integrated and many style requirements are enforced through its use of warnings. For the most part, the site follows the same conventions as the [https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions|dot net team] with one important deviation, use tabs and not spaces.

While not a comprehensive list, here are some are some style guidelines:
*method parameters should be camelCase, properties should be ProperCased, and private field variables should begin with an underscore and _camelCased
*dependencies should be interfaces where feasible, and interfaces names should always begin with I
*use tabs, not spaces

!! Architecture
*The site utilizes [https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-6.0&tabs=visual-studio|Razor Pages] and server side rendering
*Pages that general users can access should fallback gracefully if javascript is turned off
*Vanilla javascript, no frameworks
*We use [https://learn.microsoft.com/en-us/ef/|Entity Framework] for data access. Sql implementation specific technologies (include straight sql queries) should be avoided where possible (the one notable exception is the search utilizes postgres full-text search capabilities)
*Since pages are scoped already, it's okay to have an EF context directly in the page model.  However, where there is opportunity to abstract or reuse logic, a class and interface in the Core library is favored.
*Simplicity is the key.  Site contributions are from hobbyists and volunteers, and should be understandable by such
*Wiki modules are implemented using [https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-components?view=aspnetcore-6.0|View Components]