Dumb x 1 (list)

2. Formatting gave me hard time so I grabbed a class I was working on:

```package miles.entity
{
import flash.geom.Point;
import flash.geom.Rectangle;
import net.flashpunk.Entity;

/**
* An entity that is affected by gravity and friction.
* All movement variables are points to indicate x and y. For instance,
* acceleration(5, 3) means that x acceleration is 5 and y acceleration is 3.
* @author Miles Hearn
*/
public class PhysicsEntity extends Entity
{
/* Accleration is applied every keypress. */
protected var acceleration:Point;
/* Slows the entity down if no keypresses are made. */
protected var friction:Point;
/* Also referred to as speed. */
protected var velocity:Point;
/* The maxium movement speed that this entity can reach. */
protected var maxSpeed:Number;
/* Which direction the entity is facing. 0 is left, 1 is right.*/
protected var facing:uint;
/* The position that the entity will go to after the frame change. */
protected var delta:Point;
/* The position the entity was at last frame that wasn't colliding with the level. */
protected var last:Point;

/* Instead of having to remember if 0 was left or right, use these consts */
protected static const LEFT:uint = 0;
/* Instead of having to remember if 0 was left or right, use these consts */
protected static const RIGHT:uint = 1;

/**
* Sets acc, vel, frc, delta and last to (0, 0) and makes the entity.
* @param	x the coordinate of the entity to the x-axis
* @param	y the coordinate of the enetity to the y-axis
*/
public function PhysicsEntity(x:Number, y:Number) {
super(x, y);
acceleration = new Point;
velocity = new Point;
friction = new Point;
delta = new Point;
last = new Point(x, y); //set to current position
facing = RIGHT;
}
}
}```

3. ```public class Thing {

public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2) {
this.Foo1 = foo1;
this.Foo2 = foo2;
}

public int DoStuff() {
int result;

if (add || Foo1 < 5) {
result = Foo1 + (int)Foo2;
}
else {
result = Foo1 * (int)Foo2;
}

return result;
}
}

//This is how I like to format stuff```

Open bracket on first line master race
Disagree x 10 Dumb x 1 (list)

4. ```public class Thing {

public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2) {
this.Foo1 = foo1;
this.Foo2 = foo2;
}

public int DoStuff() {
int result;

if (add || Foo1 < 5) {
result = Foo1 + (int)Foo2;
}
else {
result = Foo1 * (int)Foo2;
}

return result;
}
}

//This is how I like to format stuff```

Open bracket on first line master race

why do you put braces on the first line? if you're so strapped for linespace why don't you delete the braces on the if/else?

That formatting style is grandpa status.
Agree x 1 (list)

5. nobody else really reads my code so i just make it simple to read, so i don't have trouble navigating through my own monstrous code

Useful x 1 Agree x 1 (list)

7. Formatting only matters when more than one person is working on a project.
Disagree x 15 Optimistic x 1 (list)

8. I put my open brackets on a new line so they match with the close bracket horizontally.
Agree x 9 (list)

9. Formatting only matters when more than one person is working on a project.
This is so unbelievably wrong. A project can quickly become hell to work on when you get buried under unreadable code.
Agree x 6 (list)

10. Formatting only matters when more than one person is working on a project.
If you work on your projects for more than a month, you'll realize that there are parts of your code that go untouched and unviewed for long periods of time. When you finally go back to look at it you might as well be another person looking at your code for the first time. Which is why you should always format things nicely and leave comments where you do something non-obvious.
Agree x 6 (list)

11. Mine's nearly like NPerez, but with a few changes where the vars are declared and such.

Code:
```public class Thing {
public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2) {
this.Foo1 = foo1;
this.Foo2 = foo2;
}
public int DoStuff() {
return (add||Foo1<5) ? Foo1 + (int)Foo2 : Foo1 * (int)Foo2;
}
}
/*This is how I like to format stuff*/```
Edited:

This is so unbelievably wrong. A project can quickly become hell to work on when you get buried under unreadable code.
Then when you're working on that huge project and you need to fix a bug, you won't ever find that pesky minus that should be a plus.

12. Code:
```typedef struct Thing_Tag {
int foo1;
long long foo2;
} Thing;

/* What an useless function. I'd write

Thing something;
something.foo1 = number1;
something.foo2 = number2;

Thing something;
Thing_New(&something, number1, number2); */
void Thing_New(Thing *this, int foo1, long long foo2)
{
this->foo1 = foo1;
this->foo2 = foo2;
}

int Thing_DoStuff(Thing *this)
{
if (this->add || (this->foo1 <= 4))
return this->foo1 + (int)(this->foo2);
return this->foo1 * (int)(this->foo2);
}
/* This is how I like to format stuff */```
Opening curly brace is on the same line for data and on the next line for subroutines (functions, if, for, while).

