|
Quote: On Error Resume Next
There is no this kind of code in VB
NET.
Study more.
Try
x = x \ y
MessageBox.Show("end of Try block")
Catch ex As Exception
MessageBox.Show(ex.Message)
MessageBox.Show("Stack Trace: " & vbCrLf & ex.StackTrace)
Finally
MessageBox.Show("in Finally block")
End Try
|
|
|
|
|
Rather than going with an opinion, I'd suggest that you check the facts instead:
Module Module1
Sub Main()
On Error Resume Next
Console.WriteLine("Hello World!")
Console.ReadLine()
End Sub
End Module Just because Try...Catch blocks are there, doesn't mean the old ways aren't.
But then, facts never mean anything to the faithful, do they?
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OK, C# has GOTO, and now?
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
if (array[i, j].Equals(myNumber))
{
goto Found;
}
}
}
Console.WriteLine("The number {0} was not found.", myNumber);
goto Finish;
Found:
Console.WriteLine("The number {0} is found.", myNumber);
Finish:
Console.WriteLine("End of search.");
|
|
|
|
|
And VB doesn't?
Yes it does have goto - because there are occasions when you need it.
But outside a student's homework submitted to a lazy teacher I've not seen - let alone used - goto once in the "real world".
Face it: VB is based on a language designed for people who can't code, don't want to code, and have no interest in quality. It still has those early days buried deep in it's fabric: the On Error rubbish, the weak typing, the lack of need to declare anything.
Those aren't strengths, they are contributing factors to poor maintainability which are designed right into the language. That's why C# is the way it is: it encourages the production of more robust and understandable code.
Yes, you can produce good code in VB - but you have to treat it more like C# to do it and do all the work yourself!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Quote: Face it: VB is based on a language designed for people who can't code, don't want to code, and have no interest in quality. It still has those early days buried deep in it's fabric: the On Error rubbish, the weak typing, the lack of need to declare anything.
False assertion, you can produce bad or good code in VB.NET or C #, the choice is yours.
Quote: the weak typing, the lack of need to declare anything.
False assertion, you just use
Option Strict On at start of your VB.NET code.
Study more, please, did you heard about Python?
|
|
|
|
|
VB.NET was my first language and, unfortunately, I have to agree with OG here.
Yes, there is an Option Strict, but it's off by default and many programmers "forget" to turn it on.
VB was created to make programming easier and as a result non-programmers started programming.
And boy have I seen my share of VB code... Assigning strings to ints, coding everything directly into a single form, and, indeed, lots of GOTO's and On Error Resume Next.
Because that's the way VB is by default.
Yes, VB.NET can do everything C# can, and then some more. And that "more" part often isn't very good.
That said, I've seen big piles of crap written in C# as well.
Ultimately it boils down to the developer who uses it.
VB doesn't deserve the hate it gets.
I really can't believe VB.NET is more popular than C# though.
I've been doing C# for a good five years now, but before that time it was almost impossible to find good tutorials or examples in VB.NET (which is why I learned C# in the first place).
If I look for jobs in the Netherlands I find almost 900 jobs for "c#" and 87 for "vb" and "vb.net" combined.
VB isn't even (fully) supported on many newer platforms like .NET Core and Azure...
So I wonder where this popularity on TIOBE came from.
|
|
|
|
|
Looking a little closer at the numbers, classic VB was down 1.21% while VB.Net was up 1.2%. Maybe they changed how they handled the classified the data?
|
|
|
|
|
Every time you tell a seasoned programmer to "study more" you are just sinking your own argument and, frankly, alienating the people that you're trying to puff yourself up to.
The point is that good software written in VB is despite the language, not empowered by it.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
that was a hold over from VB6 days. when the first VB.net came out, it supported a upgrade wizard to moved VB6 to VB.Net. Way to many devs in VB6 relied on this because there was no structured error handling.
They should drop support for some of the old baggage, but MS will likely keep it forever. C# was lucky as it was new and fresh and (mostly) had none of the burdens of an older sibling.
|
|
|
|
|
georani wrote: but more fun and readable to program with
|
|
|
|
|
georani wrote: but more fun and readable to program with
Google translate: "The only language I know"
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Wait until he discovers JavaScript. He is perfect JS fanboi material.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Oh gawd. We don't need another one; the world doesn't need another one.
Anyway, he'll never cope: "{" instead of "Begin" will blow his mind.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nah man, hoisting would cause seizures.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
I think some people are attracted to really cringy languages like BASIC, PHP or JS. They love the sinister hacks and awful workarounds and pat themselves on the back for their great ideas. Too bad they naver waste a thought about why nobody else does such things.
That's also why I tend to stay away from anything where such a hack culture prevails.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
I don't agree; I think it has more to do with the forgiving nature of a dynamic language compiler/interpreter.
In my experience (and as a teen, what was my experience) there isn't some sinister master plan on the part of the coder to torture code; they just don't have the grounding to really understand what's going on or why some approach is wrong/fragile/ill-conceived.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Nathan Minier wrote: In my experience (and as a teen, what was my experience) there isn't some sinister master plan on the part of the coder to torture code; they just don't have the grounding to really understand what's going on or why some approach is wrong/fragile/ill-conceived. Yes, that's the flypaper with which they are cought. XXX is soooooo easy for beginners. The problem is that you don't stay a beginner forever and your tasks grow as well.
If you don't get off the flypaper quickly, you are going to become a hack and likely stay that way forever. You don't know how much I thank my dark gods that my experience as a teen was with hey hex keyboards, machine language and a community that knew what it was doing.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
I can't fully disagree, except that while JS may be dynamic, it has a real use and is a highly effective tool in the toolbox of someone that can work with it appropriately.
(Plus it's not intuitive enough to be good flypaper, which is more of a condemnation than an advertisement for a dynamic language)
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Yes fun e readable.
Please compare this VB.NET code:
Public Class MyClass1
Public Property Mynumber As Integer = 3
End Class
With This C# equivalent
public class MyClass1
{
public int Mynumber {get; set;} = 3;
}
I Think VB.NET is more readable and fun.
|
|
|
|
|
georani wrote: I Think VB.NET is more readable and fun. And I am sure there are many more who agree. But if you learned C# first then you would (as I do) hold the complete opposite view. And as in all such surveys, the actual results are generally totally meaningless and useless.
|
|
|
|
|
Now write the VB equivalent of this C#
public class MyClass1
{
public int Mynumber {get; private set;} = 3;
}
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Done:
Public Class MyClass1
Private _Mynumber As Integer = 3
Public Property Mynumber() As Integer
Get
Return _Mynumber
End Get
Private Set(value As Integer)
_Mynumber = value
End Set
End Property
End Class
This C# equivalent:
public class MyClass1
{
public int Mynumber {get; private set;} = 3;
}
It's shorter, but not fun or more readable.
modified 21-Jul-18 11:35am.
|
|
|
|
|
georani wrote: not fun or more readable.
Who are you trying to kid? Yourself?
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Quote: Who are you trying to kid? Yourself?
I Think this:
This code:
Public Property Mynumber() As Integer
Get
Return _Mynumber
End Get
Private Set(value As Integer)
_Mynumber = value
End Set
End Property
Is more readable and more safe than this shorter and equivalent C# code:
public int Mynumber {get; private set;} = 3;
If you read fast, you can make mistakes when reading this C# code, and anyone can understand VB version, even non programmers,
but if you are not a C# programmer what the hell is "{get; private set;} = 3"?
modified 21-Jul-18 11:37am.
|
|
|
|
|
You're getting pretty desperate now...
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|