The Idea is what is the worse code I could make that still worked. So I started off with a decent code practice (not the best because I am only a decent programmer)[this was done in vb.net] and then convoluted it to an evil version.
Then I thought what is the most horrible code that other people could make with the simple criteria of 1 button, 1 label, and 1 text box. I so decided to put the challenge out in the horrible coding area.
Here is my original coding:
Private Sub frmMainbttnGenerate_Click() dim strInformationFromfrmMaintbInput as string = frmMain.tbInput.text dim iLoopInteger as integer = 0 try for iloopinteger =0 to 26 if iloopinteger mod 2 then strInformationFromfrmMaintbInput = trim(mid(strInformationFromfrmMaintbInput,iloopinteger,len(strInformationFromfrmMaintbInput))) else strInformationFromfrmMaintbInput = trim(mid(strInformationFromfrmMaintbInput,1,len(strInformationFromfrmMaintbInput)) end if next iloopinteger frmMain.lblOutput.text = strInformationFromfrmMaintbInput catch ex as exception msgbox ex.tostring finally strinformationfromfrmmainbinput = string.empty end try End Sub
Here is the same coding convulated:
Private Sub b_click() dim s as string = f.t.text dim i as integer = 0 on Error goto Errortext for i =0 to 26 if i mod 2 then s = trim(mid(s,i,len(s))) else s = trim(mid(s,1,len(s)) end if next i1 f.l.text = s ExitHere: s = string.empty exit sub ErrorText: msgbox (err.tostring) goto Exithere End Sub
Now can anyone do better? (I mean worse)
This post has been edited by alapee: 14 November 2013 - 12:30 PM