10-15-2024, 07:27 PM
(This post was last modified: 10-15-2024, 07:30 PM by KristianVirtanen.)
Hello everyone.
I know I shouldn't remember these anymore, but back in the day when I got excited about programming, the options for home computers were GWBasic, BASICA or MSX-Basic.
Pascal and C and a few others had of course already appeared, but 95% of the home programmers of that time used Basic.
For example, in GWBasic, the type of variables was indicated right at the end of the name.
Regarding naming, there were otherwise very much the same rules as now in SmallBasic. And the Basics of that time didn't require variables to be initialized separately anyway, instead a variable could be activated by simply entering a value for it. And if I remember correctly, a variable that wasn't even created yet always gave a value anyway. String "" and numeric variables with a value of 0.
As long as the size of the code remains in the tens or at most a couple of hundred lines, this is usually not a problem. But as the program grows, it very soon becomes a problem.
I started to make the game described above, where the player was controlled in a changing environment while the computer-controlled guys moved there. In the game, you could shoot with a few different weapons, the field of view was limited by the walls etc. in the terrain.
SmallBasic would have been able to function as an engine in that game, but the programmer, i.e. me, simply lost my nerve. Naming variables and tables took more time and effort (read pain) than figuring out the calculation needs of the game engine itself. The fact that all variables were always globally visible made it worse.
Programming is the same, whether you use Basic, C or even JavaScript. It is "talking" to the computer in a specific language. And the majority of languages work very much the same way.
In my opinion, perhaps too much is being thought about today, which is the best language for a beginner. I think the whole question is completely wrong. One should ask "how do we teach logical and mathematical thinking to a person interested in programming?"
I personally like the way variables are used in JavaScript. They must be initialized separately and followed by the suffix "$", but the type of the variables is free. That is, the same variable can be either a string, double, integer or even an object.
Probably some sort of hybrid model would be best, at least initially.
Option SB at the beginning of the code would try to emulate SmallBasic as best as possible. A bit like, for example, FreeBasic can be used in different "modes" by entering parameters to the compiler. Even if "-lang qb".
Output: 2
Without the option, things wouldn't work the same way.
Output: 1
MySub does not have visibility into the variable 'a' named in the main program, so it creates a new variable for itself with an initial value of 0. When returning from the subprogram, the original variable a is used.
But I still have some work to do to get the error checking done, bug fixes and variable typings right with the library, so these thoughta can be left to simmer in the background for now.
However, it's nice to note that there are still enough enthusiastic people around SmallBasic.
I know I shouldn't remember these anymore, but back in the day when I got excited about programming, the options for home computers were GWBasic, BASICA or MSX-Basic.
Pascal and C and a few others had of course already appeared, but 95% of the home programmers of that time used Basic.
For example, in GWBasic, the type of variables was indicated right at the end of the name.
Code:
$: String variable
%: Integer variable
!: Single-precision variable
#: Double-precision variable
Regarding naming, there were otherwise very much the same rules as now in SmallBasic. And the Basics of that time didn't require variables to be initialized separately anyway, instead a variable could be activated by simply entering a value for it. And if I remember correctly, a variable that wasn't even created yet always gave a value anyway. String "" and numeric variables with a value of 0.
As long as the size of the code remains in the tens or at most a couple of hundred lines, this is usually not a problem. But as the program grows, it very soon becomes a problem.
I started to make the game described above, where the player was controlled in a changing environment while the computer-controlled guys moved there. In the game, you could shoot with a few different weapons, the field of view was limited by the walls etc. in the terrain.
SmallBasic would have been able to function as an engine in that game, but the programmer, i.e. me, simply lost my nerve. Naming variables and tables took more time and effort (read pain) than figuring out the calculation needs of the game engine itself. The fact that all variables were always globally visible made it worse.
Programming is the same, whether you use Basic, C or even JavaScript. It is "talking" to the computer in a specific language. And the majority of languages work very much the same way.
In my opinion, perhaps too much is being thought about today, which is the best language for a beginner. I think the whole question is completely wrong. One should ask "how do we teach logical and mathematical thinking to a person interested in programming?"
I personally like the way variables are used in JavaScript. They must be initialized separately and followed by the suffix "$", but the type of the variables is free. That is, the same variable can be either a string, double, integer or even an object.
Probably some sort of hybrid model would be best, at least initially.
Option SB at the beginning of the code would try to emulate SmallBasic as best as possible. A bit like, for example, FreeBasic can be used in different "modes" by entering parameters to the compiler. Even if "-lang qb".
Code:
#option SB
a = 1
MySub()
TextWindow.WriteLine(a)
Program.End
Sub MySub
a = a + 1
EndSub
Output: 2
Without the option, things wouldn't work the same way.
Code:
a = 1
MySub()
TextWindow.WriteLine(a)
Program.End
Sub MySub
a = a + 1
EndSub
Output: 1
MySub does not have visibility into the variable 'a' named in the main program, so it creates a new variable for itself with an initial value of 0. When returning from the subprogram, the original variable a is used.
But I still have some work to do to get the error checking done, bug fixes and variable typings right with the library, so these thoughta can be left to simmer in the background for now.
However, it's nice to note that there are still enough enthusiastic people around SmallBasic.