Coding: Fleeting Thoughts

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

Fume Troll
Posts: 254
Joined: Wed Jan 13, 2010 8:06 am UTC
Location: Scotland / Norway mainly

Re: Coding: Fleeting Thoughts

Postby Fume Troll » Thu Mar 11, 2010 8:19 am UTC

I don't know if this is the place for this, but it amused me so I'm sharing it.

Image

User avatar
Sc4Freak
Posts: 673
Joined: Thu Jul 12, 2007 4:50 am UTC
Location: Redmond, Washington

Re: Coding: Fleeting Thoughts

Postby Sc4Freak » Thu Mar 11, 2010 8:32 am UTC

I'm not sure it's meant to be funny. It looks like a critique on the prevalence of books titled "Teach yourself <X Language> in <Y days>!". Becoming a proficient programmer is a long process, and trying to learn the ins-and-outs of programming in 21 days or whatever is mostly an exercise in futility.

In particular, you might want to check out this page:

Teach Yourself Programming in Ten Years

It explains the situation very well, and it is highly recommended reading.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Thu Mar 11, 2010 11:19 pm UTC

I just came along to post just that comic o_O. Damn ninjas.

And it's funny in that ha ha only serious kind of way.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Fri Mar 12, 2010 4:44 am UTC

Really, Google? Really?
Attachments
screenshot1.png
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
cerbie
Posts: 934
Joined: Sat Jul 05, 2008 5:14 am UTC
Location: USA

Re: Coding: Fleeting Thoughts

Postby cerbie » Fri Mar 12, 2010 5:29 am UTC

Yes, really. That's a pretty old one. It's always nice, though.
DSenette: (...) on the whole, even a trained killer cow is kind of stupid.

User avatar
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6441
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: Coding: Fleeting Thoughts

Postby Moo » Fri Mar 12, 2010 12:29 pm UTC

Me: Here, recruiter advertising for a C#.NET developer, here's my CV. I have been working in mainly ASP.NET and C#.NET for the past four years. Here's an example of a web app I did, and here's one of a Windows Forms App I worked on.

Recruiter: Thanks for your application. Unfortunately for this specific position we need Windows based development.

Me: ??? is there some meaning of the word Windows that I am unaware of in the industry?
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"

User avatar
lulzfish
Posts: 1214
Joined: Tue Dec 16, 2008 8:17 am UTC

Re: Coding: Fleeting Thoughts

Postby lulzfish » Fri Mar 12, 2010 8:47 pm UTC

Moo wrote:Me: Here, recruiter advertising for a C#.NET developer, here's my CV. I have been working in mainly ASP.NET and C#.NET for the past four years. Here's an example of a web app I did, and here's one of a Windows Forms App I worked on.

Recruiter: Thanks for your application. Unfortunately for this specific position we need Windows based development.

Me: ??? is there some meaning of the word Windows that I am unaware of in the industry?

wut

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Fri Mar 12, 2010 10:55 pm UTC

Ah, but they heard "dot net", so they thought you only did web programming.


Also:

FFFFFFUUUUUUUU: People write their code too densely! It pisses me off when people are all

Code: Select all

if(foo>bar&&(baz-qux)<0)


when it's clearly vastly superior to write

Code: Select all

if(foo > bar && (baz - qux) < 0)
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

urobythos
Posts: 34
Joined: Thu Mar 11, 2010 3:55 am UTC
Location: 3 AM

Re: Coding: Fleeting Thoughts

Postby urobythos » Sat Mar 13, 2010 12:12 am UTC

It's annoying when people don't distinguish between control structures and function calls.

This:

Code: Select all

if(foo > bar && (baz - qux) < 0)


Should be this:

Code: Select all

if (foo > bar && (baz - qux) < 0)


That much is obvious.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sat Mar 13, 2010 12:21 am UTC

How is that a distinction? It's perfectly valid to put a space behind the parenthesis in a function call. Not that I suggest one should or anything. Anyway, control statements are reserved keywords, so they don't need special syntax.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

urobythos
Posts: 34
Joined: Thu Mar 11, 2010 3:55 am UTC
Location: 3 AM

Re: Coding: Fleeting Thoughts

Postby urobythos » Sat Mar 13, 2010 12:24 am UTC

It's just an agreed upon way to distinguish the two. We won't put a space between a function name and its parameters and we will put a space between a syntactic keyword and whatever comes next, like a conditional.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sat Mar 13, 2010 12:31 am UTC

