xsharp.eu • Coding Constructs
Page 1 of 1

Coding Constructs

Posted: Sat Feb 08, 2020 3:16 pm
by TerryB1
I don't know if the following has any value in an XSharp environment, but just in case:

Some coding constructs in C# can be used for more that one purpose. For example the try/catch constructs.

Used to catch errors - fine, but the point is such errors may be genuine, unexpected errors, or expected errors used for a specific purpose.

It is the case that program code (managed) can be simplified, and made statistically more efficient, if pre-checking for errors is ignored on the basis that if, and only if, an error is raised, does it need to be rectified.

Communicating this via program code could be simple: instead of try/catch, a simple alternative option guess/if wrong, would suffice.

In the short term this would, I think, help developers to better understand their code in the future.

In the longer term it would make automated checking of code integrity, automated ensurance of documentation accuracy and possibly other things, easier to implement.

Just a thought - but based on what I know and have proved to be feasible. (I realise you may have such constructs already)

Terry