On the triviality of certain problems
One problem with a tendency to get outa hand in mixed VB.Net and C# environments is the issue of Optional parameters. In VB, Optional parameters may appear or not as in
Public Function trivialPursuit(ByVal intNeeded As Integer, Optional ByVal strOptional As String = "")
intNeeded must be specified, but strOptional may be omitted as in
trivialPursuit(intNeeded)
or in VB 6 and before
trivialPursuit intNeeded ' Yecchhhh
strOptional may be included two ways. A bad way in VB 6 was positional
trivialPursuit intNeeded, strOptional ' Bleeegh
The best way by far is to identify the optional parameter by its name as a nonpositional keyword
trivialPursuit(intNeeded, strOptional:="Blrag")
The problem in .Net is that optional parameters are not supported. The solution, when combining a .Net VB and .Net C# assembly or DLL, is to build a wrapper where the optional parameter is defined and call it from C#.
The problem arises in organizations where hard-pressed middle managers manage of necessity by sound byte, keyword, and bottom-up folklore. "We need to rewrite that code in C# because it uses optional parameters" is heard in the land.
This arises from a breakdown in the ability to factor in organizations, and my belief is that American organizations, with a tradition of management controls, resist grassroots factoring and wrapping.
The "software crisis", in other words, was in part endogenous, iatrogenic, and American, caused by excessive controls.
Having said this, it remains wise to AVOID optional parameters in new code altogether and to REPLACE them with overloaded calls.
The best VB.NET looks more and more like C#. For example, I like the With clause because it makes regions of code indentable (thus more "structured") and more maintainable because the name of the focus variable can be changed in one place.
Many C# specialists, not having this facility in C#, don't like it when they see it in VB. For example, Corey Haines thinks the use of With in my compiler sucks.
The facility DOES NOT BELONG in C#.
This is because in VB, block structure is created by a short list of compoundable statements such as If, For, Do and With itself, each of which are balanced by an End.
The original Basic had no block structure whatsoever because during the year of its design, Fortran was mindshare dominant and Algol was subject to that POLITICAL mistrust of anything from the European Continent.
Algol's true practicality was to allow microfactoring and micro separation of concerns on the part of the programmer who, in the powerful fact that begin and end keywords in Algol were able to create ONE statement out of MANY statements, had workplace control.
Whereas in America at the time, most programmers were expected to be men, in grey flannel suits, working at one predefined task at a time. Creativity was discouraged until it was found to be necessary.
But when the value of structured programming was realized subsequent to Dijkstra's March 1968 letter to CACM, Basic compiler writers and language designers got busy, sort of, adding "structured constructions" on a by-exception and timid method to Basic.
That is, they focused on If and looping only, and added the structures we now know. However, they maintained for a long time (until Vb.net, in fact, if we consider Microsoft as inheriting Basic by default) Go To.
They made a subtler error.
Begin and End should have been added to Basic, such that Begin End was in all areas A SINGLE STATEMENT...just like in Algol.
There would have been NO NEED to add "compound" If or looping constructs had this been done.
Instead, the for statement would have been defined as
forClause, newline, statement
Note that the construct needs no End For, because (just as in languages in the C family) the statement, when compound, REQUIRES an end "delimiter", an end "fat parenthesis".
Indeed, many C programmers seem to add extra right brackets (the "end") because they are unclear on to which clause, to which statement, the end bracket belongs. It has become "safe" practice to code in C
for ( intIndex1 = 0; intIndex1 < intSize; intIndex1++ )
{ blarg }
where
for ( intIndex1 = 0; intIndex1 < intSize; intIndex1++ ) blarg;
does the job.
(Why the semicolon? C made a mistake. Semicolon in C is not as it is in Pascal, a statement SEPARATOR it is a statement TERMINATOR. It BELONGS to the statement on the left. But if the statement ends as in the first example with a statement compounded with left and right braces, the semicolon has no function. If you add it, you've added a null valid statement.)
Which is why C has not the "clean" design touted by its avatars: which is why they say "change your major" to the age old question "how do I get rid of my C compiler errors?"
In fine, old Fortran habits of thought persist even in the use of the "elegant" languages. The reason for this is social and not technical.
Most people, in my experience, don't get to attend an ivy covered campus to learn programming where from wise old men and women, they begin with first principles, and are initiate gently into the temple mysteries.
In America, most people are directed into military service instead or as a prerequisite to the groves.
The result is that programming training happens double quick and in a fashion inspired less by the wise old guru and more by Sergeant Rock:
"OK YOU GIRLS! YOU DON'T KNOW WOOD FROM CANVAS! YOU DON'T KNOW S*T FROM SHINOLA! YOU DON'T KNOW A BIT FROM A BYTE FROM YER MITHER! I'M HERE TA SHOW YA!"
or, the Crusher, a Chicago wrestler who wrote the deathless 1962 song, The Crusher:
"OK YOU TURKEY NECKS! I'M GONNA SHOW YA HOW TO DO DA CRUSHER!"
I use this model when I train but am constitutionally incapable of projecting the old fashioned Sgt Rock. However, I am physically fit (my DeVry students thought I was military or CIA) and can project the slightly lunatic lefttenant in the British forces:
"I say, you chaps, how about a ten mile route march down to al Kadeer and return, where they have all that sand? Knew you'd be pleased. Now, if you please, let's all get on parade."
The result is that in many classes other than mine, the students are presented with a deliberately oversimplified set of "key" concepts including the COMPLETELY OUTDATED notion of a "simple" statement as opposed to supplementary complexity.
That is, the tyro learns a false dichotomy.
He learns that there is a set of more or less officially sanctioned statements and THEN a set which he learns, in the stress of the learning experience, are dangerously supplementary and NOT TO BE USED unless you know what you are doing (do we ever?)
In a more academic class, the student starts with true fundamentals in terms of power. Thus I present early on in C training the EMPOWERING fact that brackets make single statements out of many.
The American military has evolved, since the end of the draft, away from telling soldiers to obey orders and take things in disempowering bites.
However, the GERMAN military also became "an army of one" after Kaiser Wilhelm got beat in 1918 by Marine Devil Dogs trained while stealing land from Indians and oppressing Filipinos to show individual initiative. The culture of initiative in a military experience always confronts the base culture of why must I die on these bloody sands, and ultimately, the man who does so is being obedient to "higher" authority.
Workplace "empowerment" and workplace "creativity" is forever confronted in reality with the need to simply plow ahead, and doing what the boss says. My Generation hoped, silly us, to end this and replace it by peace, love and creativity. But before the project even got started, its members started ruining their lives with drugs as the quickest way to Nirvana, being unwilling to accept that there are milder forms of empowerment.


Recent comments
3 weeks 6 days ago
3 weeks 6 days ago
38 weeks 6 days ago
39 weeks 5 days ago
39 weeks 5 days ago
40 weeks 5 days ago
41 weeks 1 day ago
41 weeks 1 day ago
41 weeks 3 days ago
41 weeks 4 days ago