urobythos wrote:It's just an agreed upon way to distinguish the two. We won't put a space between a function name and its parameters and we will put a space between a syntactic keyword and whatever comes next, like a conditional.


It's not like people don't know which keywords are reserved, and for clarity, it may have made sense in the olden days before syntax highlighting and whatnot, but today, really?
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

urobythos
Posts: 34
Joined: Thu Mar 11, 2010 3:55 am UTC
Location: 3 AM

Re: Coding: Fleeting Thoughts

Postby urobythos » Sat Mar 13, 2010 12:38 am UTC

I think so, yeah.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Sat Mar 13, 2010 1:51 am UTC

You, sir, name? wrote:
urobythos wrote:It's just an agreed upon way to distinguish the two. We won't put a space between a function name and its parameters and we will put a space between a syntactic keyword and whatever comes next, like a conditional.


It's not like people don't know which keywords are reserved, and for clarity, it may have made sense in the olden days before syntax highlighting and whatnot, but today, really?

I'd do this.

Code: Select all

if (condition)
  do_some (thing);

EDIT: Clarified function name.
Last edited by TheChewanater on Sat Mar 13, 2010 4:46 am UTC, edited 1 time in total.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: Coding: Fleeting Thoughts

Postby Cosmologicon » Sat Mar 13, 2010 2:05 am UTC

If you're going to point out how you'd write control structures vs function calls, it's probably best to name your function something other than "do".

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Sat Mar 13, 2010 4:45 am UTC

Cosmologicon wrote:If you're going to point out how you'd write control structures vs function calls, it's probably best to name your function something other than "do".

In psuedo code, I'll name my functions whatever I please.

Although, I almost forgot that "do" is actually a keyword, since I hardly use it.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
lulzfish
Posts: 1214
Joined: Tue Dec 16, 2008 8:17 am UTC

Re: Coding: Fleeting Thoughts

Postby lulzfish » Sat Mar 13, 2010 8:37 am UTC

urobythos wrote:It's annoying when people don't distinguish between control structures and function calls.

This:

Code: Select all

if(foo > bar && (baz - qux) < 0)


Should be this:

Code: Select all

if ((foo) > bar && (baz - qux) < 0)


That much is obvious.

Always need more parentheses.

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Sat Mar 13, 2010 12:44 pm UTC

lulzfish wrote:
urobythos wrote:It's annoying when people don't distinguish between control structures and function calls.

This:

Code: Select all

if(foo > bar && (baz - qux) < 0)


Should be this:

Code: Select all

if ((foo) > bar && (baz - qux) < 0)


That much is obvious.

Always need more parentheses.

Did someone call for more parentheses?

(if (and (> foo bar) (minusp (- baz quz))) t nil)
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

stephentyrone
Posts: 778
Joined: Mon Aug 11, 2008 10:58 pm UTC
Location: Palo Alto, CA

Re: Coding: Fleeting Thoughts

Postby stephentyrone » Sun Mar 14, 2010 7:26 am UTC

Know your syntax rules. Don't write this:

Code: Select all

if(foo > bar && (baz - qux) < 0)

When this is equivalent:

Code: Select all

if (foo > bar && baz - qux < 0)

Any time I see parentheses in C that aren't for a condition or a function call, I'm looking for how the code differs from what it would be without the parentheses. When it doesn't differ, I am annoyed that you wasted my time (and my precious bits!)
GENERATION -16 + 31i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

User avatar
Sc4Freak
Posts: 673
Joined: Thu Jul 12, 2007 4:50 am UTC
Location: Redmond, Washington

Re: Coding: Fleeting Thoughts

Postby Sc4Freak » Sun Mar 14, 2010 9:53 am UTC

Except that you're not writing code for yourself - you're writing it for whoever maintains it in the future.

Readability and maintainability trump brevity. In some cases, additional brackets clear up potential ambiguity if somebody came along later to read your code and wasn't 100% sure of precedence and associativity. IMO it's better to place more brackets in rather than none - when in doubt, parenthesise.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sun Mar 14, 2010 12:40 pm UTC

stephentyrone wrote:Know your syntax rules. Don't write this:

Code: Select all

if(foo > bar && (baz - qux) < 0)

When this is equivalent:

Code: Select all

if (foo > bar && baz - qux < 0)

Any time I see parentheses in C that aren't for a condition or a function call, I'm looking for how the code differs from what it would be without the parentheses. When it doesn't differ, I am annoyed that you wasted my time (and my precious bits!)


