QWERTYUIOP123456
Coder
Hello. I have created a sort of coding system which appears quite weird and mindboggling. I would like to know what type of programming is that coding system, whether I'm making programming strategies which have already existing names, if people already thought in programming in this style (so that I may see whether I'm having a sort of "innovative" idea), how I could turn this code system more "normal", and what you think about that. Below is the description of the coding system. First, I will give an example of a code made using this coding system which will serve to illustrate the coding system, it consists of the creation of the function Function_AttemptAbstractEvent, which takes such a function as a principle to use the code system in the code (therefore the variables, expressions, and functions of the code are, in some sense, predicated to this single function), which is intended to return whether an event with (let's say "A") chances of happening within (let's say "B") possibilities has happened, and returns True if yes, and returns False if no:
Here is the description of the coding system:
Every function have, in principle, a name which goes like "Function_"+[Name of the function]. For every function in which their name start with "Function_", there should be a function created specifically to set (define) the value of the variables and parameters of the function and then call the function, in which its name goes like "Call_"+[Name of the function]. For every function in which their name start with "Call_", there should be a function in which its name goes like "SetVariables_"+[Name of the function in which the function in which its name start with "Call_" refers to (corresponding to the string which goes after the string "Call_" of the name of the function in which its name start with "Call_")], which should set the value of the variables and parameters in which the corresponding function in which its name start with "Function_" shall deal with. For every "SetVariables_" function, there should be a function in which its name goes like "Default_Variable"+[Name of the function "Function_" in which the function "SetVariables_" relative to the function "Default_Variable" refers to]_[Name of the variable], which assigns default variable and parameter values to the corresponding function "Function_", so that the functions "SetVariables_" may be convenient to decide whether it will set a default value for a "Function_" variable and parameter, or change the default variable value so as to make a "customized" function "Function_" call. The "SetVariables_" function will serve as a way for the user to declare the variables of a function without having the cumbersomeness of having to modify the default value of every variable of a function "Function_". Furthermore, virtually every procedure within a function (let's say A) shall be done through a function (let's say B) which is specific to that function, with the name of the function B being [Name of function A]_+[Name of function B].
In the above code, the code is set to return whether an event with Chances of chances of happening within Possibilities possibilities has happened, being Chances a random number which can varies from 0 to Possibilities, and Possibilities being a random number which varies from 1 to 10, as you can see in the code, therefore the code is not set to return default values for Chances and Possibilities, and if it had, it would always return true, because a random number Get-Random -Maximum 1 will always return 0, when the default value of Possibilities is set to 1, which means the variable $Global:AttemptAbstractEvent_DoesAttemptResultMatchesEvent will always have the value True within the execution of the function Call_AttemptAbstractEvent;
Here are some ideas about the code system:
The intention of that is to have every variable and function accessible to the global scope so that every function may have the possibility to have agency over all the details of another function, in order to and also to give a greater "versatility" for me to improve the functions which are "predicated" to the function Function_AttemptAbstractEvent, knowing that this type of coding style likely allows me to define every detail of how things will be done in every procedure my code takes. Apparently, declaring parameters and variables through functions which declare parameters and values defines HOW parameters and variables will be declared as WHAT the parameters and variables will be, rather than simply WHAT parameters and variables will be, when the "HOW" of variables and parameters appears to give me a bigger "versatility" for me to improve my code rather than the "WHAT" of variables and parameters.
I don't know if I'm sort of "playing the fool" by creating a coding system which tends to generate a lot of line codes which is, at first seeing, cumbersome to write, when I could simply write an one-line function which satisfies the goal of returning whether an event with $A chances in $B possibilities of happening has happened, like this one:
And I know I apparently have many more possibilities to improve my code having the code which was created using my code system rather than this one-line code, when, if such an one-line code would be supposed to be edited so as to gradually add improvements to the function, such as "fineties", I suppose it would take more effort to modify this one-line function than it would take to modify the code which uses my coding system, I don't know if I could achieve the "versatility" I'm speaking about simply through specific instances of code which are supposed to use my one-line AttemptAbstractEvent function, please comment whether this code system can be considered decoupled programming, and, if not, what would be the name for it, and the fact that, using such a code system, I've left some functions empty. Please clarify me about these matters, Thanks.
Code:
function Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent(){}
function Default_Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent()
{
$Global:AttemptAbstractEvent_DoesAttemptResultMatchesEvent = $True;
}
function SetVariables_Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent()
{
$Global:AttemptAbstractEvent_DoesAttemptResultMatchesEvent = $Global:AttemptAbstractEvent_GenerateAttempt_Result -lt $Global:AttemptAbstractEvent_NumberOfChances;
}
Function Call_Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent()
{
SetVariables_Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent;
Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent;
}
function Function_AttemptAbstractEvent_GenerateAttempt(){}
function Default_Variable_Function_AttemptAbstractEvent_GenerateAttempt_Result()
{
$Global:AttemptAbstractEvent_GenerateAttempt_Result = 0;
}
function SetVariables_Function_AttemptAbstractEvent_GenerateAttempt()
{
$Global:AttemptAbstractEvent_GenerateAttempt_Result = Get-Random -Maximum $Global:AttemptAbstractEvent_NumberOfPossibilities;
}
function Call_Function_AttemptAbstractEvent_GenerateAttempt()
{
SetVariables_Function_AttemptAbstractEvent_GenerateAttempt;
Function_AttemptAbstractEvent_GenerateAttempt;
}
function Function_AttemptAbstractEvent()
{
Call_Function_AttemptAbstractEvent_GenerateAttempt;
Call_Function_AttemptAbstractEvent_DoesAttemptResultMatchesEvent;
}
function Default_Variable_Function_AttemptAbstractEvent_NumberOfChances()
{
$Global:AttemptAbstractEvent_NumberOfChances = 1;
}
function Default_Variable_Function_AttemptAbstractEvent_NumberOfPossibilities()
{
$Global:AttemptAbstractEvent_NumberOfPossibilities = 1;
}
function SetVariables_Function_AttemptAbstractEvent()
{
$Global:AttemptAbstractEvent_NumberOfPossibilities = Get-Random -Minimum 1 -Maximum 10;
$Global:AttemptAbstractEvent_NumberOfChances = Get-Random -Maximum ($Global:AttemptAbstractEvent_NumberOfPossibilities+1);
}
function Call_Function_AttemptAbstractEvent()
{
SetVariables_Function_AttemptAbstractEvent;
Function_AttemptAbstractEvent;
$Global:AttemptAbstractEvent_DoesAttemptResultMatchesEvent;
}
Here is the description of the coding system:
Every function have, in principle, a name which goes like "Function_"+[Name of the function]. For every function in which their name start with "Function_", there should be a function created specifically to set (define) the value of the variables and parameters of the function and then call the function, in which its name goes like "Call_"+[Name of the function]. For every function in which their name start with "Call_", there should be a function in which its name goes like "SetVariables_"+[Name of the function in which the function in which its name start with "Call_" refers to (corresponding to the string which goes after the string "Call_" of the name of the function in which its name start with "Call_")], which should set the value of the variables and parameters in which the corresponding function in which its name start with "Function_" shall deal with. For every "SetVariables_" function, there should be a function in which its name goes like "Default_Variable"+[Name of the function "Function_" in which the function "SetVariables_" relative to the function "Default_Variable" refers to]_[Name of the variable], which assigns default variable and parameter values to the corresponding function "Function_", so that the functions "SetVariables_" may be convenient to decide whether it will set a default value for a "Function_" variable and parameter, or change the default variable value so as to make a "customized" function "Function_" call. The "SetVariables_" function will serve as a way for the user to declare the variables of a function without having the cumbersomeness of having to modify the default value of every variable of a function "Function_". Furthermore, virtually every procedure within a function (let's say A) shall be done through a function (let's say B) which is specific to that function, with the name of the function B being [Name of function A]_+[Name of function B].
In the above code, the code is set to return whether an event with Chances of chances of happening within Possibilities possibilities has happened, being Chances a random number which can varies from 0 to Possibilities, and Possibilities being a random number which varies from 1 to 10, as you can see in the code, therefore the code is not set to return default values for Chances and Possibilities, and if it had, it would always return true, because a random number Get-Random -Maximum 1 will always return 0, when the default value of Possibilities is set to 1, which means the variable $Global:AttemptAbstractEvent_DoesAttemptResultMatchesEvent will always have the value True within the execution of the function Call_AttemptAbstractEvent;
Here are some ideas about the code system:
The intention of that is to have every variable and function accessible to the global scope so that every function may have the possibility to have agency over all the details of another function, in order to and also to give a greater "versatility" for me to improve the functions which are "predicated" to the function Function_AttemptAbstractEvent, knowing that this type of coding style likely allows me to define every detail of how things will be done in every procedure my code takes. Apparently, declaring parameters and variables through functions which declare parameters and values defines HOW parameters and variables will be declared as WHAT the parameters and variables will be, rather than simply WHAT parameters and variables will be, when the "HOW" of variables and parameters appears to give me a bigger "versatility" for me to improve my code rather than the "WHAT" of variables and parameters.
I don't know if I'm sort of "playing the fool" by creating a coding system which tends to generate a lot of line codes which is, at first seeing, cumbersome to write, when I could simply write an one-line function which satisfies the goal of returning whether an event with $A chances in $B possibilities of happening has happened, like this one:
Code:
function AttemptAbstractEvent($A,$B){if((Get-Random -Maximum $B) -lt $A){return $True;}return $False;}
And I know I apparently have many more possibilities to improve my code having the code which was created using my code system rather than this one-line code, when, if such an one-line code would be supposed to be edited so as to gradually add improvements to the function, such as "fineties", I suppose it would take more effort to modify this one-line function than it would take to modify the code which uses my coding system, I don't know if I could achieve the "versatility" I'm speaking about simply through specific instances of code which are supposed to use my one-line AttemptAbstractEvent function, please comment whether this code system can be considered decoupled programming, and, if not, what would be the name for it, and the fact that, using such a code system, I've left some functions empty. Please clarify me about these matters, Thanks.