OPC (Other People's Code)

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

84 Replies - 10472 Views - Last Post: 23 October 2012 - 07:36 AM

#1 thepeoplescoder  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 97
  • Joined: 02-February 09

OPC (Other People's Code)

Post icon  Posted 09 February 2009 - 02:30 PM

Okay, a lot of us may enjoy helping people, but let's not lie to ourselves. So, I propose this question:

When looking at other people's code, what tends to annoy you the most?

For me, it's hard to read code. I'm a formatting Nazi. If code isn't indented properly, if there isn't any whitespace between binary operators, and if there isn't whitespace after a comma, it tends to subtly and increasingly get on my nerves.

Let's see how many are bold enough to admit to their pet peeves :D

Is This A Good Question/Topic? 0
  • +

Replies To: OPC (Other People's Code)

#2 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1382
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: OPC (Other People's Code)

Posted 09 February 2009 - 02:39 PM

Interesting topic. Frankly, everything about OPC drives me insane. :)

Moved to the corner cubicle.

The code I maintain at work is old, and I try to avoid it.

But when reading proper code, it has to be indented and to the point. No pussyfooting around what you're trying to do, please. ;)

Rules #3 and #5 in your signature pretty much say it all, actually. :)
Was This Post Helpful? 0
  • +
  • -

#3 thepeoplescoder  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 97
  • Joined: 02-February 09

Re: OPC (Other People's Code)

Posted 09 February 2009 - 02:43 PM

View Postgabehabe, on 9 Feb, 2009 - 01:39 PM, said:

Interesting topic. Frankly, everything about OPC drives me insane. :)

Moved to the corner cubicle.


LoL OH, it's supposed to go there?? Whoops!

Thanks, man.
Was This Post Helpful? 0
  • +
  • -

#4 xCraftyx  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 258
  • Joined: 13-September 08

Re: OPC (Other People's Code)

Posted 09 February 2009 - 02:49 PM

I'm with you on the formatting nazi-ness. I'm in programming I and am constantly helping other students who are beginner programmers, drives me crazy
Was This Post Helpful? 1
  • +
  • -

#5 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4334
  • View blog
  • Posts: 12,128
  • Joined: 18-April 07

Re: OPC (Other People's Code)

Posted 09 February 2009 - 02:58 PM

I do like proper formatting and readability but one thing that annoys me is when you look at code that you know is way out of the programmers league or looks like pieces cut and pasted from various sources.

Don't lie to yourselves and to us, we can see when the style changes from line to line. So if you are going to cut and paste everything to try to get something to work, don't claim it is your own.

;)
Was This Post Helpful? 0
  • +
  • -

#6 thepeoplescoder  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 97
  • Joined: 02-February 09

Re: OPC (Other People's Code)

Posted 09 February 2009 - 02:59 PM

View PostMartyr2, on 9 Feb, 2009 - 01:58 PM, said:

.....but one thing that annoys me is when you look at code that you know is way out of the programmers league or looks like pieces cut and pasted from various sources.

Don't lie to yourselves and to us, we can see when the style changes from line to line. So if you are going to cut and paste everything to try to get something to work, don't claim it is your own.

;)


I so agree.
Was This Post Helpful? 0
  • +
  • -

#7 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: OPC (Other People's Code)

Posted 09 February 2009 - 03:09 PM

It's like, I see sky reading a thread... and have a vision! My vision is that of 10 minutes in the future when the topic is featured. Does sky have a mental radar scanning for witty posts to feature?

ON TOPIC:

My BIGGEST pet peeves are code indenting, and whitespace. Take a decent programmer and mix them with sloppy indenting and whitespace capabilities, and you have a nightmare of a colleague.

There should be laws against improper indenting. Every IDE in the world (In my opinion) should have automatic syntax indenting built into the core. No options for the sloppy coders to "tick off" the indenting feature... for the sake of every other coder on the planet!
Was This Post Helpful? 0
  • +
  • -

#8 Jhin  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 257
  • Joined: 06-July 05

Re: OPC (Other People's Code)

Posted 09 February 2009 - 03:15 PM

Things that bother me about other people's code:

#1 COMMENT YOUR F'N CODE!!
#2 Loop happy coders (yes I understand you worship His Noodliness but damn it your code doesn't have to look like him!)
#3 Readability (aka indenting, whitespace)
Was This Post Helpful? 0
  • +
  • -

#9 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: OPC (Other People's Code)

Posted 09 February 2009 - 03:17 PM

inconsistent or lack of indenting is definitely up there. A lack of explanation, or explanation that could only make sense to the person who wrote the code, drives me insane.

There is a tie in OPC that just slays me time after time. First when someone creates a function to handle an operation, such as sorting, then later in the code they write a block of code that does this inside another function, instead of utilizing the function they had the foresight to write!! Second, when code isn't written to handle any changes, statically assigning everything, using global variables when changes were needed and such, because proper additions were impossible as is.

(in short: clearly unnecessary duplication of code and non-dynamic code)
Was This Post Helpful? 0
  • +
  • -

#10 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5314
  • View blog
  • Posts: 27,220
  • Joined: 10-May 07

Re: OPC (Other People's Code)

Posted 09 February 2009 - 03:18 PM

Quote

Are you down with OPC? Yeah you know me!
Who's down with OPC? All the ladies!!!


On a serious note, it would have to be syntax.

I can't stand when someone asks for help & they have their if statements so far out of whack that I can't tell when an if is ending & another if's else is starting.

if (statement)
  else
	if(statement)
	if(statement else
		 (statement)
			if(statement)
		   else if
			 (statement)
....



& you wonder why there are problems in the logic!
Was This Post Helpful? 0
  • +
  • -

#11 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5832
  • View blog
  • Posts: 12,684
  • Joined: 16-October 07

Re: OPC (Other People's Code)

Posted 09 February 2009 - 04:00 PM

Indenting is easily number one. While there are some style choices that bug me more than others, lack of consistency is a fail no matter how you look at it.

Second, all variables named a,b,c,d,e,aa,ab,xt.... and so on. It doesn't have to be War and Peace, but how much harder is it to use total or even tot, rather than t? Conversely, loop variables named "loop" are rather off putting.

Third is probably cut and paste code. This is part of learning, so you suck it up and explain. But often I'll find myself saying something like "OMG, buy a bloody function, they're free."

View PostJhin, on 9 Feb, 2009 - 04:15 PM, said:

#1 COMMENT YOUR F'N CODE!!


Quite the opposite, here, I'm afraid. Comments, particularly ones like "} //end loop" are very distracting. Chance are most new coders are throwing in comments under duress and it shows. Code is it's own documentation, comments are only needed to point something out that isn't obvious in the code.

In the end, all the above are just elements of style and someone who's new is just doing their best to simply make things work. You try to point out style choices that will make code easier to debug and figure out. And silently tolerate the chaotic coding.
Was This Post Helpful? 0
  • +
  • -

#12 ericr2427  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 38
  • View blog
  • Posts: 376
  • Joined: 01-December 08

Re: OPC (Other People's Code)

Posted 09 February 2009 - 04:03 PM

Quote

if (statement)
else
if(statement)
if(statement else
(statement)
if(statement)
else if
(statement)

That gave me a headache just looking at it :)

Incorrect or senseless (or lack of) formatting drives me crazy!
Was This Post Helpful? 0
  • +
  • -

#13 IrishCereal  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 81
  • Joined: 11-December 08

Re: OPC (Other People's Code)

Posted 09 February 2009 - 04:14 PM

I honestly do not understand why people do this:
if (condition)
  {
  statements
  }



I like it better and think it looks a lot nicer like this:
if (condition) {
  statements
}


This post has been edited by IrishCereal: 09 February 2009 - 04:14 PM

Was This Post Helpful? 0
  • +
  • -

#14 Gloin  Icon User is offline

  • Expert Schmexpert...
  • member icon

Reputation: 235
  • View blog
  • Posts: 4,489
  • Joined: 04-August 08

Re: OPC (Other People's Code)

Posted 09 February 2009 - 04:29 PM

View PostIrishCereal, on 9 Feb, 2009 - 11:14 PM, said:

I honestly do not understand why people do this:
if (condition)
  {
  statements
  }



I like it better and think it looks a lot nicer like this:
if (condition) {
  statements
}



YES YES YES!!! AAaaaaarrrgghh
Was This Post Helpful? 0
  • +
  • -

#15 Jhin  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 257
  • Joined: 06-July 05

Re: OPC (Other People's Code)

Posted 09 February 2009 - 04:30 PM

View Postbaavgai, on 9 Feb, 2009 - 05:00 PM, said:

Quite the opposite, here, I'm afraid. Comments, particularly ones like "} //end loop" are very distracting. Chance are most new coders are throwing in comments under duress and it shows. Code is it's own documentation, comments are only needed to point something out that isn't obvious in the code.


I'm talking about the kind of commenting that succinctly details what you are trying to do with the block of code....

Quote

"Good comments don't repeat the code or explain it. They clarify its intent. Comments should explain, at a higher level of abstraction than the code, what you're trying to do.


Though I have to agree about variable names...single letter variable names that aren't in a for loop are a pain
Was This Post Helpful? 0
  • +
  • -

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »