what counts for bad code? finding its level...... [modified]
-
Dario Solera wrote:
code that contains grammar errors in comments.
I came across one of these the other day from MS in all the OnEvent methods in the BackgroundWorker (C# at least), for the e parameter: "An System.EventArgs that contains the event data."
Dave
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
-
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
-
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
Well, as far as understandability and maintainability are concerned try running some code metrics over any piece of code you see. I use a tool that displays real-time cyclomatic and maintenance complexity (dynamically updated as you type). Low figures won't necessarily indicate good code but high figures definitely indicate bad code, at least with respect to understandability and maintainability. (The code might otherwise be correct and performant for all I know.)
Kevin
-
Well, as far as understandability and maintainability are concerned try running some code metrics over any piece of code you see. I use a tool that displays real-time cyclomatic and maintenance complexity (dynamically updated as you type). Low figures won't necessarily indicate good code but high figures definitely indicate bad code, at least with respect to understandability and maintainability. (The code might otherwise be correct and performant for all I know.)
Kevin
consider for example: all programmers write as per standards, use proper css for looks, use proper logic, even then code is said to be bad, when some change so called big changes of scalability, or increase in users or feature rich functionality add-on........ code is always blamed to be badly written over a period of time. is readability of code measure of time....or there are techniques to help ur self with better coding.....?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
-
consider for example: all programmers write as per standards, use proper css for looks, use proper logic, even then code is said to be bad, when some change so called big changes of scalability, or increase in users or feature rich functionality add-on........ code is always blamed to be badly written over a period of time. is readability of code measure of time....or there are techniques to help ur self with better coding.....?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
Ravi Sant wrote:
when some change so called big changes of scalability, or increase in users or feature rich functionality add-on........ code is always blamed to be badly written over a period of time.
The best thing to do is to apply a code metrics tool every so often. If the numbers are bad then do some refactoring. However, this depends on the context, e.g., how much time and freedom you have for refactoring, whether the code base has unit tests so you can perform it more safely and so on. It's also easier to do refactoring with the help of software such as ReSharper or Refactor! Though, as always, you still need to keep your brain engaged. A few years ago I was specifically assigned a bug fix, feature enhancement and refactoring project. So I was able to apply a code metrics tool and then refactor until the bar charts decreased sufficiently. :)
Kevin
-
Clearly the decision to fully qualify the names was taken after the comment was written and possibly done automatically.
That would make sense. A very simple vowel search in the algorithm would have prevented it - but heigh ho, that's probably why I don't work for MS.
Dave
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
-
See TWOTD just above this thread, search for 502. That's the difference between good and bad code!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
Ravi Sant wrote:
how do u rate it as bad..... from 1 to 10
Bad when:
Ravi Sant wrote:
bugs are part of feature my code has
Good When: Bugs are not feature and are not a part of the code.
-
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
Code is only bad if it needs to be touched after it's been written. And then, any code is bad. ;) Marc
I'm not overthinking the problem, I just felt like I needed a small, unimportant, uninteresting rant! - Martin Hart Turner
-
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
here you see :laugh: Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
-
How do u measure the level of bad code? A bad code is tough to understand or maintain...or one that doesnt work as intended.... or is made more personal by programmer..... How do u rate it as bad..... from 1 to 10 less severe to intense......?
Ravie Busie Coding is my birth-right and bugs are part of feature my code has!
modified on Tuesday, September 8, 2009 10:34 AM
I wish I'd found this thread earlier. I'd have started a sweepstakes on the first person to mention braces.
I wanna be a eunuchs developer! Pass me a bread knife!
-
I wish I'd found this thread earlier. I'd have started a sweepstakes on the first person to mention braces.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Dario Solera wrote:
code that contains grammar errors in comments.
I came across one of these the other day from MS in all the OnEvent methods in the BackgroundWorker (C# at least), for the e parameter: "An System.EventArgs that contains the event data."
Dave
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)"System." is silent.
-
"System." is silent.
Ah... it all makes sense now. English - UK English - US English - MS :laugh:
Dave
Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)