Good read: What's wrong with VBA

AB: Regarding the coffee - I'm joining you in spirit despite the distance. Cheers!
 
Doc: Most of the topics in this forum are outside of my wheel house. I can however appreciate the time an effort required to comment on them with your level of expertise.
Cheers!
 
VBA would be a "bad" language, not because of its limitations but because of its flexibility!!

It is precisely because the original C language was so loose about data typing that I refused to learn it. C in the early days was the only language I knew that needed some type of pre-compiler to warn you of data type abominations. I know that more modern variants of C do better about that, or at least they CAN do better - but I found the loose structure of early C abhorrent. To me, C was a TERRIBLY bad language when it first came out. Though I'm glad we didn't get saddled with B.

Some of you might think I'm kidding, but the predecessor to C was called B, and C was an improvement over it. But then again, I knew how C had originated. That was another reason I didn't like it. It was actually a bunch of really complex assembly language macros written in the PDP-11 assembler. Want to guess where C got the "(X)+" and "-(Y)" syntax? Pure PDP-11 assembler.

The way I saw it, I was already so fluent in PDP-11 MAC that I didn't need C anyway. Still don't, since I'm no longer an active product programmer.
 
Last edited:
The fact that VBA supports multiple ways to do certain things makes it bad rather than good. It causes confusion and makes people have to think about things that they should not have to worry about.
OK you guys, this is HUGE problem in almost any platform that has been released. Doesn't matter what it is. I suspect that this is done on purpose by the creators as an attempt to give programmers multiple ways to do the same thing in the event that if one way fails or is incomprehendable, then another is available. that makes perfect sense.
As an example, in VBA, the & is the concatenation operator. Therefore 1 & 1 should = 11.
are you sure that wouldn't result is a bitwise calculation? I've never tried it. Or would you have to use 'AND'?
So as a programmer reading code, you have to think about some code that is:
varX = varA + varB
javascript uses '+', so does many other languages. in PHP, it's '.'. In Oracle it's '||'. I recently did an interview and took an SQL test and the WILDCARD symbol was "%". :rolleyes: Since I've done a lot with PHP, I'll say that the language is annoying as hell with all this:

|| = OR
. = AND (for strings/strings, strings/nums, nums/nums)
! = FALSE (applies to everything)
&& = TRUE (applies to everything)
.= = CONCAT (preceeding value + trailing value)
== = COMPARE (both values are equal, but not necessarily the same type)
=== = COMPARE (both values are equal and same type)
++ = INCREMENT
-- = DECREMENT

and let us not forget the notorious dollar ($) sign, which if it did not exist, neither would PHP.
 
Could be worse: You might run across APL, a Ken Iverson special for mathematical programming, in which the basic data type is a multidimensional array. If you guessed that it was oriented towards matrix operations, you wouldn't be wrong, but it does more than just that. It has some derivative languages that are insanely complex.

I would have to start dinking with a special character set (not completely ASCII based) to show the syntax, but since it is a language I have only read about, I wouldn't know what I was telling you if I reproduced it. Wikipedia will tell you more than you ever wanted to know about it.
 
The horrors from VBA stemmed from its accessibility, which allowed a lot of terrible code to propagate. The reputation of Access also suffered for the same reason.

Eventually the dislike became cultural. Those who wanted to be considered "proper" programmers bagged VBA because that is what they saw those they perceived as proper programmers do. A bit like proper musicians or music fans hate certain kinds of music.
 
G., I don't know about "proper" but I have to admit there are three types of music I don't allow in the house.

1. "Howlin' dawg" country laments - where if the moon isn't full, it should be, because all the dogs will be howling anyway.

2. Extreme super-heavy-metal acid rock - which might include but surely is not limited to "music" from GWAR. I like my music to be of the type that (a) I can understand and (b) I can hear it and (c) after the event, I can hear normal conversations because my ears haven't been burned out.

3. Angry ghetto / gangsta rap - where they talk of popping caps (and aren't talking about bottled beer), and they talk about hoes (and aren't referring to long-handled garden implements.)

Any other music is fair game.
 
3. Angry ghetto / gangsta rap - where they talk of popping caps (and aren't talking about bottled beer), and they talk about hoes (and aren't referring to long-handled garden implements.)
I love this type of music someimes. All those uncensored cuss words. Songs that I have that fall into this category:

Rolllout - Ludicris
Hot in Herre - Nelly
In Da Club - 50 Cent
 
I think I would find a real "normal" pointer useful - one that can easily reference and dereference a user defined structure, and enable you to build your own doubly linked list, or tree. You know, instead of a pretty useless "collection". Posters claim you can build your own pointers, but it's not that easy, I don't think.

A nice "in" operator in VBA would be good.

Finally, in my opinion, arguments should be byval, not byref. The programmer should need to explicitly declare byref.

[edit - and make explicit variable declaration mandatory, ffs]
 
