Archived

This topic is now archived and is closed to further replies.

LordElectro

Are many programmers mentally ill?

Recommended Posts

I''ve noticed a lot of programmers (myself included) comment code using statements such as // now we load the data into the surface or // calculate our position in the file Shouldn''t it be: // now I load the data into the surface // calculate my position in the file Who is the person/people that we speak to in these comments? Yea, in a commercial project, people might actually read your code, but this trend also applies to code that people never expect anyone but themselves to read. So do those of us that do this have some deep psychological problems?

Share this post


Link to post
Share on other sites
Programmers only comment to explain to other programmers, not to themselves.
I''ve noticed most programmers who code alone can''t stand comments in their code.

Share this post


Link to post
Share on other sites
lol! Yeah, I do this constantly. I''m not sure if I''m speaking from my and other coders point of view, my and users point of view, or my and the computer''s point of view. We''ve been good my precious, here''s a nice new mouse pads fors us. Yes, my precious. Anyway, can''t wait for LOTR''s movie. Now I''m tending toward colder no point of view at all.

// load the data into the surface
// calculate position in the file

Share this post


Link to post
Share on other sites
quote:
Original post by Caffeine
Programmers only comment to explain to other programmers, not to themselves.
I''ve noticed most programmers who code alone can''t stand comments in their code.


I think those people simply haven''t yet had the joy of having to come back to code they wrote half a year ago and have no clue what is going on. Now I put huge time and effort into properly documenting code that another human being will likely never read. So what about those of us lone coders that still comment? Are we simply developing a good habit for when actually getting a programming job, or are we simply whacked out?

Share this post


Link to post
Share on other sites
Oh, and I code for myself as much as for other''s. When you have to render player 2 before player 1 for some nuince of prediction code, that little comment from 3 months ago comes in handy.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The code speaks the truth, the comments are just someones perception of the code.

Force people to learn to read code and forget the comments!
muahhahaha


Share this post


Link to post
Share on other sites
I think both forms are a sign of mental illness actually. Is it the programmer her/himself who is performing the action, or is it the program?

I generally use the third person in my comments, for example:

# this code loads the data into the surface

or

# calculates the current position in the file.

Only use first person when making a note to myself:

# this is an awful hack, I should take another look at this after I get a full night of sleep.

(Also use this as a safety check before checking my code into version control. If I do a search on the module for "hack" or " I ", and get something back, I know that it''s not ready to be checked in.)

I''m actually kind of curious now - is it more common for people to use first person (either single or plural) or third person in their comments? In my experience, I tend to see either third person or no comments at all (unfortunately).

-pwd

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
As for real mental issues.. spending hours alone thinking to yourself doesn''t help you become less introverted... =)

Share this post


Link to post
Share on other sites
// load the file forwards this time stupid or I will smash your fn screen in

// convert the BGR to RGB and keep the damn G in the same place

// if you can''t increment the bloody variable this time you can get the hell out of here.

Share this post


Link to post
Share on other sites
I think its a carry-over from the way we are taught in school and not really related to programmers specifically. (Though in my opinion a large number of programmers really do suffer from some degree of mental illness if you include things such as depression, social phobia, etc.)

When a teacher is demonstrating something to a class it is fairly common for him or her to say things such as ''ok, now we take this and multiply it by this'', the ''we'' being the teacher and those in the class. I believe since comments are generally written to illuminate and possible teach things to third parties reading the code, we (as in, we programmers) tend to use the same style of ''speaking''.

Share this post


Link to post
Share on other sites
quote:
Original post by ShiningKnight
I comment my code with song lyrics, jokes, plugs for mountain dew, and occasionally, some useful comments.


It wouldn''t surprise me if we see open source software funded by in code advertising...


Mike

Share this post


Link to post
Share on other sites
lol, open source sponsorship!

Hmm... mentally ill? probably not - maybe it''s because they''ve read other people''s code and have always seen ''we'' or ''our'' so maybe one mentally ill programmer a long time ago sparked off this trend.

Of course, people do write comments in the first person such as

// I can''t believe I''ve written such a hack

