Small Visual Basic: A VB.NET WPF open source project
In this VB.NET open source project, I add the form designer and a prototype for a mini winforms to convert the Small Basic Language to Small Visual Basic! https://github.com/VBAndCs/sVB-Small-Visual-Basic
When you switch to the Form code tab, you will see the auto generated SB code, and you can just run it, to see the form in run time.
This is not a complete work, and there is a lot to do until we can deliver Small visual Basic to kids as an enjoyable easy yet powerful learning tool. For instance, I need a properties window, and a way to visually add event handlers for the selected control. This is a lot of work, and all contributions are welcomed.
Re: Small Visual Basic: A VB.NET WPF open source project
Seems like it might add more confusion with yet another "Small Basic" version, e.g. Microsoft Small Basic which is already a simplified, but capable, version of a Basic Interpreter. Of course, it isn't based on the Small Basic syntax, which is part of the confusion.
"Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930
Re: Small Visual Basic: A VB.NET WPF open source project
I was talking about Microsoft Small Basic isn't based on the Small BASIC language. You said yours was, and I said Microsoft's wasn't, which is part of the confusion with Microsoft calling their Simple Basic, Small Basic, because the Small Basic language has existed for many years, long before Microsoft used the same name.
"Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930
Re: Small Visual Basic: A VB.NET WPF open source project
Never heard of, and find no mention of anything other than MS Small Basic. Have you any link of such a language?
The only thing I found is SmallBasic: https://en.wikipedia.org/wiki/SmallBASIC
Which is 2 years old and didn't reach the first release.
Any way, I see no confusion, since millions of kids use MS Small Basic, and know nothing about any other products.
Re: Small Visual Basic: A VB.NET WPF open source project
Yes, that is it, but its origins is much older than 2 years. It started in 2000 and at the time that Microsoft introduced Small Basic around 2010, if you did a search on "small basic" you would get hits about SmallBasic much more often then Microsoft's Small Basic.
Of course, with an additional 10 years of time, and diminishing importance of the early Palm PDA and Palm OS, you would not get many hits at all on the original SmallBasic related sites, and the one you found is apparently a carry over of the old SmallBasic idea to implementations for the current Smartphone markets.
It is interesting that you want to add a GUI tool to Small Basic, as the whole reason for Small Basic's creation was to get away from the Gui control building nature of the programing environments of the day to return to teaching Students the basics of programing by writing text base logical code constructs, rather than dropping controls and setting properties. The idea being that students learn how to use logic and the programming language to solve problems, using variables and memory structures to hold data, rather than the properties of controls. A return to the paradigm that the original BASIC and the various BASICs of the 1970's and 1980's provided to the legions of novice programming hobbyists.
Kind of reminds me of the switching of examples of describing a technology as time progresses.
I remember in the late 70's when the mouse was introduce that it was describe as being like a trackball that has been turned upside down. Then 10 to 15 years later when trackballs and trackmarbles started gaining in popularity for awhile, they were describe as being like a mouse that is turned upside down.
Here you are writing a Visual Interface for a language that was written purposely to get away from having a Visual Interface.
Sounds like an entertaining project. Hope you enjoy it.
Last edited by passel; Jan 15th, 2021 at 10:22 PM.
"Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930
Re: Small Visual Basic: A VB.NET WPF open source project
> Here you are writing a Visual Interface for a language that was written purposely to get away from having a Visual Interface.
Seems that your are confusing graphical programming with UI. Graphical programming has no code. All programming structures are built graphically. So, you grag and drop vars, if statements and loops! This is where MS decides to add SB to make kids start coding. This has nothing to do with UI. In fact SB itself can't do much (14 keywords only) whiteout the libs written with VB.NET and C#. But the way these libs are written (forced by the limitations of SB compiler) makes it too hard for kids to learn or do something interesting. I made 17 videos on YouTube to indtroduce Small basic for Arabic kids, and found it too hard to attract a kid to black console screen, and too complex to use Math to do something enjoyable in the graphics window. The right door for this is the Visual Basic style: darg and drop, double click to handle events, focus on the programming task not the UI.
By the way, SB already has a button and a textbox, but the way it use to draw and communicate with is too verbose and less useful. I am showing that can be done easily to make SB more powerful, more fun, more productive, and even more easier. As a simple example, I just add a Color module with about 140 color names, to allow the kid to use Color.Red instead of "Red" or "#FF0000". It makes you wonder why on earth they never did that in 12 years, just to learn kids bad programming habits of using error prone strings instead of a pre-defines enum-like structure?.. There are many mistakes like that in the compiler, the worst of them is all-global variables, which will backfire someday when using real programming languages!
I will advance the compiler itself later, but I am offering my ideas to SB team first, hopping we can work together. If they not respond, I will go a separate way, and give the children the Basic language they deserve. My ultimate goal is to crate the next generation VB.NET devs, and train VB.NET community (myself included) to work on compilers, so I translated SB source from C# to VB.NET code.
Another byproduct of this work, is a prototype of WPF Forms: a Winforms framework built upon Wpf, combining the simplicity of winforms with the amazing UI pf wpf. The designer already uses wpf controls, saves them in xaml, and SB.Forms lib loads them in runtime, and comunicate with them via a winforms-like API. So, the Xaml complexity is hidden form yhe kids, while he enjoy playing with the designer. I want to use the same approach to rewrite the Windows Forms framework, so all exsisting sinforms apps can run in wpf with no change, whith the ability to use a more advanced UI designer, and if necessary use an InnerContol property to access the inner wpf control to have a more advance UI features. I want to use VB.NEt in this project, to preserve tha language from extinction. We have a powerful language, but it is not uses in any important framework, so, MS found it easy to left it behind. We need to start treating VB.NET as a game changing player, to give it a future.
Re: Small Visual Basic: A VB.NET WPF open source project
I just published the v1.0 preview. I added many features in the designer and code editor. I even added some new syntax features, like array initializes:
x = {1, 2, 3}
please make your kids try it. I didn't provide documentation yet, but you can explore the samples folder, and over all the IDE is too easy to learn and use. https://github.com/VBAndCs/sVB-Small...g/v1.0-preview
* SB Code Enhancements:
I made many improvements to the SB compiler:
1. Support array initializers:
You can use the { } to set multiple elements to the array at once:
Code:
x = {1, 2, 3}
2. `For Next` and `While Wend`:
SB uses `EndFor` and `EndWhile` to close `For` and `While` blocks respectively. This is still supported in sVB but I allowed also to use `Next` to close `For` and `Wend` to close `While`, as they are used in VB6.
3. You can use `ExitLoop` to exit For and While loops, and `ContinueLoop` to skip the current iteration and jump back to the beginning of the loop body to continue the next iteration.
4. You can use `Me` to refer to the current Form.
5. True and False are keywords of sVB.
6. Subroutines can have parameters now.
7. sVB can define functions now. You can supply params to get the function input and use `Return` to return the function output.
8. SB doesn't have variable scope, as all variables are considered global, and you can define them in any place in the file and use them from any other place in the file (up or down). sVB has cleaned this mess, which is a break change that can prevent some SB code from running probably in sVB, but it is a necessary step to make the kid organize his code and write clean code. This is also necessary to make sub and function params work correctly, and allow you to use recursive subs and functions. The mew scope rules are:
- Sub and function params are local, and hides any global vars with the same names.
- The For loop counter(iterator) in local and hodes any global var with the same name.
- Any var defined inside the sub or the function is local unless there is a global var with the same name is defined above of the sub function. If the global var is defined below, then the local var will hide it.
9. The editor auto completes If, For, While, and Sub blocks just after writing a space after them.
CarData.Color = Color.Red
CarData.Speed = 100
x = CarData.Speed
sVB converts the above syntax to:
Code:
CarData["Color"] = Color.Red
CarData["Speed"] = 100
x = CarData["Speed"]
It is the same concept used with ExpandoObject in VB .NET and C# but they don't offer auto completion .
To enable dynamic properties, you must add the term `Data` at the start or end of the variable name, like data1 or studentData. Naming convention is the safe way in #sVB becuase it doesn't has data types. I choose `Data` as this is the sVB alternative to create structures.
you can inherit dynamic properties to make writing code easier and faster. So, If you added properties to CarData, you can reuse their names via with variable containing the name `car`like car2Data and myCarData and enjoy auto completion.
Samples contain a simple cars game. It's a demo to lour kids to complete it. It is a good example of how using naming conventions with control and array vars can make coding easier.
Re: Small Visual Basic: A VB.NET WPF open source project
sVB reached v1.8.5 now, with many new features in compiler, editor, and form designer. Check the source code and the Readme out: https://github.com/VBAndCs/sVB-Small-Visual-Basic
Note that the solution now contains the source code of Avalon Text Viewer (written in VB .NET) which is an advanced editor that is used to build the Small Basic code editor. You can use this editor to crate any sort of editor you want. Its source code is in the ToolsFramework project