Click here to Skip to main content
15,895,746 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
PraiseRe: do any of you others have little coding mantras that save your behind? Pin
Kent K12-Sep-19 2:49
professionalKent K12-Sep-19 2:49 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
David O'Neil11-Sep-19 12:09
professionalDavid O'Neil11-Sep-19 12:09 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
honey the codewitch11-Sep-19 12:12
mvahoney the codewitch11-Sep-19 12:12 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Member 916705711-Sep-19 20:57
Member 916705711-Sep-19 20:57 
PraiseRe: do any of you others have little coding mantras that save your behind? Pin
Gary Wheeler12-Sep-19 2:04
Gary Wheeler12-Sep-19 2:04 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
kalberts12-Sep-19 4:07
kalberts12-Sep-19 4:07 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Member 916705712-Sep-19 4:11
Member 916705712-Sep-19 4:11 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
kalberts12-Sep-19 5:53
kalberts12-Sep-19 5:53 
Students insist that when you measure up 3 kg of flour for your bread, that is count of the number of kilograms. Their body height is a count of centimeters.

It goes the other way, too: They may use a float for the number of students in the class, arguing that when they increase the number by 1.0 for each newcomer, the float still represents the count of students. And, the more advanced ones argue, with a float, you can count any number of units. A plain int can't even count the number of living humans!

Sure, most of these problem come with students who have been playing with computers in their bedroom since they were ten, all self-learned, having picked up one little bit here one there, with no trace of discipline whatsoever. But frequently, these become class heroes: Other students learn "smart tricks" from them, and "how real programmer do it, not the way that silly lecturer tells us to". So they can have a large influence on otherwise "innocent" students.

This is mostly a problem with students. With professional programmers, the problem is with those who do not fully realize that e.g. a comparison does NOT return an integer (-1, 0, 1) but "less", "equal", "greater", and you should NOT compare it to numerical values. If you declare non-numeric, yet ordered, values as an enum, and create an array of, say, weather[january..december], you canNOT index this array with an integer, "because may is the fifth month, I can use 5 as an index... no, wait, I have to use 4, because it is zero based!"

One specfic example: In my own C code, I use to define "ever" as ";;" so that an infinite loop, it is made explicit as "for (ever) {...}" (inspired by the CHILL language, where "for ever" is recognized by the compiler). I used this in one of the code modules I was responsible for at work. It was discovered by one of the young and extremely self-confident programmers, who was immensely provoked by it: He promptly replaced it by the "proper" way of writing an infinite loop: "while(1){..}". He searched through our entire codebase for other places where I had done similar sins, adding a very nasty remark in the SVN log for each and every occurance, requesting that everybody in the future refrain from such inappropriate funnyness - we should do our progamming in a serious manner.

Oh, well - I din't care to argue. Why should I. Readable, easily comprehendable code is more essential when it will be read by people who are not into embedded systems code. Or rahter, to a developer of embedded C code, it is far easier to recognize "while(1)" as an infinite loop than that "for (ever)" for the same thing.
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Peter R. Fletcher12-Sep-19 4:12
Peter R. Fletcher12-Sep-19 4:12 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Member 916705712-Sep-19 4:15
Member 916705712-Sep-19 4:15 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Peter R. Fletcher12-Sep-19 4:39
Peter R. Fletcher12-Sep-19 4:39 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Kiriander12-Sep-19 20:12
Kiriander12-Sep-19 20:12 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
xtofl11-Sep-19 22:28
xtofl11-Sep-19 22:28 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Rick York12-Sep-19 4:47
mveRick York12-Sep-19 4:47 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Richard Deeming11-Sep-19 23:49
mveRichard Deeming11-Sep-19 23:49 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
honey the codewitch12-Sep-19 4:09
mvahoney the codewitch12-Sep-19 4:09 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
S Houghtelin12-Sep-19 1:19
professionalS Houghtelin12-Sep-19 1:19 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
kalberts12-Sep-19 4:09
kalberts12-Sep-19 4:09 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Member 1226197312-Sep-19 1:40
Member 1226197312-Sep-19 1:40 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Slow Eddie12-Sep-19 3:10
professionalSlow Eddie12-Sep-19 3:10 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
decaffeinatedMonkey12-Sep-19 3:18
decaffeinatedMonkey12-Sep-19 3:18 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
agolddog12-Sep-19 3:29
agolddog12-Sep-19 3:29 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
Rick York12-Sep-19 4:50
mveRick York12-Sep-19 4:50 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
AnotherKen12-Sep-19 4:19
professionalAnotherKen12-Sep-19 4:19 
GeneralRe: do any of you others have little coding mantras that save your behind? Pin
honey the codewitch12-Sep-19 4:20
mvahoney the codewitch12-Sep-19 4:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.