Linked by Thom Holwerda on Tue 15th Jan 2013 21:24 UTC
General Development "I was really excited to write this article, because it gave me an excuse to really think about what beautiful code is. I still don't think I know, and maybe it's entirely subjective. I do think the two biggest things, for me at least, are stylistic indenting and maximum const-ness. A lot of the stylistic choices are definitely my personal preferences, and I'm sure other programmers will have different opinions. I think the choice of what style to use is up to whoever has to read and write the code, but I certainly think it's something worth thinking about. I would suggest everyone look at the Doom 3 source code because I think it exemplifies beautiful code, as a complete package: from system design down to how to tab space the characters." John Carmack himself replies in the comments.
Permalink for comment 549035
To read all comments associated with this story, please click here.
RE[3]: Good article
by henderson101 on Wed 16th Jan 2013 16:38 UTC in reply to "RE[2]: Good article"
Member since:

Personally I like VB.NET, while the syntax is odd you can write code pretty quickly.

Oh jesus.. no it's not! Here is an example:

Define a class and on that class create a public event

Public Class Whatever
  Public Event MyEvent(ByVal SomeValue As String)
  Public Sub RunHack(ByVal whatever as String)
  End Sub
End Class

Then in another class try this:

Public Class TwatFace
  WithEvents myHack as Whatever
  Public Sub ABadIdea(ByVal whatever as String) handles myHack.MyEvent
  End Sub
  Public Sub LetsBreakEventHandling()
    Dim fcukit As New Whatever
    myHack = fcukit
    myHack.RunHack("Shoot yourself now...")
  End Sub
End Class

What happens if we call LetsBreakEventHandling? Well, it should never compile... it does. It should probably freak out and crash, but you'll see a message box happily telling you "Shoot yourself now...". And I know all of this because the fcukwit programmers, on contract from India, that we used before I took over didn't know about "AddHandler Xxxxx, AddressOf Yyyyy".

Even with option explicit and strict on, you can do this:

Dim X as Integer
X = 99
Dim Y as Boolean ''uninitialised, so compiler decides

Select Case X
  Case 1, 2
  Case 3, 4
  Case Y
End Select

VB is dangerous, plain and simple and there's nothing you can do in VB that can't be done in a safer .Net language at a similar speed.

Edited 2013-01-16 16:43 UTC

Reply Parent Score: 2