OPC (Other People's Code)

  • (6 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6

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

#61 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 12 February 2009 - 02:14 AM

Beta your standards are pretty much perfect in my eyes. :wub:
Was This Post Helpful? 0
  • +
  • -

#62 5ubw0r1d  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 18-May 07

Re: OPC (Other People's Code)

Posted 12 February 2009 - 08:15 AM

@no2pencils attachment

Third time I've seen that diagram today. Is the world really full of n00bs?

This post has been edited by 5ubw0r1d: 12 February 2009 - 08:16 AM

Was This Post Helpful? 0
  • +
  • -

#63 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 6180
  • View blog
  • Posts: 10,683
  • Joined: 28-September 07

Re: OPC (Other People's Code)

Posted 12 February 2009 - 08:21 AM

Yes. noobs. nubs. and nerds. that's all there is.
Was This Post Helpful? 0
  • +
  • -

#64 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3106
  • View blog
  • Posts: 19,145
  • Joined: 14-September 07

Re: OPC (Other People's Code)

Posted 12 February 2009 - 08:32 AM

What about newbs?
Was This Post Helpful? 0
  • +
  • -

#65 Shadow 1.2  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 70
  • Joined: 17-October 07

Re: OPC (Other People's Code)

Posted 12 February 2009 - 10:40 AM

How about somebody creates a tutorial to help any new programmers/beginners showing them how to create Readable Code, i hate to admit but i am a bit sloppy myself sometimes and definetly wouldnt be able to make that tutorial but one like that would help beginners(/sloppy writers) alot
Was This Post Helpful? 0
  • +
  • -

#66 5ubw0r1d  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 18-May 07

Re: OPC (Other People's Code)

Posted 13 February 2009 - 03:10 AM

View PostShadow 1.2, on 12 Feb, 2009 - 09:40 AM, said:

How about somebody creates a tutorial to help any new programmers/beginners showing them how to create Readable Code, i hate to admit but i am a bit sloppy myself sometimes and definetly wouldnt be able to make that tutorial but one like that would help beginners(/sloppy writers) alot


The only problem with that is that different people have different styles. The comments in a tutorial like that would probably echo this thread.
Was This Post Helpful? 0
  • +
  • -

#67 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5364
  • View blog
  • Posts: 27,325
  • Joined: 10-May 07

Re: OPC (Other People's Code)

Posted 13 February 2009 - 03:17 AM

View PostShadow 1.2, on 12 Feb, 2009 - 11:40 AM, said:

How about somebody creates a tutorial to help any new programmers/beginners showing them how to create Readable Code


We make constant suggestions to posters here about their coding styles & lack of organization constantly. Most of the time those opinions are ignored.

You're familiar with the phrase "You can lead a horse to water..." yes?

Besides, usually readable code is readily available in books & tutorials. It's available everywhere.
Was This Post Helpful? 0
  • +
  • -

#68 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 13 February 2009 - 06:27 AM

Quote

"You can lead a horse to water...
...but you can't lead a woman to no2pencil? ;)

Generally, decent standards are taught through books and schools, so I don't see where people pick it up from. Especially considering most IDEs have automatic indentation nowadays...
Was This Post Helpful? 0
  • +
  • -

#69 OliveOyl3471  Icon User is offline

  • Everybody's crazy but me!
  • member icon

Reputation: 134
  • View blog
  • Posts: 6,581
  • Joined: 11-July 07

Re: OPC (Other People's Code)

Posted 13 February 2009 - 08:34 AM

Quote

most IDEs have automatic indentation nowadays...


Dev-C++ doesn't. :sad3: Well I guess it does, but the way it indents make the code look sloppy.

For some reason, formatting was/is hard for me. It's even harder than writing the code. I'm just now starting to get the hang of proper indenting, etc. :blush:

This post has been edited by OliveOyl3471: 13 February 2009 - 08:36 AM

Was This Post Helpful? 0
  • +
  • -

#70 buckrogers1965  Icon User is offline

  • New Member

Reputation: 9
  • View blog
  • Posts: 87
  • Joined: 23-January 09

Re: OPC (Other People's Code)

Posted 13 February 2009 - 06:49 PM

I always run the indent command on code before I look at it. Been bitten too many times by the indent level not actually matching the bracing level.

Of course when I check the code in it updates every line of code in that module, which tends to annoy people keeping an eye on the updates in the repository.

I highly recommend implementing indenting and white space requirements as arguments to the indent command, then you can apply the style for your company for any new code by running the indent command with those options on any code before you check in initially, or before you update any changes.

I also have been running indent on any code I try from this site, and any code I post here.

This post has been edited by buckrogers1965: 13 February 2009 - 06:51 PM

Was This Post Helpful? 0
  • +
  • -

#71 Goobicon  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 23
  • Joined: 16-February 09

Re: OPC (Other People's Code)

Posted 17 February 2009 - 10:05 AM

I used to put the top brace in the if conditional on it's own line, because that's how they used to do it in old school books. It used to bug the crap out of me if the top brace was put on the same line as the conditional (or whatever requires an opening and closing brace). After seeing it for so long in newer books though I have decided I like it better.

I.e.:


if(condition)
{

   //Boooooo!!!!

}

//vs.

if(condition){

   //w00t!!!

}




As for declaring the variable in the for loop, I always thought that was a good programming practice since it helps where it would otherwise possibly cause issues with scope. In some languages (the way I understand it) if it's declared in the for loop it's only in scope inside the loop and then the variable 'dies' outside the for loop braces. If it's declared outside the loop then it could still be accessed as long as it's in scope in the function, class or whatever it's inside of.
Was This Post Helpful? 0
  • +
  • -

#72 Hyper  Icon User is offline

  • Banned

Reputation: 108
  • View blog
  • Posts: 2,129
  • Joined: 15-October 08

Re: OPC (Other People's Code)

Posted 17 February 2009 - 10:40 AM

View PostAmadeus, on 9 Feb, 2009 - 04:52 PM, said:

In order for me:

1. Horrible variable naming conventions (as noted by baavgai, things like a,b,c)
2. A huge amount of comments on self evident code, with virtually non on complex routines. Put a comment block before the section with an explanation of what is going on, and spare me the //declaration of counter variable bullshit.

I find badly spaced or indented code to be a minor annoyance easily compensated for, but annoying nonetheless.


I can agree with all of the above, and the if-else statement chains.
I have poor naming conventions with functions sometimes though.
Was This Post Helpful? 0
  • +
  • -

#73 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: OPC (Other People's Code)

Posted 17 February 2009 - 11:08 AM

You know it's funny, but so do I...although I hate poor variable naming conventions, I seem to employ them when it comes to functions. :)
Was This Post Helpful? 0
  • +
  • -

#74 Hyper  Icon User is offline

  • Banned

Reputation: 108
  • View blog
  • Posts: 2,129
  • Joined: 15-October 08

Re: OPC (Other People's Code)

Posted 17 February 2009 - 11:39 AM

If two negatives become a positive, does that mean if you and I try to make a function naming convention, we'll get something not so negative?
Was This Post Helpful? 0
  • +
  • -

#75 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 18 February 2009 - 03:06 AM

String[] evenodd = {"even", "odd"};
// some newb codezz..
int x = random.nextInt();
if (x % 2 == 0)
  System.out.prnit(x + " is " +  evenodd[0]);
if (x % 2 == 1)
  System.out.prnit(x + " is " +  evenodd[1]);
//end of teh codezz..




Redundancy caused by poor math-skills and lack of understanding of datastructures.

This post has been edited by Gloin: 18 February 2009 - 03:08 AM

Was This Post Helpful? 0
  • +
  • -

  • (6 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6