|
And Danish code is just sweet!...
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
that's just too funny. I guess he's a bit cranky. I happen to be a bit of an armor historian buff, and the big, bad German tanks of ww2 were mostly junk. Credit to the 88 and the high velocity 75, but reliability is everything. The Tiger 2 and Panther broke down at horrendous rates. The panther's armor was spotty at best with mediocre quality of the armor plate, etc.
Kelly's Heroes Tiger Tank - YouTube[^]
Reliability was key. So, I appreciate the comment on the complexity of the arty pieces. I just wish some of the defense contractors in the US would learn.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Yeah, so it's long and wide, some methods have to be; what have you replaced it with?
|
|
|
|
|
|
So what?
As far as I've seen it, all the magic numbers are commented (not totally sure, somewhere in the middle my eyes began to bleed)...
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Well, that code brings me back to the 90's. Typical "journeyman programmer" production. The journeyman programmer doesn't care about software engineering or improving the skills in their trade, just hack away until it works... eventually they work up their way to be project manager and leave the crap to someone else to maintain . Don't let it get to you too much the first 20 years are the worse
|
|
|
|
|
Very well put I wouldn't even use the word 'programmer' in the same sense as VB, more like 'user'.
VB - curse of many bad project implementations.
|
|
|
|
|
In fairness, a lot of bad implementations are done in other languages, I dare say there are as many shocking apps developed in C# as there are VB.Net.
|
|
|
|
|
|
I third that. I have seen far too much bad code in many languages.
Bill W
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
14 more to go, i hope i'll make it...
It feels good to learn and achieve
|
|
|
|
|
Message Closed
modified 20-Jun-23 15:45pm.
|
|
|
|
|
Arnaud Lhopiteau wrote: I am so proud that I can not resist to post the fixed method Big Grin
No, 571 line long method can be considered non-broken.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
I got a headache after the word Sub in line 1 and stopped reading.
Vita est usquequaque virtus victus ut plenus. Ego non sum semper iustus tamen Ego sum nunquam nefas!
|
|
|
|
|
Did the author die?
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
That depends. Did the person who maintained the code have his home address?
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I have seen worse Russian code.
Best thing to do with monster code is to use some reflections on it.
|
|
|
|
|
Most code is like Dr.Frankenstein's mosnter. The only difference between good monster and bad monster is the good one has it's legs and hands and all else where they should be.
|
|
|
|
|
This is some sample code from an SDK, published by a medium-sized company who I will of course not name. (For one thing, my job is somewhat tied to their work... .)
It was so bad I rewrote it in place, and I couldn't resist a side-by-side comparison of my code and the original code.
(Side note: this code was apparently auto-translated by a tool from C# to VB.NET at some point during its life... it's possible that some of the horror is auto-generated, but how much of this could be from that source? And anyway, that's pretty bad in itself.)
''' <summary>
''' Parses the Input txt File by Rows and returns a array of string of input rows
''' </summary>
''' <param name="filelocation">System Path of the File </param>
''' <returns></returns>
Private Function ParseTheFileByLine(ByVal filelocation As String) As String()
' This is my code; the XMLdoc comments and method signature are unchanged,
' except that I fixed capitalization.
Try
Using sr As New StreamReader(filelocation)
Dim ares As New List(Of String)
Do Until sr.EndOfStream
ares.Add(sr.ReadLine())
Loop
Return ares.ToArray()
End Using
Catch ex As IOException
Dim hh As New System.Collections.ArrayList(1)
hh.Add("Invalid Input File " & ex.Message)
' CompanyNameBrandedCustomValidationException is not, of course, the real
' name of the exception in question because, as the name implies, it
' contains the company's real name.
' And yes, its constructor does require an ArrayList. No, I don't quite
' know why. Chalk another one up to general incompetence or just garden-
' variety peculiarity.
Throw New CompanyNameBrandedCustomValidationException(hh)
End Try
' Here is the original miserable code, commented out (the way I left it
' there for possible "future use"...).
' Dim fs As FileStream = Nothing
' Dim fs1 As FileStream = Nothing
' Dim sr As StreamReader = Nothing
' Dim sr1 As StreamReader = Nothing
' Try
' fs = File.OpenRead(filelocation)
' fs1 = File.OpenRead(filelocation)
' sr = New StreamReader(fs)
' sr1 = New StreamReader(fs1)
' Catch Ex As Exception
' Dim hh As New System.Collections.ArrayList(1)
' hh.Add("Invalid Input File " & Ex.Message)
' Throw New CompanyNameBrandedCustomValidationException(hh)
' End Try
' Dim input_Array_Lines() As String = Nothing
' Dim input_line As String = ""
' Dim num_of_Lines As Integer = 0
' Try
' Do While sr1.Peek() > -1
' input_line = sr1.ReadLine()
' num_of_Lines += 1
' Loop
' Catch a As Exception
' Dim hh As New System.Collections.ArrayList()
' hh.Add("Invalid Input File " & a.Message)
' Throw New CompanyNameBrandedCustomValidationException(hh)
' End Try
' If num_of_Lines > 0 Then
' input_Array_Lines = New String(num_of_Lines - 1) {}
' End If
' num_of_Lines = 0
' Try
' Do While sr.Peek() > -1
' input_line = sr.ReadLine()
' input_Array_Lines(num_of_Lines) = input_line
' num_of_Lines += 1
' Loop
' Return input_Array_Lines
' Catch a As Exception
' Dim hh As New System.Collections.ArrayList()
' hh.Add("Invalid Input File " & a.Message)
' Throw New CompanyNameBrandedCustomValidationException(hh)
' End Try
End Function
I realize this code is not quite down to the ordinary standards of the Coding Horror, but still, it's pretty bad.
The worst? It's a helper function in a form file with over 10000 lines of code. Complete kludge all the way through. Tune in next time for more cleaned-up code samples....
|
|
|
|
|
yes anythign VB is a horror
|
|
|
|
|
That's such a shallow argument. And actually quite racist when you think about it.
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
VB is not a race is is a mere spec of old chewing gum on the golden walk way of C/C++
|
|
|
|
|
If you mean VB and not VB.Net, I so agree. The TS wrote VB.Net though.
Btw, this is not only racism, this is even pure discrimination!!! A programming language has rights you know!!!
Go hang this[^] above ur bed or sumetin
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
omgz my new backround and screen saver image
|
|
|
|
|
5nb_t wrote: ... this code was apparently auto-translated by a tool from C# to VB.NET...
Yes, but why???
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|