I generally add parentheses to expressions where the number of operators with different precedence order exceeds two. Not because I don't know the order of precedence, but because expressions like that generally has you stopping and thinking about what they do; which is bad.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Link
Posts: 1419
Joined: Sat Mar 07, 2009 11:33 am UTC
Location: ᘝᓄᘈᖉᐣ
Contact:

Re: Coding: Fleeting Thoughts

Postby Link » Sun Mar 14, 2010 3:25 pm UTC

You, sir, name? wrote:I generally add parentheses to expressions where the number of operators with different precedence order exceeds two. Not because I don't know the order of precedence, but because expressions like that generally has you stopping and thinking about what they do; which is bad.

Exactly. In this day and age, a few extra bytes of source code don't have any significant impact on disk or memory space, but they make it a lot easier to read. The compiler will generally strip the syntactic sugar and the executable won't be any larger. Unless you're intentionally writing obfuscated code, making the source code a fraction of a percent larger is a very reasonable sacrifice to make in the name of readability.

stephentyrone
Posts: 778
Joined: Mon Aug 11, 2008 10:58 pm UTC
Location: Palo Alto, CA

Re: Coding: Fleeting Thoughts

Postby stephentyrone » Sun Mar 14, 2010 8:02 pm UTC

I expect whoever is maintaining the code I write will know the language in which I'm writing (otherwise, they wouldn't have gotten hired), so extraneous parentheses really are extraneous.

When I read an expression with extraneous parentheses, I stop to ask myself the question "Did the person who wrote this add the parentheses because they were unsure about operator precedence, or did they in fact intend the expression to not follow the usual precedence, and is there therefore a bug in their code?" That is, extra parentheses actually make the code less readable. (For me. I recognize that some people like them. But they really do make me slow down when I'm reading your code.)
GENERATION -16 + 31i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

User avatar
lulzfish
Posts: 1214
Joined: Tue Dec 16, 2008 8:17 am UTC

Re: Coding: Fleeting Thoughts

Postby lulzfish » Sun Mar 14, 2010 8:26 pm UTC

Oops, I meant ((a + b) && (c + d)), not ((a) + b && (c + d))
Well, whatever.

User avatar
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6441
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: Coding: Fleeting Thoughts

Postby Moo » Mon Mar 15, 2010 8:58 am UTC

stephentyrone wrote:I expect whoever is maintaining the code I write will know the language in which I'm writing (otherwise, they wouldn't have gotten hired), so extraneous parentheses really are extraneous.
I hate this argument. My boss used to say in response to my objections to his hideous code and lack of comments "if you can't read my code, you shouldn't be in it". Screw you, of course I can read your code, but I prefer spending 10mins on it rather than 30 because I also have to figure out why that function looks so different to what I expected and don't know you had to cowboy it for a bugfix. Code is not a first language. It doesn't read like English in which you only need the jist of it to understand it. Seven different logical operators in an if condition without a comment as to what exactly you're testing or parenthasis to make it readable, does take longer to figure out than just writing as if the next person going through your code doesn't have all day to figure out how your mind works.
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"

User avatar
e^iπ+1=0
Much, much better than Gooder
Posts: 2065
Joined: Sun Feb 15, 2009 9:41 am UTC
Location: Lancaster

Re: Coding: Fleeting Thoughts

Postby e^iπ+1=0 » Mon Mar 15, 2010 9:14 am UTC

Hell, I can't even figure out how my own code works half the time when looking back at it. And the moral of the story is: comments and parens are your friends.
poxic wrote:You, sir, have heroic hair.
poxic wrote:I note that the hair is not slowing down. It appears to have progressed from heroic to rocking.

(Avatar by Sungura)

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Mon Mar 15, 2010 10:55 am UTC

I'm not actually -that- fond of commenting code though. Most of my comments are like TODO/FIXME-markers, navigational markers that separate sub-modules of the program that are not big enough to get their own file, and explanations of the more dubious hacks I may have included.

In general, code that is written with sensible structure and meaningful function and variable names should be quite readable without comments, if not more readable than with comments, as comments tend to become out of sync with the actual code.

I hate when people code like this

Code: Select all

/*  cross_product(a, b)
*     a - a vector
*     b - a vector
 *    Returns: the cross product between vectors a and b
*/
vector cross_product(vector &a, vector &b) {
  // ...
}


There is absolutely no piece of information in that function header that isn't made 100% redundant by the line "vector cross_product(vector &a, vector &b) {"
Last edited by You, sir, name? on Mon Mar 15, 2010 11:02 am UTC, edited 1 time in total.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Sc4Freak
Posts: 673
Joined: Thu Jul 12, 2007 4:50 am UTC
Location: Redmond, Washington