now that just wouldn''t make sense any other way...

Alternatively, the ''we'' and ''our'' could be specifying the programmer and computer together, because one cannot perform without the other effectively.

Maybe I should go to bed.

-Mezz

Share this post


Link to post
Share on other sites
That''s weird... I usually seperate myself from the actual code I write and just state the action that is occuring:

//load the data into the surface

and

//calculate position in the file

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
A funny story about commenting our code:

I was working on a project about this time last year and got about half way through before an unforseen circumstance put my coding career on hold for 6 months. When I went back to look over my code, I was *so* happy I had commented it thoroughly. Not only did it help me to understand what was going through my mind while I was writing the code, it made code sections specific to different tasks easy to isolate and follow, rather like topics in an report outline.

The moral: We never know when we''re going to need to go back through our own code, so comment comment comment.(and be nice to your future self because he may not be in a good mood when he does.)

Share this post


Link to post
Share on other sites
quote:
Original post by Vetinari
It wouldn''t surprise me if we see open source software funded by in code advertising...



Uhoh... this may become a new Microsoft standard in .NET2.

Share this post


Link to post
Share on other sites
I don''t always use ''we'' or ''our'' but when I do, I am talking
to whoever else may be looking at the code(and maybe the
computer, if computers ever get smart enough, it might help
them to understand our code). What''s interesting(to me) is
that I do the same when writing. The best example I can think
of is Stephen King''s introductions to some of his books when
he refers to the reader as ''Dear Reader''. I''ve seen it in other
books but can''t remember which. Anyway, I like it when
an author speaks directly to the reader.

Create.

Share this post


Link to post
Share on other sites
quote:
Original post by Thrump
Now I''m tending toward colder no point of view at all.

// load the data into the surface
// calculate position in the file




This is how I comment, no point of view and straight to the point. However, if you really look at it it''s kinda like your talking to the code/computer/compiler/whatever... I wonder if this is even more of a deep psychological problem than first person and third person?!


Digital Radiation

Share this post


Link to post
Share on other sites
I deeply believe that the best comments possible are well named variables, functions, classes, etcetera. Code, can change, and you might be to lazy/busy/tired to update the comments, but the function names, etcetera will remain correct (hopefully we arent using a variable called "D3DDevice" for a loop variable =). Still Pre, Post, and a Description comment at the beginning of a function are always good.

Z.

Share this post


Link to post
Share on other sites
Commenting can also be good if you release your code. I don''t like downloading source code and then having to read and re-read each line over and over before it starts making sense. Sometimes I refer to things in first-person, and sometimes I say ''we'':

//Now we read in the bitmap file header...

Often I''m just to the point:

//Load data

//Set camera position

//etc

Sometimes when I get angry that the code will not work, I use comments as a means to threaten the compiler into making it work:

//You better be able to load this file, cause IF YOU DON''T...

Share this post


Link to post
Share on other sites
Whenever I come across of uncommented, confusing code, I always insert:

// is an evil toad


And then gleefully cackle when they come upon it...

-----------------
The Goblin (madgob@aol.com)
-----------------
"Before critisizing somebody, walk a mile in their shoes. That way, when you do critisize them, not only will you be a mile away, but you''ll also have their shoes!"

Share this post


Link to post
Share on other sites
I hate to comment since I usually code alone and I don''t need them. I''ve actually come back to uncommented code years after it was written and go "I remember that. Wow...that actually worked?" If I care I touch it up a bit if it''s not too much of an effort.

The Map Editor for Tombstone written over a year ago (DX6) is uncommented and has 2000 lines of code just for interpreting mouse and key commands. I came back to it a couple months ago and managed to successfully add a couple new features that needed to be added. I thought about updating the render loop to match the client''s (nice speed increase) but gave up after a quick review of the source. Didn''t matter anyway.

I don''t mind uncommented code since I''m quite good at reading straight code. I''ve been coding for so long that BASIC and C++ are pretty much my second and third languages.

Ben

Icarus Independent

Jump Down The Rabbithole

Share this post


Link to post
Share on other sites