So my kid got me into programming

I am learning Visual Basic.

Funny story, Phoenix somehow found a tutorial on youtube for programing a rock/paper/scissors game in VB. He was pretty excited about it, which is funny, Charlie is sorta the geek around here and the game itself really was not that spectactular. At any rate, we ended up downloading the editor and running the program. Went well, actually. I think he might actually get into this stuff.

The point is: Why didn't anyone tell me VB was so awesome? Oh my God, the drag-and-drop buttons and labels with the auto-written code? Brilliant! I swear, one could build the coolest robot control panel in the world with this thing. Don't get me wrong, I love me some Processing. That said, between wrj4P5 and VB's built-in "build a gui" stuff, VB smokes processing. Hands down.

If anyone is looking to write stuff to run on the computer end, take a look at VB. Awesome.

I could have told you that Chris :slight_smile:

In some circles VB is regarded as an inferior programming language but under .NET it’s just as fast as C# and it’s a full blown object oriented language. The control system for Whirligig is written I the free version of Visual Studio VB. http://www.youtube.com/watch?v=Bl4Ak9QIGBY

I have had that opinion for

I have had that opinion for quite a while also (yes, I am so last century :slight_smile: ), though oddly I thought that it was better off being only object based instead of truly OO. For a substantial amount of development, all you really need is notification. Let the system draw the windows and buttons and worry about all the standard operations like minimizing and closing the application, displaying pictures, etc. I think a lot of VB developers got themselves in over their heads once it became OO. When you consume objects and just respond to their messages, you know the message is just for you and you do whatever you need to to respond. When you go OO and derive from a class and override a method, you have to know whether or not to call the base implementation and if so, before, after or during your implementation. You have to look inside the “black box” and not having to look inside is what makes objects so powerful IMO. I do a lot of OO stuff, but I think it was pushed further into the mainstream than it should have been.

 

"but I think it was pushed

"but I think it was pushed further into the mainstream than it should have been."

I think they had to do that so that the MSIL would be identical if you used C#, VB or any other language. The great thing is that you now can use a library built in C# in you VB application without the wrappers you had to use earlier.

And with the intellisense you really don’t have to know much about derived classes.

oops

clicked wrong reply again

I think you missed my point.

I think you missed my point. Intellisense doesn’t help you know what to do about the base class implementation of an overridable method. If you get a click event from a control, you know that it was clicked and you are being notified so you should do whatever it is the button is supposed to do. Object based programming is the “has a” approach - your form “has a button” and you register a metod to receive a notification when it is clicked. Full OO programming is inheritence or the “is a” apporach. You create a specialized button that derives its behavior from the standard button. If you over ride a method for a control that is fired when it is clicked, you have to know more about how it works internally to do the right thing. Do you still need to call the base class? Maybe it sets some state needed later. It might not paint correctly unless you call the base class. But when you are trying to modify the way it does things visually, you sometimes want to keep it from running the base class method. That’s fine, but it requires deeper knowledge.

You can still do it both ways. My point about “pushing it to the mainstream” is that a lot of the examples, articles and other learning resources really seemed to imply that inheritence is generally the best option and I would argue that it rarely is. Sometimes it is; I am not saying there should not be inheritence available. But I would have been okay with it being left out of VB. IMO, they made it a “me too” - as powerful as C++ and C# because of a perceived need that I really don’t think is there. True OO is not easy to use properly no matter what language you program in.

Agreed

I had… actually still have the box with the big beefy manuals for vb4. Then there was the api reference manual that came handy as well. Good door stoppers these days. But now it’s all online and free. I just downloaded it recently because I had a nephew that keeps harping on wanting to be a programmer. Trouble is they don’t want to put the effort in to learn. What do you do?

There’s nothing like discovering something new and enjoying the journey to enlightenment and the power it brings. All power to you CtC.

One thing I found when

One thing I found when working with VB and a newbie (my son) is the issue of where one should start when first learning. I stick with a car analogy. If one were to want to learn how an engine works, it would be best to start with an older engine “with all the parts showing”. Newer cars still have all these parts but the manufacturer decided to cover all the complicated stuff with a plastic cover and only give you access to the oil fill. If your goal is to simply learn how to check your oil, and you are happy stopping there, the newer car, with its hidden parts, is the way to go. You are never really going to get a full grasp doing this though. If one were to rip into a 1977 Chevy truck, you are simply forced to learn what each part does and why it is there. It will always be easier to go from knowing all the parts to not NEEDING to know them all than the other way around.

I sometimes feel that there is a fine line between between hiding complication to prevent a newbie from being overwhelmed while at the same time this becoming a crutch which prevents later “full on code” learning. Case in point, Phee was able to build a nifty “control panel” and make buttons change the text of a label within minutes after watching a tutorial. To him, VB appeared as if it was a “drag and drop, build-your-own-game” sorta thing that can be found on a lot of kids websites. When he wanted to expand the gameplay of his little program, it led to statements like, “when I DON"T hit the button, I want it to do this.” This led to a complicated discussion as to the flow of code, if/then’s and that “not doing something” is the default until you tell it to do something, as a poor example.

To be honest, the whole act of learning code for him was a lot more interesting when building the “control panel” and much less so when teaching him to start thinking in a flow chart, logical sorta way. I guess my bottom line is that I don’t know if I would suggest VB as a starting place to learn code, just as I don’t know if I would suggest learning engines on a brand new, modern car.

I can say this, I do really like the fact that most of VB is event driven. There is next to no need to “keep checking everything” by hand. I like the fact that it is “OOP-light” with the best (or good) of a lot of worlds. Many will talk about speed and power and aspects of the language but for me and my “hobby robots” it is quite powerful enough. Then again, for me, 9600 baud is also “fast enough” so I guess the speed/power bar is not very high.

Bottom line for me? VB is just another tool for the programming tool bag. Arduino does some things better than Picaxe and vice versa. Same with Processing vs. VB. You’re gunna love some aspects of it, other stuff will drive you nuts. Right now, with the projects I am doing now, VB is a handy fit.

Been there before?

Haven’t you been here before? https://www.robotshop.com/letsmakerobots/node/6779.

-EDIT- Sorry, stuck a SparkFun link in instead, fixed now.

 

For me, it is a set of

For me, it is a set of tools. Besides VB.Net, I do a fair amount of VBA in MS Office applications, mostly Excel and hAccess (my pet name for it) and I still maintain some old code in VB 6. I have to do a lot of database development and am often asked to add some new relevant fields or records for some new requirement or regulation ASAP. We get to work on adding UI in the main application for managing the new data, but in the meantime I can send someone a spreadsheet (likely with a column filled in to relate it to) and have them begin entering data right away. I just write a little VBA to store it away when the database is ready.

When we code the actual main application, we use C#. That was a management decision for consistency, though many developers do have an attitude about it being better even though performance and functionality are the same. VB is actually more functional, but some of the additional functions, like runtime binding, can get you in trouble.