Defensive Programming

From Resonite Wiki
Revision as of 10:05, 17 July 2024 by AmasterAmaster (talk | contribs) (Created a page for defensive programming in resonite.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Defensive Programming is the abstract concept of writing code to prevent bugs from happening and preventing security breaches from what a user would input. This is in reference to an article on Defensive Programming on Wikipedia, but is implemented differently in a Resonite context.

When using ProtoFlux for your projects, you may run into an issue where something unexpected will happen when another user tries to use your created item, object, or world. These unexpected occurrences may lead to your code breaking, revealing sensitive information, or some other unfavorable event or action.

Strategies

User Input Checking

Using strings in a text field may give any user a chance to put in wrong information into the field (i.e. Typing a letter instead of a number in a text field, which may break code that only wants a number).

To check against that, using the Parse node's IsParsed field to check if that user's input is correctly parsed. Also using the Is Digit node can be just as effective when checking.

See Also