|
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
|
|
|
|
|
|
What about that can't be done in C#?
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
|
Just because you don't need the extra keyword doesn't mean that C# can't do it:
new Image
{
Height = 150,
Width = 150,
Source = RotateStream
(
Pictures.Album[AlbumName].Picture,
Pictures.Album[AlbumName].Angle
)
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That code would fail as the scopes would be confused
|
|
|
|
|
No it wouldn't.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
VB
New image with {.height = height}
C#
New image {height = height}
second one fails
|
|
|
|
|
Colborne_Greg wrote: second one fails
No, it doesn't.
https://dotnetfiddle.net/J0N7Mm[^]
using System;
public class Program
{
public static void Main()
{
int height = 100;
var image = new Image { height = height };
Console.WriteLine("The image's height is {0}.", image.height);
}
}
public class Image
{
public int height { get; set; }
}
Output: The image's height is 100.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Haha
Make it simple, as simple as possible, but not simpler.
|
|
|
|
|
Height = height breaks readability rules
Having the period in visual basic easily allows the reader of the code to know the scope of the object, which is not so obvious
|
|
|
|
|
If you're used to working in a case-sensitive language, the difference between Height and height is pretty obvious.
And if you're that worried about it, you can always call your variable something else!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a habit of avoiding case sensitive languages as it creates more problems, then the advantage you gave
|
|
|
|
|
The way you are making this statement is theological, not theoretical. In this audience, if you want that statement to actually stand, you'll have to go into great detail as to WHY you think that.
I've been working in case sensitive languages for 30 years, without any problems I can think of regarding the language itself. Humans can mess up any language, regardless of syntactic richness, protections, etc. That is because the language only enforces syntactic correctness.. and most issues with code lie in either algorithm design or overall architectural design, which no language can protect you from no matter how rich.
|
|
|
|
|
If you studied languages you would know that opinions are not religion but thanks.
Here is am example a large amount of new programmers make
int64 Height = 150;
int64 width = 150;
When the programmer uses Height and Width, the Width has a underline, and because of the number of lines in the file the programmer creates a new variable int64 Width = 150;
While this one programmer is using the uppercase Width his peers are using the lowercase width.
Is that clear enough for you,
Sorry I assumed you had enough experience to know the issues with dealing with case sensitive variables.
|
|
|
|
|
Seriously?
You are using this is a reason to disparage case sensitivity?
This same example goes for case insensitive languages.. all it takes is one programmer using 'width', while another uses something like 'wdth', and we have exactly the same issue. I've seen this so please don't say it isn't possible. Beginning programmers cease being beginners when they start looking at the bigger picture and trying to understand that things like this are possible. Which language they use is inconsequential to that understanding. The issue is one of rigor.. not some language feature.
You'll have to try MUCH harder than this to be convincing.
And note I have no bone to pick with VB. It has driven a lot of business application development and TOTALLY has its place. Its the 'new Cobol'.. another language much disparaged by many but quite useful in my opinion.
|
|
|
|
|
A requirement of programming for me is to use whole words, anyone writing wdth would be fired.
Considering the use of full words the with block becomes extremely important for readability.
Since the adoption of full words and with blocks we have dropped the use of comments, greatly increasing productivity.
Even when we use C# because some of my own programmers have more experience in that one language, so even when we use it having to make sure a variable is typed correctly can hold up experienced C# programmers for lazy mistakes, that simply do not happen in VB. So yes seriously.
|
|
|
|
|
This now qualifies as trolling. Have a nice day.
|
|
|
|
|
When two people go back and forth, it's called a conversation.
|
|
|
|
|
Having or not having a specific operator can hardly be an argumant in favor of any language. There are thousands of keywords other languages provides that VB doesn't have!
Besides, Pascal also has with . And I already told you that much in a different thread.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I always forget about pascal, a language I learned but never really wrote anything in.
|
|
|
|
|
That was just an aside. Every single object oriented language doesn't need and doesn't want a with keyword! If you need to perform a series of operations on a single object, then you write a method for that! You won't even need the introductory '.', and you can just call the method from different places without having to copy the original code (including the errors therein). That's a lot more elegant than your example, and far better readable because the implementation will be within the context of the object class, rather than in the context of some arbitrary function that just happens to use it!
I do realize that VB has classes too - but that is all the more reason that it shouldn't even have a with statement: it just leads to code that is harder to maintain than writing a class method.
Have you never wondered why an old language like Pascal has it, but none of the newer ones? Not even the newer languages by Niklaus Wirth himself (Modula, Oberon) have it! If you must discuss the merits of with , shouldn't you instead ask why its inventor, Niklaus Wirth, and (almost) all other designers of modern programming languages abandoned it?
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I has everything to do with being able to get full words onto the screen and not have to repeat them, there is no compiler benefit.
There is a psychology difference in the mind of the programmer that is more acceptable to human error and overall costs less while getting to the result faster and cleaner then any language.
|
|
|
|
|
What you say are exactly the things I didn't bother pointing out in favor of using class methods, and against the with statement. But if you're not familiar with basic OO concepts, then there's no point discussing this any further.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|