NEWS COMMUNITY STORE TUTORIALS ROKOJORI ACTION LIBRARY SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS ROKOJORI ACTION LIBRARY TOGGLE FULLSCREEN VOLLBILD AN/AUS image/svg+xml image/svg+xml image/svg+xml CODING GUIDE LINES
Rokojori Action Library
image/svg+xml image/svg+xml Rokojori Action Library image/svg+xml






Coding Guide Lines Scope
The guide lines are valid for any programming languages, unless something is explicitly stated.



BRACKETS ON NEW LINE
All brackets should be placed on a new line and not at the same line.
BRACKETS ON NEW LINE
All brackets should be placed on a new line and not at the same line.
CAMELCASE
The default is in lowercase and camelcase. Only the following start with an uppercase: class names, const/static/readonly members and only in C#: methods.
CAMELCASE
The default is in lowercase and camelcase. Only the following start with an uppercase: class names, const/static/readonly members and only in C#: methods.
TABS ARE TWO SPACES
Never use real hard tabs use always soft tabs with two spaces.
TABS ARE TWO SPACES
Never use real hard tabs use always soft tabs with two spaces.
SPACE FOR OPERATORS & BRACKETS
All operators should have spaces, brackets after openers and before closers.
SPACE FOR OPERATORS & BRACKETS
All operators should have spaces, brackets after openers and before closers.
NO PARAMETRIC CONSTRUCTORS
Don't create constructors that hide the no-parameters constructor. Use static functions with meaningful names for instance creation. In most languages the best way is to not define any constructors.
NO PARAMETRIC CONSTRUCTORS
Don't create constructors that hide the no-parameters constructor. Use static functions with meaningful names for instance creation. In most languages the best way is to not define any constructors.
EARLY EXIT
Avoid nesting conditional statements and return/continue/break early when possible.
EARLY EXIT
Avoid nesting conditional statements and return/continue/break early when possible.
SHORT FUNCTIONS
Avoid deep and long functions with lots of instructions and inline documentation. Just put a logical block into a function and give it a meaningful name.
SHORT FUNCTIONS
Avoid deep and long functions with lots of instructions and inline documentation. Just put a logical block into a function and give it a meaningful name.
NO PRIVATE
Don't make anything private - only protected. Don't use setters/getters that don't do anything. Everything can be public. Only stuff that really needs to be or will change in the future should be protected, most likely the following rule is better.
NO PRIVATE
Don't make anything private - only protected. Don't use setters/getters that don't do anything. Everything can be public. Only stuff that really needs to be or will change in the future should be protected, most likely the following rule is better.
UNDERSCORE PREFIX MEMBERS
Rather use public members with an underscore prefix, when things are mainly used internally, or could change or are hard to understand. Underscores mean: "Please check/ask the doc/contributors for this variable or don't use it when you are not certain"
UNDERSCORE PREFIX MEMBERS
Rather use public members with an underscore prefix, when things are mainly used internally, or could change or are hard to understand. Underscores mean: "Please check/ask the doc/contributors for this variable or don't use it when you are not certain"
AUTOMATIC TYPES
Use auto in C++ or var in C# when possible.
AUTOMATIC TYPES
Use auto in C++ or var in C# when possible.
NON-NULLABLE CLASSES ARE EVIL
Don't use non-nullable classes whenever possible. There was a reason null was invented 2000 years ago ;)
NON-NULLABLE CLASSES ARE EVIL
Don't use non-nullable classes whenever possible. There was a reason null was invented 2000 years ago ;)
LEFT-HAND CONST IN COMPARISON
In comparisons, a const value should be on the left, the variable on the right. The only exceptions are null/undefined checks, they should always be right.
LEFT-HAND CONST IN COMPARISON
In comparisons, a const value should be on the left, the variable on the right. The only exceptions are null/undefined checks, they should always be right.
AVOID SWITCH
Try to use if- and else-if-branches instead of switch.
AVOID SWITCH
Try to use if- and else-if-branches instead of switch.
INITIALIZE
Try to give all members initial values.
INITIALIZE
Try to give all members initial values.




C#
public class MyClass { [Export] public string name = ""; [Export] public int value = 0; public List<string> data = []; public static MyClass Create( string name, int number = 1 ) { var mc = new MyClass(); mc.name = name; mc.value = value; return mc; } public void doStuff( string command ) { if ( command == null ) { return; } if ( "set" == command ) { value = 1; } else if ( "set:3" == command ) { value = 3; } else if ( "data:4:x" == command ) { data[ 4 ] = "x"; } } }
TYPESCRIPT
export class MyClass { name = ""; value = 0; data:string[] = []; static create( name:string, value:number = 1 ) { let mc = new MyClass(); mc.name = name; mc.value = value; return mc; } doStuff( command:string ) { if ( command == null || command == undefined ) { return; } if ( "set" == command ) { this.value = 1; } else if ( "add:3" == command ) { this.value = 3; } else if ( "data:4:x" == command ) { this.data[ 4 ] = "x"; } } }
PHP
class MyClass { public string $name = ""; public int $value = 0; public array $data = []; public static function create( ?string $name, int $value = 1 ): MyClass { $mc = new MyClass(); $mc->name = $name; $mc->value = $value; return $mc; } public function doStuff( ?string $command ): void { if ( $command === null ) { return; } if ( "set" === $command ) { $this->value = 1; } else if ( "set:3" === $command ) { $this->value = 3; } else if ( "data:4:x" == command ) { $this->data[ 4 ] = "x"; } } }



All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...