Those examples are great. They really focus on what the code cannot express: the WHY we did it this way, and the WHY we didn't do it that way.
I'm so tired of comments stating the obvious or, worse, comments explaining what a line of code does when a few rightly named variables would have made the comments redundant.
Another kind of comment that I find useful is top-level comments that explain in a few words what's the purpose of the class/module/program. Although this information is implicitly contained in the code, it is too time-consuming to read everything if all you're doing is browsing a large code base, trying to find which class/module/program you need to edit.
People, if your function is more than 10 lines long, you should start to consider splitting it. (emphasis mine)
Most replies to parent give examples where a 10-line function would have been inappropriate. Fine. Parent is clearly stating it's all a matter of asking yourself the question: 'This function is getting awfully long. Is this really for the best?'. Maybe the answer will yes. Maybe not. At least, you thought about it.
Right now, I'm debugging a 1000+ line method in Java. I'm pretty sure this monstruosity's author didn't stop to think about how this would affect readability and testability.
Some people even gone so far as to substitute automated testing for clarity in design - the so called Test Driven Design. That seems like a recipe for disaster to me.
Well, I've been using TDD for 4 years, with four different languages (Java, Python, Ruby and a COBOL-like procedural language) and with projects of all sizes -- ranging from simple tools to 10K LOC applications -- and I still haven't experienced any disaster. Quite the contrary, management is very pleased with the results.
IMHO, OSS projects could benefit from TDD or TDD-like approches.
Re:After 20 years I've been pushed into management
on
Geeks in Management?
·
· Score: 1
I also reccommend reading the books by Geald M. Weinberg, such as "Becoming a Technical Leader: An Organic Problem-Solving Approach"
Weinberg's book is great. His MOI (Motivation, Organization, Innovation) model helped me understand my weaknesses. Strongly recommended.
How can this post be considered +5, Insightful? What it says isn't true. You may be fluent in a language but not have a properly configured computer to type something in this language.
For instance, I can read English, French and Japanese, but my computer at work has been locked down and won't let me write in Japanese.
Re:It's been said before...
on
More WTC News
·
· Score: 1
the pilots already have a "panic button" in the event of a skyjacking. This could easily also put the plane irreversibly on automatic pilot, or remote piloting, to ensure that the vehicle -could- not be used in this way, and WOULD land safely at the nearest suitable emergency runway.
The terrorists could tamper with such device.
Or worse : someone could tamper with it while the aircraft is being repaired, so that it would crash automatically on buildings next time it flies.
It's almost ubiquitos distribution, and cross-platform support is the tops.
What cross-platform support? I cannot even use a flash player on my Linux x86_64. And on my 32bits Linux, I am stuck with Flash 7.
Those examples are great. They really focus on what the code cannot express: the WHY we did it this way, and the WHY we didn't do it that way.
I'm so tired of comments stating the obvious or, worse, comments explaining what a line of code does when a few rightly named variables would have made the comments redundant.
Another kind of comment that I find useful is top-level comments that explain in a few words what's the purpose of the class/module/program. Although this information is implicitly contained in the code, it is too time-consuming to read everything if all you're doing is browsing a large code base, trying to find which class/module/program you need to edit.
People, if your function is more than 10 lines long, you should start to consider splitting it. (emphasis mine)
Most replies to parent give examples where a 10-line function would have been inappropriate. Fine. Parent is clearly stating it's all a matter of asking yourself the question: 'This function is getting awfully long. Is this really for the best?'. Maybe the answer will yes. Maybe not. At least, you thought about it.
Right now, I'm debugging a 1000+ line method in Java. I'm pretty sure this monstruosity's author didn't stop to think about how this would affect readability and testability.
Some people even gone so far as to substitute automated testing for clarity in design - the so called Test Driven Design. That seems like a recipe for disaster to me.
Well, I've been using TDD for 4 years, with four different languages (Java, Python, Ruby and a COBOL-like procedural language) and with projects of all sizes -- ranging from simple tools to 10K LOC applications -- and I still haven't experienced any disaster. Quite the contrary, management is very pleased with the results.
IMHO, OSS projects could benefit from TDD or TDD-like approches.
Weinberg's book is great. His MOI (Motivation, Organization, Innovation) model helped me understand my weaknesses. Strongly recommended.
How can this post be considered +5, Insightful? What it says isn't true. You may be fluent in a language but not have a properly configured computer to type something in this language.
For instance, I can read English, French and Japanese, but my computer at work has been locked down and won't let me write in Japanese.
the pilots already have a "panic button" in the event of a skyjacking. This could easily also put the plane irreversibly on automatic pilot, or remote piloting, to ensure that the vehicle -could- not be used in this way, and WOULD land safely at the nearest suitable emergency runway.
The terrorists could tamper with such device.
Or worse : someone could tamper with it while the aircraft is being repaired, so that it would crash automatically on buildings next time it flies.
I do not think technology is the solution here.
Sig space for rent.