Ages ago, one of the business units at the corporation that Rick P. works at contracted a 3rd party vendor (in truth it was some guy in the UK) to write an inventory management system. It was written in VB6 and talked to an Access database in the back end and it worked.
Skip ahead to recently when an edict has come down from the powers-that-be declared that any VB6 apps should be brought up to date in VB.NET. The 3rd party dev was happy to make the updates and rollout the now conforming application. Unfortunately, the availability and quality of support had gone downhill as of late and in order to save on costs, the application's source code was recalled to be maintained in-house.
As it turned out, the developer was an expert VB programmer, however was absolutely awful when it came to .NET development. The class diagrams provided were beyond inaccurate and the documentation out-and-out lied in order to give the appearance that it conformed to the corporate standards. Anti-patterns and WTFs-a-plenty, it was hard to pick out just one example, but the following jumped out.
In the "Utilities" file there are two functions for obfuscating text, one was a simple ROT13 function and the other was a perfectly viable implementation of an AES encryption function pulled from a programming site.
However, after seeing how the application authorizes a user's login information, Rick can't fathom why the original developer went through the trouble.
Private Sub btnOK_Click(ByVal sender As Object, ByVal e As EventArgs) If String.IsNullOrEmpty(_Password) Then Using dsUser As DataSet = MDI.GetDataSet(_ "SELECT * FROM [dbo].[Password] WHERE [Password] = " & _ Utils.ConvertToDBString(txtPassword.Text)) If dsUser IsNot Nothing Then Me.DialogResult = Windows.Forms.DialogResult.OK Else TransMsgBox("Invalid Password", MessageBoxIcon.Exclamation) txtPassword.Clear() txtPassword.Focus() End If End Using Else If txtPassword.Text = _Password Then Me.DialogResult = Windows.Forms.DialogResult.OK Else TransMsgBox("Invalid Password", MessageBoxIcon.Exclamation) txtPassword.Clear() txtPassword.Focus() End If End If End Sub