Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd authored Jan 11, 2024
1 parent a288b1b commit 9d8f55f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/BHoM_oM/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Properties correspond to the information you need to define your object (to the

- All properties must be public and have a public get and set methods, written `{get; set;}`. (This means that `readonly` properties are not directly allowed - see paragraph below "Immutable Objects" if you want to know more).
- Make sure you provide a default value X for your properties by using `= X;` at the end of their definition; If a properties is too complex to be defined that way, simply set it to null (write `= null;` at the end).
- Property names should not contain redundant information, for example, repeating the type of the property in its name. A property of type `Node` for example should not have `Node` in the property name unless it is the only name of the property. E.G. a property set up as `Node StartNode` should only be called `Start`, as the `Node` element comes from the property type - the better implementation of this is `Node Start`. This prevents duplication of information in the properties.

As objects grow in complexity, it is useful to think in terms of splitting an object's properties into categories:
1. Object _**Defining**_ properties. The minimal required information you need to construct the full object.
Expand Down Expand Up @@ -253,4 +254,4 @@ public class Node : BHoMObject
```
As you can see, we can skip the step of creating a Node since it would only need the Point anyway.

Unfortunately, C# doesn't allow to define this outside the class so we have no choice but to do it in the BHoM. Be mindful that this is only relevant when an object could be created from a single other element so this only apply in unique cases and shouldn't be defined in every class.
Unfortunately, C# doesn't allow to define this outside the class so we have no choice but to do it in the BHoM. Be mindful that this is only relevant when an object could be created from a single other element so this only apply in unique cases and shouldn't be defined in every class.

0 comments on commit 9d8f55f

Please sign in to comment.