|
I agree. It sounds like the original code was written in .NET "VB6 procedural" style, and not leveraging any of the benefits provided to VB developers through .NET. It's an unfortunate side effect of people not upskilling their techniques with the move from VB6 to VB.NET.
|
|
|
|
|
Haha. I hate to say this, but in my career, I keep coming across projects that are mostly C# with a small percentage of awful VB.Net code. (I do find GOOD VB.Net code on the 'net.)
For example, in my first job out of college, 95% of the code was in C#. There was one group of dlls written in VB.Net where the developer had all methods take a single array of objects as THE argument. Even weirder was that almost all of the values being passed on the stack belonged as object-level fields. The code was an example of how NOT to use weak typing.
It was very clear to me that the original developer spent a few months on the code... I re-wrote it all (from scratch) in 3 days!
|
|
|
|
|
I work on an app that was started by someone else in VB.NET. I hope it was the conversion to C# that causes me to still find code like:
for(int i = 0; i <= myObject.Length - 1; ++ i)
or, even better:
int g = item.Count - 1 + 1;
I find examples of both of these almost every time I wander into the guts of stuff I've not had to touch before, like some of the basic controls we suddenly decide to change after 2 years.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
?That sounds like the kind of moment where you wish the ESC button worked.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
*grin* yeah, I certainly did a double take.
Converting to C# took a half day to make work, and 2 days more to make work once I removed all references to the Microsoft.VisualBasic namespace. It was well worth it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What a mess.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
Yeah, I had been contracted and written dlls in C# which the app was using. It didn't occur to me that the main app could be VB.NET. Obviously VB.NET could do most of it ( it couldn't do the stuff I wrote, as it happens ), but I just hate it, and it's not a productive language for me.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
VB.NET is the devil. There, I said it.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
Yup. I prefer C#. It is elegant.
|
|
|
|
|
There's nothing more frustrating than maintaining crappy code
Elegance is in the hands of the coder. You can write efficient and elegant code in pretty much any language (VB.NET is no exception), just as you can write jibberish, inefficient code in pretty much any language (C# is no exception).
Unfortunately it sounds like from this forum that VB.NET is the language of preference for hacks, which disappointingly gives the language a bad name.
|
|
|
|
|
Eduardo Fandangle wrote: Unfortunately it sounds like from this forum that VB.NET is the language of preference for hacks, which disappointingly gives the language a bad name.
The language was designed for hacks. Literally. Important design choices were made to support VB6 hacks. A bastardized upgrade to a bastardization of a bastard language. Little surprise that the hacks seem more comfortable...
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
|
|
|
|
|
I love vb.net
You're all just jealous of not having My.Settings :>
Ok, I'm just joking. Noone freak out
www.wickedorange.com
|
|
|
|
|
Hear hear Eduardo!
David Loring
!! Keep Music Live !!
|
|
|
|
|
If C++ is heaven and VB.Net is hell then C# is probably purgatory.
|
|
|
|
|
Amen
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Personal Site
|
|
|
|
|
Pascal Ganaye wrote: C++ is heaven and VB.Net is hell
VB.NET might be hell - I can't comment on that.
But C++ is certainly not heaven.
Its more like the treadmill of everyday life:
Somtimes fun and really exiting, somtimes making you mad, but most of the time just plain boring and repetitive.
Failure is not an option - it's built right in.
|
|
|
|
|
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Christian Graus wrote: int g = item.Count - 1 + 1;
Well this is no help for your cause but I upgraded some custom paging code written in ASP to VB.NET.
If intPageLength <= (intTotalPages/intPageLength - 1) + 1 it took me forever to fix that crap.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
A small snippet from inside the .NET Framework (2)...
<font color="#1000a0">if</font> ((<a title="string portName; // Parameter">portName</a> == <font color="#800000">null</font>) || !<a title="string portName; // Parameter">portName</a>.<a title="bool System.String.StartsWith(string, StringComparison);" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.String/StartsWith%28String,System.StringComparison%29:Boolean">StartsWith</a>(<font color="#800000">"COM"</font>, <a title="System.StringComparison" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.StringComparison">StringComparison</a>.<a title="StringComparison System.StringComparison.OrdinalIgnoreCase;" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.StringComparison/OrdinalIgnoreCase">OrdinalIgnoreCase</a>))
{
<font color="#1000a0">throw</font> <font color="#1000a0">new</font> <a title="System.ArgumentException.ArgumentException(string, string);" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.ArgumentException/.ctor%28String,String%29">ArgumentException</a>(<a title="System.SR" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.SR">SR</a>.<a title="string System.SR.GetString(string name);" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.SR/GetString%28String%29:String">GetString</a>(<font color="#800000">"Arg_InvalidSerialPort"</font>), <font color="#800000">"portName"</font>);
} from the System.IO.Ports.SerialStream constructor, why check for a port name that does not begin with COM? Other Win32 stuff doesn't do this, proof via Hyperterminal.
Thankfully MS said they're going to remove this from the next version of the framework
|
|
|
|
|
posted it long time back in lounge but still deserves to be posted here
Our customer reported once that the program we shipped is corrupting his windows somehow considering it was simple data processing application i was dazed and confused so i asked him what happens he said windows is showing a Message box "Internal windows error, please restart"...... six hours later
i found this in the code
try
{
.
.
.
}
catch(...)
{
MessageBox("Internal windows error, please restart");
}
i was so mad partly at the *briliant coder* who wrote it and partly at myself that i didn't enforce code reviews before shipping
to his defense he said "i didn't think an exception could happen there"
for people who care it was a Divide by zero exception
I dislike feeling at home when i am abroad.
|
|
|
|
|
While I was module lead in my previous organization[^], during peer code review, I found one developer doing this
try<br />
{<br />
opendb();<br />
}<br />
catch ()<br />
{ <br />
try<br />
{<br />
opendb()<br />
}<br />
catch ()<br />
{<br />
throw ...<br />
}<br />
}
The purpose of opening connection in catch and again catching it. He couldn't answer why he coded that way!
|
|
|
|
|
buahahahahahaha that's good
|
|
|
|
|
hehe and I thought programmers are almost the most logically thinking people.
|
|
|
|
|
Logically Thinking -- True.
But sometimes, throws exceptions.
|
|
|
|
|
When I first starting programming in .NET I was fairly new to object-oriented programming. The first program I ever made for .NET had 2 classes that needed to communicate together. I accomplished this by creating a .dll in VB.NET that used implicit late-binding to call the methods in the other class. After a while I realized I could just pass a reference to the class it needs to communicate and it could call the methods directly. 2
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|