Re: Coding: Fleeting Thoughts

Postby Sc4Freak » Mon Mar 15, 2010 11:01 am UTC

I actually find myself to be the same. In the beginning, I found myself writing lots and lots of comments. But as time went on and I gained more experience, I learned to write clearer and self-documenting code. Code changes around - and the more comments you have, the greater the chances that you invalidate some comment with each code change. The worst kind of comment is a wrong comment - and if you have lots of them, they can wreak havok. I still comment my code, but not nearly as frequently as I used to.

User avatar
e^iπ+1=0
Much, much better than Gooder
Posts: 2065
Joined: Sun Feb 15, 2009 9:41 am UTC
Location: Lancaster

Re: Coding: Fleeting Thoughts

Postby e^iπ+1=0 » Mon Mar 15, 2010 11:10 am UTC

You, sir, name? wrote:In general, code that is written with sensible structure and meaningful function and variable names should be quite readable without comments, if not more readable than with comments, as comments tend to become out of sync with the actual code.
Yes, I suppose this is my problem. I'm pretty new to coding still, so I don't think I'm particularly good at this yet. And since I don't really see a better way to improve that than practice, for now comments will be very helpful for me.
poxic wrote:You, sir, have heroic hair.
poxic wrote:I note that the hair is not slowing down. It appears to have progressed from heroic to rocking.

(Avatar by Sungura)

User avatar
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6441
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: Coding: Fleeting Thoughts

Postby Moo » Mon Mar 15, 2010 11:11 am UTC

You, sir, name? wrote:explanations of the more dubious hacks I may have included.
These are the times when they are of great value to me. I agree there's a time and place and reason for everything though.
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: Coding: Fleeting Thoughts

Postby Berengal » Mon Mar 15, 2010 1:45 pm UTC

Indeed, idiomatic code doesn't get a single byte wasted on comments, and in an ideal world all source is idiomatic. I write API documentation (javadoc-ish comments), todo/fixmes, source-local "changelog" for bugfixes, navigation aids and possibly editor-markup (code folding etc.) but almost never do I explain how a piece of code works. I do focus on readability though, which means short methods, meaningful variable names (or very very short ones if the variable doesn't have a "natural" name,) logical separation of concerns and no actions from a distance (very few no-arg void methods, or indeed void methods in general.) In my experience, if the code's not idiomatic, no amount of comments can help. If it is idiomatic, it's faster to read the source than to read comments. They almost never survive refactoring. Small, dirty hacks benefit from them, but that's about the only code that does.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: Coding: Fleeting Thoughts

Postby Cosmologicon » Mon Mar 15, 2010 2:24 pm UTC

Berengal wrote:Indeed, idiomatic code doesn't get a single byte wasted on comments.... I write API documentation (javadoc-ish comments).

I'm not sure whom you're responding to, but aren't javadoc-ish comments exactly the sort of thing You, sir, name? was complaining about?
You, sir, name? wrote:I hate when people code like this

Code: Select all

/*  cross_product(a, b)
*     a - a vector
*     b - a vector
 *    Returns: the cross product between vectors a and b
*/
vector cross_product(vector &a, vector &b) {
  // ...
}

elminster
Posts: 1560
Joined: Mon Feb 26, 2007 1:56 pm UTC
Location: London, UK, Dimensions 1 to 42.
Contact:

Re: Coding: Fleeting Thoughts

Postby elminster » Mon Mar 15, 2010 3:57 pm UTC

I comment for the usual things (TODO, FIXME, hacks, etc), but only ever comment on what code's purpose is if it's not immediately obvious (e.g. Complicated algorithms that may require reading quite a bit of other code to fully understand). It's almost always the case that you can just read the code.
Also, sometimes, unless you're going for stupidly long names, it's near impossible to make it clear what code does by names of things.
Image

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: Coding: Fleeting Thoughts

Postby Berengal » Mon Mar 15, 2010 4:53 pm UTC

Cosmologicon wrote:I'm not sure whom you're responding to, but aren't javadoc-ish comments exactly the sort of thing You, sir, name? was complaining about?
I took it to mean useless comments. That particular one doesn't say anything the function signature doesn't. If the comment also said "Sends the results to Bob via email in addition to returning it" then I'm pretty sure YSN would've agreed that indeed, such a comment is most helpful, but perhaps a link to tdwtf's submit page would be even better.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Mon Mar 15, 2010 5:15 pm UTC

