Update bad practise section
This commit is contained in:
parent
36d4b9e555
commit
5c2fe02c4e
1 changed files with 1 additions and 2 deletions
|
@ -11,8 +11,7 @@ Before you write any code, you should decide wheneter to write your code as a mo
|
||||||
|
|
||||||
## Bad practise
|
## Bad practise
|
||||||
Before we finally come to some code, never avoid these things while writing a custom module:
|
Before we finally come to some code, never avoid these things while writing a custom module:
|
||||||
- Access hardcoded classes, scripts, assets, etc. from your project. Use arrays and dictionaries aswell as get(), set() and other functions for that.
|
- Depend on your project code. Modules are intended to be project independent and work in every environment where CORE runs. If you need to access some asset or scene, use a variable to store the path.
|
||||||
- Depend on your project code. Modules are intended to be project independent and work in every environment where CORE runs.
|
|
||||||
- Never crash the entire framework on invalid user input, only crash when an internal error occurred. \
|
- Never crash the entire framework on invalid user input, only crash when an internal error occurred. \
|
||||||
Let's say that you have two functions: An internal `_display_scene` method and a `transition_between_scenes` method. \
|
Let's say that you have two functions: An internal `_display_scene` method and a `transition_between_scenes` method. \
|
||||||
When the developer calls `transition_between_scenes` and supplies an invalid object to the method, you should call `logger.error` (and return the error) as the error comes from the developer and should be handled by the developer's code. \
|
When the developer calls `transition_between_scenes` and supplies an invalid object to the method, you should call `logger.error` (and return the error) as the error comes from the developer and should be handled by the developer's code. \
|
||||||
|
|
Loading…
Reference in a new issue