Visual Basic needs more credit
-
I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the
On Error Resume
abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!Wrong is evil and must be defeated. - Jeff Ello[^]
I should have left out the try catch
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
With, when used appropriately, aids clarity just by removing characters – if you have to read past "SomeLongObjectName." at the start of every line you won't actually see the important word. When used badly (so you don't know whether the tokens on the line are part of the with'd object or locals or something else) it makes things worse. I've used with in ActionScript, usually for graphics code which is doing nothing but a bunch of calls to lineTo, moveTo, setBitmapFill etc, and (imo anyway) not having "e.graphics." on every line makes that clearer.
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
-
and you can do the same in C# without the need for "with" keyword
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
Without the with keyword in C# it reduces the available scope
-
With his pants on fire :laugh: I read somewhere that there are things that VB can do and C# can't an vice versa though... Think it had something to do with Errorhandling ?
No
-
Considering the missing connection between me knowing C# can get away without using the with word, proves its problems. The with keyword gets the coder in a mindset.
That may be part of the problem...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
-
I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the
On Error Resume
abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!Wrong is evil and must be defeated. - Jeff Ello[^]
I should have left out the try catch
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
visual basic takes less skill to get the job done
-
I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:
Private Sub AlbumListPopulate()
Try
AlbumsList.ItemsSource = New List(Of Image)For Each AlbumName In Pictures.Albums Try AlbumsList.ItemsSource.Add \_ ( New Image With { .Height = 150, .Width = 150, .Source = RotateStream \_ ( Pictures.Album(AlbumName).Picture, Pictures.Album(AlbumName).Angle ) } ) Catch End Try Next Catch End Try
End Sub
If I could be arsed, I'd find similar classes in Java and show you how anonymous constructors work there too.
-
A lot of people do. I can't understand why, but yes, a lot of people do.
There are only 10 types of people in the world, those who understand binary and those who don't.
visual basic is easier for people with less skill
-
Are you still opposed to using (the namespace one, not the disposing one or the alias one) as well?
Public Shared Function GetImage(FileName As String) As BitmapImage
If FileName <> "" Then
Using isStore = IsolatedStorageFile.GetUserStoreForApplication()
Using targetStream = isStore.OpenFile(CameraControl.LastKnownTaken.FileName, FileMode.Open, FileAccess.Read)
Dim ImageCaptured = New BitmapImage
ImageCaptured.SetSource(targetStream)
Return ImageCaptured
End Using
End Using
End If
Return Nothing
End Function -
If I could be arsed, I'd find similar classes in Java and show you how anonymous constructors work there too.
not familiar with Java so that would be great
-
Considering the missing connection between me knowing C# can get away without using the with word, proves its problems. The with keyword gets the coder in a mindset.
My dislike of
with
(also in Pascal I think) is that the only place I would have liked to use it, it won't work... If I have two things (not necessarily the same type), and I want to copy a number of values (not necessarily all the values) between them:thing1.fieldM = thing2.fieldP ;
thing1.fieldD = thing2.fieldQ ;
...I want a
with
that will allow me to do something like:with ( thing1 , thing2 )
{
fieldM = fieldP ;
fieldD = fieldQ ;
...
}That would be usefull. As it stands,
with
is pointless (in my opinion) so I have never used it. However, one could use something like:{
var src = thing1 ;
var dst = thing2 ;dst.fieldM = src.fieldP ;
dst.fieldD = src.fieldQ ;
...
}which is almost a good. :shrug:
You'll never get very far if all you do is follow instructions.
-
That may be part of the problem...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
What problem? People with less skill are more focused on getting the job done, then writing cool useless code.
-
Without the with operator C# has a smaller scope
Sorry as Bob has pointed out, this sort of argument needs more research. many have also pointed out from the .net framework that C# doesn't need the
With
keyword. There are many other keywords if you looked and were pedantic enough C# doesn't use but slight change / merge of keywords you could achieve the same thing. relax and enjoy the lounge they don't really care what language you code in.Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
-
I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:
Private Sub AlbumListPopulate()
Try
AlbumsList.ItemsSource = New List(Of Image)For Each AlbumName In Pictures.Albums Try AlbumsList.ItemsSource.Add \_ ( New Image With { .Height = 150, .Width = 150, .Source = RotateStream \_ ( Pictures.Album(AlbumName).Picture, Pictures.Album(AlbumName).Angle ) } ) Catch End Try Next Catch End Try
End Sub
Wow. Dude. If you're going to say something like that, make sure you're exposed to more languages first.
-
That's just laziness and the expectation that it works 100% of the time
..and also something that happens quite often in VB. And no, one cannot call it lazy - the author of said snippet included TWO handlers to swallow the exceptions. That's not lazy, that's extra work. It could be improved by simply REMOVING the check completely.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
visual basic takes less skill to get the job done
If it's in VB, it isn't "done". :laugh:
You'll never get very far if all you do is follow instructions.
-
I should have left out the try catch
Or handled it.
Wrong is evil and must be defeated. - Jeff Ello[^]
-
My dislike of
with
(also in Pascal I think) is that the only place I would have liked to use it, it won't work... If I have two things (not necessarily the same type), and I want to copy a number of values (not necessarily all the values) between them:thing1.fieldM = thing2.fieldP ;
thing1.fieldD = thing2.fieldQ ;
...I want a
with
that will allow me to do something like:with ( thing1 , thing2 )
{
fieldM = fieldP ;
fieldD = fieldQ ;
...
}That would be usefull. As it stands,
with
is pointless (in my opinion) so I have never used it. However, one could use something like:{
var src = thing1 ;
var dst = thing2 ;dst.fieldM = src.fieldP ;
dst.fieldD = src.fieldQ ;
...
}which is almost a good. :shrug:
You'll never get very far if all you do is follow instructions.
I would not hire you sorry. The reason you can not use the with operator in such a fashion is scope