|
I make a lot of typos - espcially when using my laptop keyboard, or some weird Apple device keyboard.
When I'm doing compiled languages it's not too bad because the compiler catches it, but interpreted languages are a nightmare.
|
|
|
|
|
|
Null References: The Billion Dollar Mistake[^]
Syntax errors?
Get an IDE that catches those (or a language that won't compile)!
Unless you're doing JavaScript, in that case I apologize for my rude behavior. I'm sorry, I didn't know
|
|
|
|
|
True story: I once dropped a single "}" sometime during a marathon refactoring (ten days with no compiling until every last class updated) of a large C++ program - the compiler then threw me a meaningless error in a completely unrelated file, and it took another **three whole days** just to track that compilation error down. Having half-decent syntax colouring in the code editor of the IDE I was forced to use might well have helped, but finding out that the compiler (Embarcardo, pfttt!) did not even count/check that brackets balanced properly in every source file was a real shocker for me.
The one my fingers insist on typing is if length(x=3) then but that gets spotted pretty quickly.
Pete Lomax
|
|
|
|
|
The issue of mis-balanced braces brings back memories of the CHILL language, where any composite statement could be labeled. After the closing brace you could (optionally) repeat the label. If it did not match, the compiler could immediately tell you that you had one extra (or missing) closing brace inside the statement.
Also, it helped a lot when reading the code; you wouldn't have to match by indentation to some opening brace, maybe two screenfuls higher up, to see which loop or conditional statement is closed here.
I have seen other languages treating anyhing between the 'end' and the following semicolon as a comment, and I have seen coding standards requiring that you add a comments (using ordinary comment syntax) after the terminating semicolon, but either of these allow arbitrary text that cannot be checked by the compiler.
Having the compiler check it also helped the compiler recover, so that any code following the labeled close is treated as being on the "correct" nesting level, disregarding the nesting error within the composite statement. Really nice detail!
|
|
|
|
|
Only an issue in multithreaded environments. Failure to lock (/acquire a semaphore), or even to forget that a variable is accessed from multiple threads so there is no lock/sempahore. Deadlocks. Unpredictable results due to racing conditions (which may certainly occur even if the variables are protected) - you may argue that this is a code design error rather than a programming error.
|
|
|
|
|
Programming languages and frameworks that still work on magic strings... it is 2019.
Let us not do that any more m'kay?
|
|
|
|
|
agree, specially like gardle kind of frameworks
|
|
|
|
|
perfection, I can only consider this voyeuristically.
One has, however, not even reached the level of a programming error when one simply leaves off a closing semicolon or other such typo. It's not yet a program and won't compile. Even a script won't accept such as this (at least not php - javascript stupidly/simply goes silent).
My primary errors, although rarer, are underestimating the stupidity of users. And/or their laziness.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
This is in Python. Loaded a CSV file, and plotted two of it columns using matplotlib. The plot looked weird. The same numbers plotted in Excel showed up fine. Then, upon closer examination, I found that I had to explicitly convert the CSV read values to floats, before plotting. Took some time to get this, though.
|
|
|
|
|
For the first time? Before trying to compile / run the code?
All of them and a whole plethora of "Other". It usually takes me longer to get rid of the mistakes than it took to type them in.
Thankfully these aren't on punchcards anymore. I'd have been solely responsible for many a square mile of rain forest being wiped out.
|
|
|
|
|
One of my hobbies is collecting mistakes and errors that make it into production. I did not write the following, but it jumped out at me while troubleshooting an unrelated defect.
if (ptr && (!ptr->count > 0) {
}
A C++ compiler will give you a warning about the Boolean comparison, but still compile and run.
C# will not even allow this illogical syntax error.
The thing is, this will get the expected result as long as count is always >= 0.
Of course I am assuming that the developer met to write
if (ptr && !(ptr->count > 0))
Moral: "Do not ignore warnings!"
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
Granted the VS IDE catches all the above, but even the best Javascript IDE doesn't catch most of the things VS would have alerted me to.
And they left out === as another equality comparison.
Latest Article - Slack-Chatting with you rPi
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
I have to agree with Marc on this one. Most of these errors are difficult to make in C# using VS. Sure, people can get stupid with memory management, but even a simple grasp of the .NET memory model will prevent these.
JavaScript, on the other hand...
|
|
|
|
|
ronlease wrote: I have to agree with Marc on this one.
Does that mean you disagree with me on most everything else?
Latest Article - Slack-Chatting with you rPi
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
I can neither confirm nor deny these allegations. I cannot recall at this time, Mr. Senator.
|
|
|
|
|
With the Coverity code checker I was smacked on my fingers: The automatic garbage collection covers memory objects alone. Even though your object goes out of scope, if you have plenty of RAM it may not be garbage colleced in some time, and until that happens, it might hold e.g. SMTP or HTTP connections, unless you explicitly dispose those resourceds. The same goes for p/invoke: They may hold resources longer than necessary, possibly blocking other users/applications.
When working in a malloc/free environment, it comes natural to consider such situations. When I moved into C#, I was so happy about the runtime system handling all dynamic memory issues, and left it all to the runtime. It took quite some time before I learned that memory is memory, other resources are not managed quite as well by the memory allocaton system.
|
|
|
|
|
|
If the VS compiler could catch my null references that'd be great.
If I stopped returning nulls in the first place that would be even better.
cheers
Chris Maunder
|
|
|
|
|
C# version 8, how about nullable reference types? Supposedly they will solve most of the similar issues.
Possibly a topic for another poll?
|
|
|
|
|
Yes, I'm looking forward to them but they still won't solve all the problems. They'll just hide deeper in the code
cheers
Chris Maunder
|
|
|
|
|
I use Resharper. It is almost virtually impossible to do most of the items listed in this poll if you use Resharper. Thankfully, VS has been including most of Resharper's awesomeness in the IDE, so some day, I will not need RS.
With that said, the errors I do make are not implementing the requirements correctly, in one way or another; usually logic errors, or misunderstanding the requirements. Those errors of course, are on me and no one else.
|
|
|
|
|
Slacker007 wrote: I use Resharper. It is almost virtually impossible to do most of the items listed in this poll if you use Resharper. Thankfully, VS has been including most of Resharper's awesomeness in the IDE, so some day, I will not need RS.
Isn't it more that Re#er and VS make it easy to catch these errors almost as soon as you type them by increasing the number of you screwed up indicators on screen. They can't prevent your brain from glitching and typing duoble instead of double in the first place.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
but after you correct it, and prior to build, is it really a programming error anymore?
I have not made a possible null reference error since 2012.
|
|
|
|
|
...The IDE misinterprets my keystrokes.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|