Cosmologicon wrote:
Berengal wrote:Indeed, idiomatic code doesn't get a single byte wasted on comments.... I write API documentation (javadoc-ish comments).

I'm not sure whom you're responding to, but aren't javadoc-ish comments exactly the sort of thing You, sir, name? was complaining about?
Spoiler:
You, sir, name? wrote:I hate when people code like this

Code: Select all

/*  cross_product(a, b)
*     a - a vector
*     b - a vector
 *    Returns: the cross product between vectors a and b
*/
vector cross_product(vector &a, vector &b) {
  // ...
}


As long as it's actually passed to some sort of documentation generator, and generating documentation is meaningful (i.e. you're writing a library), then I have understanding for javadoc-style comments. But when they don't fill that sort of purpose, that is what I have a beef with.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: Coding: Fleeting Thoughts

Postby Cosmologicon » Mon Mar 15, 2010 6:06 pm UTC

Well YMMV, but in my experience, API documentation auto-generated from comments tends to encourage useless comments and useless documentation.
ODE_API dReal dWorldGetAutoDisableLinearAverageThreshold ( dWorldID )
Get auto disable linear average threshold for newly created bodies.

Returns:
the threshold
Yes, thank you. Now if only I knew what "auto disable linear average threshold" is. :) That's the sort of thing you'd think they'd put in the documentation, but why do you need to write documentation? It's auto-generated for you!

User avatar
Area Man
Posts: 256
Joined: Thu Dec 25, 2008 8:08 pm UTC
Location: Local

Re: Coding: Fleeting Thoughts

Postby Area Man » Mon Mar 15, 2010 7:42 pm UTC

I'm with "Moo".

From my experience, I can say that comments and documentation are pretty vital for medium and large groups, and it not being in sync with code is no excuse to not write.
There is no such thing as "self-documenting" code, no matter the language. Of course the code does what it does, it's code! but it in no way means that that's what the coder intended it to do - it could just happen to do whatever.

When I do my team's code review, the quickest measure of quality is to see how well the comments/docs match the code; where they don't, it redflags a high probability that they fucked up both there (but more often the code), usually something like mindlessly copying code.

I can't tell you how many times someone "fixed" a piece of code just by having them write me a detailed email explaining the problem (or me writing the email); those emails rarely get sent. I'm sure most of you have had this experience too, possibly writing on this board.

Trying to express something in both machine and human terms makes you scrutinize what you're doing more closely. When I force someone to reconcile the issue, bugs go away and code gets leaner as a side-effect (which is what I want as a primary effect anyway).
Bisquick boxes are a dead medium.

|Erasmus|
Branson
Posts: 2643
Joined: Tue Oct 30, 2007 7:53 am UTC
Location: Sydney, Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby |Erasmus| » Tue Mar 16, 2010 12:12 am UTC

But commenting is amazingly powerful.

Code: Select all

int a;
// a is an integer.


Who knows what a would be without that comment! The problem is that when people are taught to code (in these parts) they are just encouraged 'to comment'. They are deducted marks for 'not commenting' without ever being told what to comment on. So they comment. Like that.

FT, or maybe more of a Rant:
I hate our revision control system and the stupidity that ensues around here because of it. It makes false guarantees about multiple changes not conflicting with other when submitted for integration by just not letting us submit multiple changes which edit the same file(s). So we constantly integrate things which break stuff because we try to test lots of 'non conflicting' changes at once on the same baseline, and we end up with ridiculous amounts of office politics as everyone tries to work out who gets to go next with regards to these conflicting changes. It doesn't help that the built in merge command is incapable of resolving any kind of difference automatically.

Really, I'm just sick of having to wait for other integrations, merge with the baseline, and then get harrassed to put my (untested on the current baseline) change up for integration quickly because otherwise people will block, or start getting on my managers case because it is now her 'turn' to get stuff tested/integrated and she hasn't put anything up in the last 5 seconds!

tl;dr. Fuck the workflow around here.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Tue Mar 16, 2010 12:53 am UTC

Fleeting thought:

After switching between toolkits three times, I realized that I need to add this to my makefile.

Code: Select all

#I tend to change this.
TOOLKIT=gtkmm-2.4

CFLAGS=`pkg-config $(TOOLKIT) --cflags`
LIBS=`pkg-config $(TOOLKIT) --libs`
...
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6441
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: Coding: Fleeting Thoughts

Postby Moo » Tue Mar 16, 2010 5:35 am UTC

"Moo"..?
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests