Tags: , , , | Categories: Coding Disaster Posted by okutbay on 16.02.2010 14:27 | Yorumlar (0)

When you are coding don't forget to use your brain. Always ask yourself. "Is there another way to do this?", "What am i doing here?". If you are copying someone else's code. Understand well purpose of the code.

Now you might ask "what the hell you are talking about?" Probably i will answer "Just angry to a mindless coder."

Look at the sample i choose for you and you will understand why i want to cry!


1 QuestionPage = QuestionPage.Replace("id=radiobutton_A", " id=radiobutton_A_" & QuestionID & " onclick=ControlTEST(this.id.split('_')[2]); ")

this is very bad written ASP.NET web application VB.NET code-behind code. Our genious programmer replacing id value with a new one and appending a javascript method call for onclick event. In that javascript call our programmer parses the control id with split and gets the id back and passes the Question id value to the javascript method. But forgets to "think" the value is already there and can be directly appended to the text.

And this is what i'm talking about:

1 QuestionPage = QuestionPage.Replace("id=radiobutton_A", " id=radiobutton_A_" & QuestionID & " onclick=ControlTEST(" & QuestionID & "); ")

I like this quote: "This machine has no brain, use your own!"

Happy coding...

Bu yazıyı ilk değerlendiren siz olun

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5