Coding - so what's a crime and whats a misdemeanor?
-
Was just adding something in QA and I thought: there are things no sentient coder should do these days, but every day in QA we see some halfwit doing them. So I figure we need a list of Crimes and Misdemeanors, and these are my first candidates. Misdemeanors are "smack on the head" offenses, Crimes deserve a death sentence! :laugh: Misdemeanors: A) Ignoring existing standards and modifying someone else's code "your way". Crimes: A) Storing passwords in plain text: CommitStrip[^] B) Leaving your code open to SQL Injection: XKCD[^] C) Committing code that doesn't compile. Anyone want to add to these?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
incorrect indentation combined with single statement control flow (no braces) Java/C/C#/C++
if (condition)
// 10 line lengthy explanation
//originalSingleStatementForIf;
futureStatementThatNeedsToExecuteInAddtionTo_originalSingleStatementForIf;FIX: Always use braces!
if (condition) {
// 10 line lengthy explanation
//originalSingleStatementForIf;
futureStatementThatNeedsToExecuteInAddtionTo_originalSingleStatementForIf;
} -
Then it sounds like the process is organized poorly. If a separate process will "fix it anyway", then why does the original stored procedure need to be done at all? For that matter, if you've got processes that fix problems in earlier steps, then you've got a system built out of Band-Aid™s.
Software Zen:
delete this;
-
Gary Wheeler wrote:
then you've got a system built out of Band-Aid™s.
No, it's called dealing with 3rd party tools. :-\
There are only 10 types of people in the world, those who understand binary and those who don't.
You have my sympathy. I hate dealing with third-party tools in our products. As the DSJB(*) I get to write our installers. I have one product that requires not one but two different versions of the Visual C++ runtime because of third-party dependencies. (*) Departmental Sh!t-Job Boy
Software Zen:
delete this;
-
You have my sympathy. I hate dealing with third-party tools in our products. As the DSJB(*) I get to write our installers. I have one product that requires not one but two different versions of the Visual C++ runtime because of third-party dependencies. (*) Departmental Sh!t-Job Boy
Software Zen:
delete this;
-
Indentation with tabs: Crime. Sometimes I will read code in Notepad, and there the tab spacing is just too large.
Within you lies the power for good - Use it!
PJ Arends wrote:
Sometimes I will read code in Notepad,
Not just a crime, but also an obscenity. You can't blame tabs for an editor knocked together one afternoon after a liquid lunch in 1985.
Regards, Rob Philpott.
-
Was just adding something in QA and I thought: there are things no sentient coder should do these days, but every day in QA we see some halfwit doing them. So I figure we need a list of Crimes and Misdemeanors, and these are my first candidates. Misdemeanors are "smack on the head" offenses, Crimes deserve a death sentence! :laugh: Misdemeanors: A) Ignoring existing standards and modifying someone else's code "your way". Crimes: A) Storing passwords in plain text: CommitStrip[^] B) Leaving your code open to SQL Injection: XKCD[^] C) Committing code that doesn't compile. Anyone want to add to these?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Was just adding something in QA and I thought: there are things no sentient coder should do these days, but every day in QA we see some halfwit doing them. So I figure we need a list of Crimes and Misdemeanors, and these are my first candidates. Misdemeanors are "smack on the head" offenses, Crimes deserve a death sentence! :laugh: Misdemeanors: A) Ignoring existing standards and modifying someone else's code "your way". Crimes: A) Storing passwords in plain text: CommitStrip[^] B) Leaving your code open to SQL Injection: XKCD[^] C) Committing code that doesn't compile. Anyone want to add to these?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
- Using camelCase when not using Hungarian. 1) Using Hungarian.
-
Unsorted pick lists and dropdowns. This kind of thing is easy enough for even a blank slate intern to get right.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
DropDowns with more than a dozen items or only two items. DropDowns for numbers. Three DropDowns instead of a single DateTimePicker.
-
No, Apps Hungarian is the better of the two. But not by much. http://www.joelonsoftware.com/articles/Wrong.html[^]
-
Jörgen Andersson wrote:
D) Use GOTO.
so
break
andreturn
are not to be used?“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
Those are not
goto
s. Aside: While simplifying some code this week I removed aswitch
(that was inside awhile
) ... and later realized that I hadn't removed abreak
that was left over. :doh: I really dislike thatbreak
operates onswitch
-- I hope DMR's harp gives him blisters. -
No, Apps Hungarian is the better of the two. But not by much. http://www.joelonsoftware.com/articles/Wrong.html[^]
That is Joels' take. I rather not see prefixes at all. I can imagine the type, if you're reading from a printout and taking a ... walk, but not "Apps", where different abs got different meanings for each product.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
That is Joels' take. I rather not see prefixes at all. I can imagine the type, if you're reading from a printout and taking a ... walk, but not "Apps", where different abs got different meanings for each product.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
Eddy Vluggen wrote:
where different abs got different meanings for each product.
That's the whole point.
-
Those are not
goto
s. Aside: While simplifying some code this week I removed aswitch
(that was inside awhile
) ... and later realized that I hadn't removed abreak
that was left over. :doh: I really dislike thatbreak
operates onswitch
-- I hope DMR's harp gives him blisters.True - back when I was at university in the late 80's we were taught 'structured programming' and anything that threw you out of an iteration was forbidden, until year two when we were told that there were circumstances where there was not other option.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
True - back when I was at university in the late 80's we were taught 'structured programming' and anything that threw you out of an iteration was forbidden, until year two when we were told that there were circumstances where there was not other option.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
GuyThiebaut wrote:
anything that threw you out of an iteration was forbidden
But
break
goes only to the end, not somewhere completely different, it's structured (still prefer to avoid it though). -
D.1) Storing "numbers" as integers just because they're called numbers. (Telephone numbers, social security numbers, etc.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Hear! Hear!
-
It will be in the source code history.
Kevin
But where? And why was it removed?
-
Code that is complex by how its written rather than by it complexity of the problem
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
Reminds me of my tech leads description of my code... I still think that it's necessary to write some code using reflection to generate a JavaScript file to be added dynamically during application startup to a web optimization bundle to declare AngularJS references to some Web API Controllers so that I can save myself ten minutes of copy-pasting every few weeks when I need a new Controller.
-
Was just adding something in QA and I thought: there are things no sentient coder should do these days, but every day in QA we see some halfwit doing them. So I figure we need a list of Crimes and Misdemeanors, and these are my first candidates. Misdemeanors are "smack on the head" offenses, Crimes deserve a death sentence! :laugh: Misdemeanors: A) Ignoring existing standards and modifying someone else's code "your way". Crimes: A) Storing passwords in plain text: CommitStrip[^] B) Leaving your code open to SQL Injection: XKCD[^] C) Committing code that doesn't compile. Anyone want to add to these?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Some crimes I've seen in the last few years: A) Introducing dependencies without checking to see if they're reliable. B) Introducing dependencies that are just a C# wrapper around a REST API. C) Deciding that automating builds/deployments isn't worth the time. D) Manually deploying changes to production without committing them to source control (after which of course you go on leave). F) Being a lead developer and insisting that all columns in a database be nullable. G) Giving full sa/admin/root permissions to someone/something because you don't know what permissions it actually needs - have to confess I've been guilty of this in the past. H) Using {PopularFramework}.js because it's popular I can't seem to think of any misdemeanours though.
-
Well, my whole system does nothing but Throw (not Throw Ex, or Throw New Ex). At the top there is an unhandled exception handler, which: - Shows the error in a message box - On OK it closes the current program down - Waits several seconds, then - restarts the program and puts the user back to (roughly) where they were. The users prefer that, and there have been very few cases where they got stuck in a loop. When it did happen, I soon heard about it. Almost every time they got what they call a "restart", was due to some kind of service fail, LAN, DB, internet, etc. Most of which self righted fairly quickly.
-
I'm just waiting for the first person to put "uses JavaScript" or "uses VB".
The diss JavaScript people must be fairly stupid by now. And the whole dissing VB always seemed so childish. Especially from C# programmers. "Hey look at me, I code in .Net, but I'm not one of those VB cretins - I'm cool like you guys".