globals?

T

Tom Leylan

It may seem like that to you but that isn't what the message is. Computer
languages form "contracts" between the developer and the machine. Legal
contracts use specific words to reduce ambiguity and programming contracts
must similarly choose systems which reduce ambiguity.

If we extend your example then every individual in every neighborhood is
free to interpret anything you type in any way they choose. You post here
confident that "reasonable" interpretations of your words will result in the
meaning you intended. If 10 people in Leeds think you should use the word
"OneUpton" instead of Singleton are you likely to say "I see your point" and
start doing that? No of course not and if only VB.Net uses UCase() why
should the world change particularly since VB.Net has ToUpper() and VB
developers use it all the time?

You can find well-written modules to be anything you wish them to be and you
should use them if you want. I'm stating that the other DotNet languages
don't have such modules and that putting UCase() into one isn't a great
example of their benefit. I'm also pointing out that most major companies
aren't "VB shops" they are companies that use VB along with other languages
to solve business problems. Things which tend to be language specific are a
detriment not an asset. The more different it is, the less likely it is to
be used.
 
H

Herfried K. Wagner [MVP]

Tom,

Tom Leylan said:
Languages aren't (necessarily) supposed to be rich. The language should
be straightforward, the libraries should be rich.

I don't think it's easy to decide where to draw the border between something
being supported explicitly in the programming language's syntax or exposed
as part of a library only. Take C#'s 'using' keyword as an example:

C# 1.0:

\\\
using (FooDialog f = new FooDialog())
{
...
}
///

vs. VB.NET 2002:

\\\
Dim f As New FooDialog()
Try
...
Catch
Finally
f.Dispose()
End Try
///

One could argue that 'using' is only a shortcut, and it's actually nothing
more than a shortcut. But it adds an additional keyword to the programming
language and thus makes the programming language more rich (or complex,
harder to learn). Well, it doesn't count that C# overloads the meaning of
the 'using' keyword here, which adds an additional level of complexity to
the language BTW!

However, we are talking about a rich library and not about a rich
programming language. "Microsoft.VisualBasic.dll" is simply a .NET-based
class library containing some modules and classes (which are mostly based on
the .NET Framework's BCL) and some additional features not being present in
the .NET Framework's BCL. The Visual Basic Runtime Library can even be used
together with C# without any problems, except that importing the modules is
not done automatically.
Nothing prevents C# developers from creating a rich set of alternative
functions so they can use UCase() instead of .ToUpper().

Nothing prevents C# developers from adding a reference to
"Microsoft.VisualBasic.dll" and using the functionality provided by this
DLL.
You're still making it a VB vs C# thing and it isn't. It is (the DotNet
family of languages including VB.Net) vs some compatibility layer in
VB.Net. We're not dumb if Str() and Sin() and UCase() were excellent ways
to save time everybody and their mother would simply write such things.
:)

Are we to believe that only VB is clever enough to have thought of this?
Or that C# developers like to waste time typing? Step back a moment and
try to understand we'd adopt anything that was a good idea. Option
Explicit Off was never a "really cool thing that C# doesn't have." It was
a dumb idea that cost untold millions in lost time and money debugging
things.

I have to disagree. Classic VB has been largely used for prototyping
applications later developed using other programming languages because it
provided 'Option Explicit Off'-style functionality. I do not claim that
everybody should work with 'Option Strict Off', but it's a neat feature in
some cases, especially when dealing with Office automation and/or targetting
different incompatible versions of certain libraries.
 
T

Tom Leylan

Cor you're starting to make things up. First the "stealing" when somebody
makes a PDF library and now this.

What isn't OOP?


Cor Ligthert said:
Anon,

Be aware that it is not OOP, you forgot to tell that.

Cor

_AnonCoward said:
:
: Whats the easiest way to make a global function in VB 2005? The
: old way was make a module, is that still the standard? thanks!


