-
Notifications
You must be signed in to change notification settings - Fork 16
Coding Style
Our coding style generally follows the Microsoft guidelines:
https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/
https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/classes-and-objects
https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/types-and-variables
Although, to guarantee a high level of clarity and transparency, we also follow some additional rules.
- A
.cs
file can contain only 1 (one)class
, and there is no concept as aHelper
orUtils
class. - The name of the
.cs
file is the Name (excluding the namespace) of the class, e.g. theLine
class is in theLine.cs
file - For methods, a file can only contain methods whose name is the same as their file, e.g.
Flip(Line line)
andFlip(Arc arc)
are in the same fileFlip.cs
. As a corollary,RandomFlip
cannot lie in theFlip.cs
file, and must have aRandomFlip.cs
file by its own.
Namespaces and the folder structure that contains the .cs
files have a close relationship. To define the correct folder structure helps keeping the relationship with the namespaces. This, in turn enables additional functionalities, such as deriving the web address of the source code of a method.
For a class
, an Attribute
, and Enum
, an Interface
, the folder structure respects the following rules:
-
If a file is in a sub folder, the namespace of the entity must follow: if
Bar
is in a sub folderElements
, its namespace must suffix theElements
wordBH.oM.Structure.Elements
. -
An
Enum
must be in a separate folderEnums
. Although, the namespace remains unchanged, and does not follow - i.e.Enums
is appended as suffix. For exampleBarFEAType
is in the sub folderElements
, and it is anenum
. Its namespace respects A., so it contains theElements
word, but does not contain theEnum
word: BH.oM.Structure.Elements. At the same time, since it is anEnum
it is in anEnums
folder. -
The same rule as B. applies to:
-
Attribute
=>Attributes
-
interface
=>Interfaces
-
-
Introduction to the BHoM:
What is the BHoM for?
Structure of the BHoM
Technical Philosophy of the BHoM -
Getting Started:
Installing the BHoM
Using the BHoM
Submitting an Issue
Getting started for developers -
Use GitHub & Visual Studio:
Using the SCRUM Board
Resolving an Issue
Avoiding Conflicts
Creating a new Repository
Using Visual Studio
Using Visual Studio Code -
Contribute:
The oM
The Engine
The Adapter
The Toolkit
The UI
The Tests -
Guidelines:
Unit convention
Geometry
BHoM_Engine Classes
The IImmutable Interface
Handling Exceptional Events
BHoM Structural Conventions
BHoM View Quality Conventions
Code Versioning
Wiki Style
Coding Style
Null Handling
Code Attributes
Creating Icons
Changelog
Releases and Versioning
Open Sourcing Procedure
Dataset guidelines -
Foundational Interfaces:
IElement Required Extension Methods -
Continuous Integration:
Introduction
Check-PR-Builds
Check-Core
Check-Installer -
Code Compliance:
Compliance -
Further Reading:
FAQ
Structural Adapters
Mongo_Toolkit
Socket_Toolkit