Last edited:
Finally, in my opinion, arguments should be byval, not byref. The programmer should need to explicitly declare byref.
I've seen many examples over my short career of developers using one of these in favor of the other, and the one that is not used *should* be the one to use. Is there any ambiguity still present in the minds of developers regarding the purposes of these 2 declarations specs? I have a suspicion that a lot of developers don't even know the difference between the 2. Is that the case? And are there "function call" situations where it really doesn't even matter which one is used? I ran into this many many times working in aerospace.
 
"pearls before swine" and similar adages - often remind me of "the mote in one's eye", or maybe "in god's eye", as Niven/Pournelle would have it.
 
I've seen many examples over my short career of developers using one of these in favor of the other, and the one that is not used *should* be the one to use. Is there any ambiguity still present in the minds of developers regarding the purposes of these 2 declarations specs? I have a suspicion that a lot of developers don't even know the difference between the 2. Is that the case? And are there "function call" situations where it really doesn't even matter which one is used? I ran into this many many times working in aerospace.

it probably goes back to Pascal and Wirth. A byref argument can introduce unexpected side effects. So if you make everything byval as standard, and make the programmer explicitly declare byref if that's what he wants, it makes it safer.
 
So if you make everything byval as standard, and make the programmer explicitly declare byref if that's what he wants, it makes it safer.
I have rarely seen byRef used. it's usually byVal, and if it's not byVal it's nothing at all.
 
I have rarely seen byRef used. it's usually byVal, and if it's not byVal it's nothing at all.
You don't see byRef, explicitly stated in VBA arguments because it is the default.

Sent from Newbury UK
 
I have a suspicion that a lot of developers don't even know the difference between the 2. Is that the case? And are there "function call" situations where it really doesn't even matter which one is used? I ran into this many many times working in aerospace.
First of all I completely doubt there are any real "Developers" who do not know the difference. Next you will tell me you know serious developers who cannot declare variables and do not know how to build a class module.

I say 99% of the time (depending on how you write code), it does not matter. Normally what you pass in as an argument gets used but not acted on. In that one percent of the time you better know the difference.

Example:



Code:
'Matters should be byval
Public Function Add2(Val as Long) as long
  val = val + 2 ' acted on parameter
  add2 = val
end function

'does not matter
Public Function Add2_New(Val as Long) as long
  add2_New = val + 2
end function

Code:
Public Sub Test
 Dim x as long
 Dim y as long
 x = 2
 Y = add2_New(x)
 debug.print x & " " & Y
 y = Add2(x)
 debug.print x & " " & Y
end sub
if it's not byVal it's nothing at all
No! If it is not explicitly ByVal it is ByRef. But yes more updated languages tend to default byval. VB.NET is byval as default.
 
Next you will tell me you know serious developers who cannot declare variables and do not know how to build a class module.
smarta$$. :p I'm sorry, I should have said: "the people I work with", not "developers".
 
MajP,

Excellent example. I have asked this question before and I have had it explained to me and I didn't want to admit to Doc and Galaxiom that although they did their best to dumb it down for me, I still did not get it. So I said thank you and went on my way.

Even with your explanation, I still had to load up your code and step through the process to get it through my thick skull - but it DID get in and the light bulb was bright indeed!

Really appreciate the example.

John
 
I have asked this question before and I have had it explained to me and I didn't want to admit to Doc and Galaxiom that although they did their best to dumb it down for me, I still did not get it.

You were probably looking for something more complicated than it was.
 
vba_php said:
smarta$$.

Adam, I have tried before in private to explain to you that you are your own worst enemy. You have no internal censor. I'll be the first to admit that MajP and I don't ALWAYS see eye to eye but he never deserves that kind of response. Whether HE calls you down or not, I am calling you down for a disrespectful response.

You don't seem to get it despite all of us telling you, publicly or privately, that you are presenting a bad face to the world. And despite your prior PM asking me to not call you down in public, this is one that NEEDS to public.

Just remember, Adam, that politeness is the lubrication of the gears in the machine of human communication. I have tried to be polite but with you it is not working. You say (in another post) you want to be my friend. I am not against that idea, but friendly IS as friendly DOES (to paraphrase that paragon of earthy wisdom, Forrest Gump.) You want to MAKE friends, you have to BE friends (to paraphrase ANOTHER paragon, Will Smith as agent J in Men In Black).

If you don't get this message, you will continue to have folks calling you down and not treating you seriously. Yet I'm sure that you DESIRE to be treated seriously and I even can understand that motive. Asking to NOT be called down in public is a variant on "political correctness" - which is often just an excuse to stifle someone's desire to say what needs to be said.

Think about it. Don't slough it off. You have stated that you think I have some wisdom to share. Well, I just shared some on a specific topic called "relationships." And I don't mean of the database kind.
 

Users who are viewing this thread

Back
Top Bottom