Try shared methods. These methods are available to every instance of a
type and can even be accessed without an actual instance being
declared (e.g.: the System.Console.WriteLine() method). It should be
noted that shared methods cannot operate on non-shared members of the
class. The following will not compile:

=========================================
Public Class [class]

Private i As Integer = 0

Public Shared Sub Method()
Console.WriteLine(i)
End Sub

End Class
=========================================


Ralf
--
--
----------------------------------------------------------
* ^~^ ^~^ *
* _ {~ ~} {~ ~} _ *
* /_``>*< >*<''_\ *
* (\--_)++) (++(_--/) *
 
H

Herfried K. Wagner [MVP]

Tom Leylan said:
Yes in the business world it matters very much. Confusion cost money.
Programmers are hired on a budget there isn't some infinite amount of
money available and it is common for the "VB-guy" to be asked to write
non-VB code and the C# guy to fill in when the VB-guy is sick or quits.

Please note my careful wording of the example in my post it isn't C# vs VB
it is the VB function library versus "every other dotnet language."

I don't think this is actually true. Many programming langauges targetting
..NET or providing access to the .NET Framework come with their own libraries
(Delphi.NET, J#, VB.NET, C++/CLI, ...) and/or contain language-specific
statements which are common to the langauge (VB.NET, Eiffel.NET, ...). Only
C# (and maybe some other .NET-based programming langauges) which has no
history and clear predecessor doesn't come with its own library. So I think
its more "C# vs. .NET-based programming languages with their own libraries"
instead of "VB function library versus "every other dotnet language".
Striving to be different for no apparent benefit is the problem. Where a
funny hat if that is the VB-er's goal.

VB had its function library already when C# didn't exist at all, so this
point is not valid.
 
T

Tom Leylan

Very few people believe that C is where object-orientation came from and I
don't know why you think so. A simple check on the Internet will give you a
pretty good understanding of the lineage of the various programming
languages.

That aside how does UCase() in a VB library constitute a "nicer
implementation" of OOP? Somebody states "they're classes under the covers"
and then they state is "C# doesn't have it" and then "yeah VB is much
better", etc. If they are classes then how is they aren't OOP, if they are
OOP then how is it that similar classes can't be written in any other
language?

This makes no sense.


Cor Ligthert said:
Herfried,

Right, exact as it is and much nicer than all those ugly C variants on
this.

I wish the OP to point on the faq that there are a lot of people who think
that OOP has to do with C derived languages and that therefore the way
something is used in those languases is the Net way. Nothing is less
worth. Often VB.Net is much nicer implementing OOP, probably because they
don't have to do with C legacy..


Cor
 
C

Cor Ligthert [MVP]

Hi to Tom and Michel,

I think I have all what I have to say told in this thread and you know my
points.
Well if I had VB on the Singer-Frieden printing terminal (and it's paper
tape input) I might have started with it also.
Michel, in the March 2007 number of the Dutch .Net magazine there will be a
picture from that Singer-Frieden printing terminal. (Tom sorry it is in
Dutch) in an article from me.

Cor
 
C

Cor Ligthert [MVP]

Tom,
It may seem like that to you but that isn't what the message is. Computer
languages form "contracts" between the developer and the machine. Legal
contracts use specific words to reduce ambiguity and programming contracts
must similarly choose systems which reduce ambiguity.
That is your opinion, and my opinion from 35 years ago. I have learned in
that time, programs are made by humans for humans. Not for computers,
computers have only to process them. However they are made as well, that
they can understand many languages. So let them do for what they are.

One in English, is nothing else than Un in France, Een in Dutch, Ein in
German,Uno in Italian and Jeden in Polish. I have not any problem to
translate those words direct in my human mind. For a computer it is much
easier. Your sentence shows in my opinion a small perspective with
languages.

I assume that Herfried can confess what I am saying that it is for him the
same.

Cor
 
C

Cor Ligthert [MVP]

Tom Leylan said:
Very few people believe that C is where object-orientation came from and I
don't know why you think so. A simple check on the Internet will give you
a pretty good understanding of the lineage of the various programming
languages.

That aside how does UCase() in a VB library constitute a "nicer
implementation" of OOP? Somebody states "they're classes under the
covers" and then they state is "C# doesn't have it" and then "yeah VB is
much better", etc. If they are classes then how is they aren't OOP, if
they are OOP then how is it that similar classes can't be written in any
other language?

This makes no sense.
You are with this last sentence, I absolutely don't see what you want to
say.

I hope that you understand that when I write C, that I mean C derived
languages as C++, Java, and C#. I don't assume as well not that when you are
writing VB you mean VB1.

Cor


 
C

Cor Ligthert [MVP]

Tom,

I was glad that I could read that about PDF, it was knowledge from the past
and my knowledge is again sharped by this newsgroup. That does not mean that
it is for everything.

Maybe you can do that as well, I doubt it, your texts are quiet conservative
and seems to be based on old school books.

Using a shared class can be OO but it is not OOP. It is just modulair
programming, a C langue like static class is just a way to be able to use
the benefits of a module. (Before try to set this text again out of its
context, I use a lot of Static classes if they can help me to do the job
better).

Cor


Tom Leylan said:
Cor you're starting to make things up. First the "stealing" when somebody
makes a PDF library and now this.

What isn't OOP?


Cor Ligthert said:
Anon,

Be aware that it is not OOP, you forgot to tell that.

Cor

_AnonCoward said:
:
: Whats the easiest way to make a global function in VB 2005? The
: old way was make a module, is that still the standard? thanks!


Try shared methods. These methods are available to every instance of a
type and can even be accessed without an actual instance being
declared (e.g.: the System.Console.WriteLine() method). It should be
noted that shared methods cannot operate on non-shared members of the
class. The following will not compile:

=========================================
Public Class [class]

Private i As Integer = 0

Public Shared Sub Method()
Console.WriteLine(i)
End Sub

End Class
=========================================


Ralf
--
--
----------------------------------------------------------
* ^~^ ^~^ *
* _ {~ ~} {~ ~} _ *
* /_``>*< >*<''_\ *
* (\--_)++) (++(_--/) *
 
H

Herfried K. Wagner [MVP]

Cor,

Cor Ligthert said:
I was glad that I could read that about PDF, it was knowledge from the
past and my knowledge is again sharped by this newsgroup. That does not
mean that it is for everything.

Maybe you can do that as well, I doubt it, your texts are quiet
conservative and seems to be based on old school books.

Using a shared class can be OO but it is not OOP.

I tend to agree.

C#'s static classes (all members are enforced to be static) are similar to
VB's modules except that C#'s static classes can contain static constructors
(which can be useful) and VB's modules are imported automatically.

I consider modules as "namespaces for methods", which are not really an OO
feature. That's a typical procedural/modular programming feature. Although
C# uses the term "static class" these classes do not represent real entities
too (no polymorphism through inheritance and overriding and no
instantiation). That's why I think that "static class" is a very bad choice
for the purpose those classes serve. They are simply a procedural grouping
construct, nothing more (the implementation based on classes in the IL does
not matter here because even 'Module' makes this implementation detail
transparent).

The main problem I am seeing is that most C# users think that OO is the only
right way to do things. However, that's nonsense. Every carpenter has both
a hammer and a screwdriver in his toolbox. Most of them have even very
specialized tools for certain purposes in their toolboxes which simplify
work and are much more suitable than the generic hammer. It's C# that tries
to be different by imposing unjustified limitations over their users.
 
T

Tom Leylan

It is important as I mentioned before that you realize that we are not going
to agree.

I don't think it's easy to decide where to draw the border between
something being supported explicitly in the programming language's syntax
or exposed as part of a library only. Take C#'s 'using' keyword as an
example:

Most languages include a document which states what is part of the language
it is called the language specification. Here is one on Java
http://java.sun.com/docs/books/jls/ here is one for C#
http://msdn2.microsoft.com/en-us/vcsharp/aa336809.aspx

In the case of most languages there is a common library but these are not
part of the language specification. The DotNet library contains the common
set (as defined for DotNet) and regardless of the language used this library
constitutes part of "the library" not a language.

Use of a common library is a benefit.
One could argue that 'using' is only a shortcut, and it's actually nothing
more than a shortcut.

Only if one was interested in arguing.
Nothing prevents C# developers from adding a reference to
"Microsoft.VisualBasic.dll" and using the functionality provided by this
DLL.

Yet (I believe) they don't.
 
T

Tom Leylan

I don't think this is actually true. Many programming langauges
targetting .NET or providing access to the .NET Framework come with their
own libraries (Delphi.NET, J#, VB.NET, C++/CLI, ...) and/or contain
language-specific statements which are common to the langauge (VB.NET,
Eiffel.NET, ...).

While I used to know Delphi fairly well I know next to nothing about
Delphi.Net. A quick check confirms however that modifications were made to
the language (I notice that adjustments were made by SmallTalk to accomodate
their .Net implementation as well). I'll assume (without actually
searching) that Eiffel has done the same. The basic thread among these
changes is that modifications were made to conform to the DotNet model and
not to something called the C# model.

Clearly as in the case of VB there is a concern for all existing code.
Nobody is completely unaware of the need to migrate software and developers.
Do these developers all gather an say how dumb VB is because it doesn't have
a Foo() function? I hope not but it is of course possible. If they did
wouldn't you reply "but we can write such a function if we need it"?
VB had its function library already when C# didn't exist at all, so this
point is not valid.

BASIC had functionality long before Visual Basic existed but we don't need
to retain "everything" when moving forward. Languages evolve... humans no
longer need a tail, it isn't "sad" that we no longer have one and it
wouldn't be "cool" if we did. We don't need a tail and VB doesn't need
UCase(). Visual FoxPro doesn't need four ways to comment code. All this
legacy stuff gets in the way.

Make it "maintaining differences for no apparent benefit" then. Again we
will not agree and you don't have to change your coding style for my
benefit.
 
T

Tom Leylan

That is your opinion, and my opinion from 35 years ago. I have learned in
that time, programs are made by humans for humans. Not for computers,
computers have only to process them. However they are made as well, that
they can understand many languages. So let them do for what they are.

Computers understand nothing. If they are so smart then why are there bugs?
One in English, is nothing else than Un in France, Een in Dutch, Ein in
German,Uno in Italian and Jeden in Polish. I have not any problem to
translate those words direct in my human mind. For a computer it is much
easier. Your sentence shows in my opinion a small perspective with
languages.

A language isn't made up of the word "one". Take some time off from
studying copyright law and study human languages. You will realize there
are conceptual differences in the meaning of many words that on the surface
"seem" the same. But don't take my word for it, write up a sample contract
and ask an attorney to read it through. Learn for yourself how what you
personally think something means is not what the law says it means.

What is an oorxax? What does mata ego mean? If you such a language whiz
you can translate this in no time.

Cor this isn't something I made up yesterday; law, medicine, science,
engineering and what have you operates like this. You can't decide what
"area of a circle" means, it's been done already.
I assume that Herfried can confess what I am saying that it is for him the
same.

He can "confess" all he wants. Maybe you can admit you're demonstrating how
language can be misinterpreted (from thefreedictionary.com)

con·fess (kn-fs)
v. con·fessed, con·fess·ing, con·fess·es
v.tr.
1. To disclose (something damaging or inconvenient to oneself); admit. See
Synonyms at acknowledge.
2. To acknowledge belief or faith in; profess.
3.
a. To make known (one's sins) to God or to a priest.
b. To hear the confession of (a penitent).
v.intr.
1. To admit or acknowledge something damaging or inconvenient to oneself:
The suspect confessed to the crime.
2.
a. To disclose one's sins to a priest.
b. To listen to a confession.
 
T

Tom Leylan

I was glad that I could read that about PDF, it was knowledge from the
past and my knowledge is again sharped by this newsgroup. That does not
mean that it is for everything.

It wasn't a specific failure it was a systemic failure. It isn't about PDF
files it is about copyright law. You know nothing about it and you didn't
imagine somebody could license something from another company. That isn't
an "I didn't know that about PDF files" that's an "I don't know how business
operates."
Maybe you can do that as well, I doubt it, your texts are quiet
conservative and seems to be based on old school books.

Informed guess or wild speculation?
Using a shared class can be OO but it is not OOP. It is just modulair
programming, a C langue like static class is just a way to be able to use
the benefits of a module. (Before try to set this text again out of its
context, I use a lot of Static classes if they can help me to do the job
better).

According to whom? It isn't that I doubt you after all what could the
developers of SmallTalk, C++, C# and Delphi know? You just didn't get
around to explaining things to them.

Just pick a topic and stick with it... why isn't a static class OOP?
 
T

Tom Leylan

I hope that you understand that when I write C, that I mean C derived
languages as C++, Java, and C#. I don't assume as well not that when you
are writing VB you mean VB1.

Okay I'll refine the statement: Very few people believe that C, C++ or Java
is where object-orientation came from and I don't know why you think so. A
simple check on the Internet will give you a pretty good understanding of
the lineage of the various programming languages.

For gosh sakes object-orientation did not come out of C nobody who studies
this believes that to be the case. What I find so remarkable is that you
attribute these things to people like they can't read. Or in the case of
your other reply to me like my books are older than yours.

It's a shock I'm sure but some of us can and do read. :)
 
C

Cor Ligthert [MVP]

Tom,

Maybe I am to long in this business that I have not even seen it myself that
what you want to tell is not true.

Using the first generation of languages people recognized that they could
not communicate with a computer in the same language. There was something
needed to make it for both possible to understand.

Therefore we got the second generation of languages. Completely lined up
with the idea that it should be for both not to misinterpret. (Although in
that phase it was already not succeeded on the human side).

We got then the 3th generation of languages. Split up in a kind of
mathematical ones Algol/Fortran, who tried to achieve what you are in my
idea writing and Cobol based on the human methods of using business
language. The last means that there can be synonyms.

A true good natural language has a lot of synonyms, which makes it easier
for people to express themselves. A will not say that English is a good
natural language, but the aspect of synonyms it fulfils complete.

When I am talking with by instance an Italian (or another one who has as
native language a Latin based one), than I am using different words as he,
because I choose often the Germanic ones.

Probably you will see this in the US as well where maybe the people from New
York are using other words than in the South of California while saying the
same.

This has a computer in my idea to understand as well and therefore is for me
Visual Basic a more natural choose than C#.

Cor
 
M

Michel Posseth [MCP]

Hi Tom ,

ofcourse this should have been Basic :) without the Visual thingy
Where a VisualBasic assembly method or constant has a Framework equivalant,
a Visual Basic programmer has a choice. Use the VisualBasic assembly method
or constant, or use a Framework equivalent .

Maybe this choice shouldn`t have been given from the start of VB.Net , if
it was the idea that we should abbandon the VB specific methods in favor of
the framework , however they did so there must be something good in the VB
namespace ...........
I fear this will be a difficult thread to follow as everybody arches their
back and prepares to defend their turf :)

I am afraid you are right :)

However i enjoyed reading your comments regarding this subject

regards

Michel Posseth
 
T

Tom Leylan

Cor: If you have a minute look up SmallTalk (if you don't think it is an OO
language then I don't know what to say) and you will see that it has Class
Methods aka "static methods". As does Ruby, as does Python as does Java. I
could check Simula too if you need it but is the developer of SmallTalk
wrong?

Does having invented SmallTalk count for anything or did he simply fail to
read a book?

It has had static methods for some 30 years, why is this even being
discussed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top