13. ```class Thing {
public:
Thing(int foo1, long foo2);
int DoStuff() const;

int  Foo1 = 2;
long Foo2 = 5;
private:
}

Thing::Thing(int foo1, long foo2)
: Foo1(foo1), Foo2(foo2)
{
}

int Thing::DoStuff() const
{
int result;
if (add || Foo1 < 5) {
result = Foo1 + (int)Foo2;
} else {
result = Foo1 * (int)Foo2;
}
return result;
}

// This is how I like to format stuff
```

K&R + 4 space soft tabs.

Incidentally, the if/else statement was presumably to see how you format your if brackets.
Therefore if you compressed the if when you pasted your snippit, you've kind of missed the point.

14. Then when you're working on that huge project and you need to fix a bug, you won't ever find that pesky minus that should be a plus.
That doesn't make sense. So because I like to format my code nicely and keep it organized, it becomes harder to find something that needs fixing? It seems like it should be the other way around.

15. Am I the only one who prefers his public and privates indented?

```class Thing {
public:
int Foo1;
int Foo2;
private:
int Foo3;
int Foo4;
}
```
Agree x 4 Useful x 1 (list)

16. Am I the only one who prefers his public and privates indented?

```class Thing {
public:
int Foo1;
int Foo2;
private:
int Foo3;
int Foo4;
}
```
I used to do it like that when I used notepad++.
But when I started using editors with smart-indenters they always put them put them at the same level as the class declaration so I figured it'd be less fuss to just get used to that.
Agree x 2 (list)

17. Am I the only one who prefers his public and privates indented?

```class Thing {
public:
int Foo1;
int Foo2;
private:
int Foo3;
int Foo4;
}
```
I usually indented them, as you do, until I started C#, which I don't think has categories of public and private.

18. Am I the only one who prefers his public and privates indented?

```class Thing {
public:
int Foo1;
int Foo2;
private:
int Foo3;
int Foo4;
}
```
TIL that you can group publics and privates like that!

Edit: Nvm, didn't know that was only in C++

19. TIL that you can group publics and privates like that!
That's C++. You can't in C# and Java.
Agree x 3 (list)

20. Code:
```public class Thing {

public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2){
this.Foo1 = foo1;
this.Foo2 = foo2;
}

public int DoStuff(){
int result;

result = Foo1 + (int)Foo2;
} else {
result = Foo1 * (int)Foo2;
}

return result;
}

}```
Seems to be somewhat unique

21. where are your accessors boy
Agree x 2 (list)

22. Open bracket on first line master race
I have tried on multiple occasions to understand how this actually makes stuff easier to read, and I always find it makes code look more convoluted than it need to be.

I find :

Code:
```public int AddExample(int x, int y)
{
return (x + y);
}```
Looks much easier to read (for me, that is) than:

Code:
```public int AddExample(int x, int y) {

return (x + y);
}```
When you get into long methods, it gets to be a royal pain to see where they actually end. Since you have to look diagonally to find where the open-close brace pair.

But in the first example, its just a simple up - down movement to view them.
Agree x 5 (list)

23. Code:
```public class Thing {
public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2) {
this.Foo1 = foo1;
this.Foo2 = foo2; }

public int DoStuff() {
int result;

if (add || Foo1 < 5) {
result = Foo1 + (int)Foo2; }
else {
result = Foo1 * (int)Foo2; }

return result; }}

// This is how I like to format stuff```
Managed to pack in a few more lines.
Disagree x 2 (list)

24. Code:
```# I format my code the only way it will fucking work - <3 Python

class Lol():
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c

def sum(self):
return self.a+self.b+self.c

c = Lol(1,2,3)
print c.sum()```
Funny x 2 (list)

25. Code:
```public class Thing
{
public int Foo1 = 2;
public long Foo2 = 5;
public Thing(int foo1, long foo2) {
this.Foo1 = foo1;
this.Foo2 = foo2;
}

public int DoStuff() {
int result;
if (add || Foo1 < 5) {
result = Foo1 + (int)Foo2;
} else {
result = Foo1 * (int)Foo2;
}
return result;
}
}

//This is how I like to format stuff```

26. Code:
```public class Thing {
public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2) {
this.Foo1 = foo1;
this.Foo2 = foo2; }

public int DoStuff() {
int result;

if (add || Foo1 < 5) {
result = Foo1 + (int)Foo2; }
else {
result = Foo1 * (int)Foo2; }

return result; }}

// This is how I like to format stuff```
Managed to pack in a few more lines.
Python mode?
Informative x 1 (list)

27. ```public class Thing{
public int Foo1 = 2;
public long Foo2 = 5;
public Thing(int foo1, long foo2){
this.Foo1 = foo1;
this.Foo2 = foo2;}
public int DoStuff(){
int result;
if (add || Foo1 < 5){
result = Foo1 + (int)Foo2;}
else{
result = Foo1 * (int)Foo2;}
return result;}}

// this is how I like to format stuff
```

im so sorry
Optimistic x 1 (list)

