Jump to content

Why do programmers use "We"?


Recommended Posts

Because we are legion

hqdefault.jpg

Jokes aside, I would say it is used to lead the one who reads the code a bit and "talk" to them, and probably because you we want to include possible contributors too.

Edited by Thomas P.
Link to comment
Share on other sites

Thomas hit it on the head there: we are trying to communicate with the reader, and trying to make reading the code a pleasant experience. For example, //with this function, we need to use the vessel trying to be docked. It gives a more friendly feel. Comments aren't for the writer's  benifit, because they already know what the code means and does. They are for the reader, who is coming into this with (presumably) no coding experience whatsoever. 

Link to comment
Share on other sites

25 minutes ago, Benjamin Kerman said:

Comments aren't for the writer's  benifit, because they already know what the code means and does.

Hehe, I actually write comments explicitly for myself (but if they can benefit others, bonus).

Coming back to some code I wrote months, or years, later -- good commenting is very important.  Especially on any place where I though I was being 'clever', or had to use non-obvious solutions to work-around existing problems in whatever API I was working with.  For obvious boilerplate code... the code should be self-commenting -- with proper variable and function names, you can almost read it as if it were regular english.

E.g.:

//bad code
C = A + B

Displays absolutely no context.  What is A?  What is B?  Why are we assigning it to C?  What is C used for?

 

//self documenting code
TotalEnergyOutput = SolarOutput + GeneratorOutput

Just with proper variable names the code is so much easier to read.  We're summing energy outputs, and storing the total.  Great.  I can now easily tell if there were an error in that calculation/summing.

 

Edit:  On-topic --- I also use 'we' in comments, as I have to assume that they are being read by others, and I'm 'walking them through' the process of the code.

Edited by Shadowmage
Link to comment
Share on other sites

50 minutes ago, Benjamin Kerman said:

They are for the reader, who is coming into this with (presumably) no coding experience whatsoever. 

Not exactly, at least not in my experience. I have always tried to write self-documenting code, that is, code that explains what it is doing by virtue of meaningful expressions and names. I don't use tricks or idiosyncrasies of the language except when it is impossible to avoid them (and then I document that instance and explain why). In this case comments are used to explain "black box" situations (like you encounter in sloppily-typed languages) or to explain the reason why a certain thing was done a certain way. Self-documenting code helps take care of itself; I have rarely come back to read a piece of code I wrote a year ago and not been able to figure out what it does, quickly, nor have I ever received complaints about how a lack of comments made things worse for a colleague ( i must be doing something right because we're talking about PHP in a professional environment and that's pretty much the sloppiest language ever).

Either way, I rarely, if ever, assume that the reader has no coding experience when writing code. Clean, clearly-written, self-documenting, "trick-less" code will be easier for anyone to pick up, experienced or not.

24 minutes ago, Shadowmage said:

I also use 'we' in comments, as I have to assume that they are being read by others, and I'm 'walking them through' the process of the code.

This, it's inclusive and friendly.

Edited by regex
Link to comment
Share on other sites

On 11/22/2017 at 12:06 PM, Nightside said:

I'm vaguely trying to teach myself programming and I notice that code comments are typically written in first person plural.

Does anyone know why?

It's because we use the Royal We.  It happens to allow us to appear inclusive and friendly. :)

Link to comment
Share on other sites

Scientists do the same thing when writing papers. Often because of speaking on behalf of a research team or group. Also the idea is that if you the reader are following along you too are included in the group. It's like holding your hand, so we (you and I) do this thing, not I as I'm not doing it for you.

Link to comment
Share on other sites

  • 2 weeks later...
On 22.11.2017 at 7:11 PM, Thomas P. said:

Jokes aside, I would say it is used to lead the one who reads the code a bit and "talk" to them, and probably because you we want to include possible contributors too.

Einstein had a famous saying that "music is individual effort but science is a team effort". Whether software development is a science is debatable, but it applies the same. 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...