28. I have tried on multiple occasions to understand how this actually makes stuff easier to read, and I always find it makes code look more convoluted than it need to be.

I find :

Code:
```public int AddExample(int x, int y)
{
return (x + y);
}```
Looks much easier to read (for me, that is) than:

Code:
```public int AddExample(int x, int y) {

return (x + y);
}```
When you get into long methods, it gets to be a royal pain to see where they actually end. Since you have to look diagonally to find where the open-close brace pair.

But in the first example, its just a simple up - down movement to view them.

I don't think it's necessarily better, but more of a preference thing - that's how I learned when I started and have been formatting that way ever since. The goal of this style of indentation is so the closing bracket is the only thing matching the indentation of the opening statement, e.g. the while and if below. That makes it easier to see in my opinion

Code:
```- (int) foo (int:number) {

int x = 5
int y = 6
int number = 1

while (x > y) {
x += 1
}

if (x > y) {
number += 5
}

return number
}```

29. Is there a vs2012 c++ plugin that autoformats your code?
Funny x 1 (list)

30. Ctrl+K Ctrl+F
Agree x 1 (list)

31. Code:
```public class Thing
{
public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2)
{
this.Foo1 = foo1;
this.Foo2 = foo2;

}

public int DoStuff()
{
int result;

if (add || Foo1 < 5)
{
result = Foo1 + (int)Foo2;

}

else
{
result = Foo1 * (int)Foo2;

}

return result;

}

}

//This is how I like to format stuff```
I put a space between anything and an if statement or class or function. I also put an extra tabbed line before ends or }s.

32. Code:
```<?php get_header(); ?>

<div id="content">

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>
<div class="entry">
<div id="post-<?php the_ID(); ?>">
<div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<abbr title="<?php the_date('D dS M, Y'); ?><?php //the_time('Y-m-d\TH:i:sO'); ?>"><?php unset(\$previousday);?> Scribbled on <?php the_time('l, F jS, Y'); ?> </abbr> <!-- by <?php the_author() ?> -->
<br /><br />

<?php the_meta(); ?>

</div></div>

<?php endwhile; ?>
<div class="alignleft"><?php next_posts_link('<span class="prev"> Previous Entries</span>') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries <span class="next">&nbsp;</span>') ?></div>
</div>-->
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

<div class="post-audits">

<div class="post-recents">
<ul><h2>Recent Posts</h2>
<?php \$query='showposts=5&offset=0';
\$recent = new WP_Query(\$query);
while(\$recent->have_posts()) : \$recent->the_post();
?>

<li><a  target="_blank" href="<?php the_permalink(); ?>" title="<?php the_date('D dS M, Y'); ?>"><?php the_title(); ?></a></li>

<?php endwhile; ?>

<br/> <br/>
<?php endif; ?>

</div> </div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>```
Artistic x 2 (list)

33. Code:
```                         public class Thing{
public int Fo
o1 = 2;public long Foo2 = 5;private bool add
= false;

public Thing(int foo1,long foo2){
this.Foo1
= foo1;
this.Foo2 = foo
2;} public in
t DoStuff(){int r
e
s
ult;if (add || Foo1 < 5) result = Foo1 + (int)Foo2;
else result = Foo1 * (int)Foo2;return result;
}
}

//This is format how like I stuff.```
Disagree x 2 Artistic x 2 Dumb x 1 Funny x 1 (list)

34. C#:
```public class Thing
{
public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int foo1, long foo2)
{
this.Foo1 = foo1;
this.Foo2 = foo2;
}

public int DoStuff()
{
int result;

if (add || Foo1 < 5)
{
result = Foo1 + (int)Foo2;
}
else
{
result = Foo1 * (int)Foo2;
}

return result;
}
}

// This is how I like to format stuff
```

Java:
```public class Thing {
public int foo1 = 2;
public long foo2 = 5;

public Thing(int foo1, long foo2) {
this.foo1 = foo1;
this.foo2 = foo2;
}

public int doStuff() {
int result;

if (add || foo1 < 5) {
result = foo1 + (int)foo2;
} else {
result = foo1 * (int)foo2;
}

return result;
}
}

// This is how I like to format stuff
```
Funny x 2 (list)

35. #@@
0123
1E
Dumb x 3 Programming King x 1 (list)

36. Code:
```public class Thing
{
public int Foo1 = 2;
public long Foo2 = 5;

public Thing(int Foo1, long Foo2)
{
this.Foo1 = Foo1;
this.Foo2 = Foo2;
}

public int DoStuff()
{
if (add || Foo1 < 5)
return Foo1 + (int)Foo2;

return Foo1 * (int)Foo2;
}
}

//This is how I like to format stuff```
Agree x 2 (list)

37. How would you even format an assembly document? If I'm not mistaken, scope isn't a factor, which would mean there's a lot of opportunity to get lost.

38. line breaks and comment banners.
Agree x 1 (list)