The tag has no wiki summary.

learn more… | top users | synonyms

14
votes
8answers
659 views

Should I write compact code or code with lots of spaces? [duplicate]

I have two friends that have completely different schools of thought on how to lay out their code. The first says that code should be well-indented and use lots of spaces and to name variables ...
3
votes
1answer
74 views

Chosing a parser for a code beautifier

I'm in the planning stage of making a code beautifier (similar to AStyle or Uncrustify) - originally I was going to just contribute to one of those projects, but reviewing their source led me to the ...
11
votes
4answers
869 views

Is it a good idea to format the code in eclipse using auto format

I use eclipse for coding, and the language which we use is Java. Once it was suggested by someone that to properly format the code, using the auto formatter(CTRL+SHIFT+F) While this command does ...
2
votes
2answers
479 views

Closest Point of Approach (CPA) mathematical formula in ship radar

I was recently searching for the mathematical formula to find closest point of approach (CPA) between one ship and another ship. I need to apply the formula in my radar ship program and I can't find ...
43
votes
10answers
2k views

Is imposing the same code format for all developers a good idea?

We are considering to impose a single standard code format in our project (auto format with save actions in Eclipse). The reason is that currently there is a big difference in the code formats used by ...
-3
votes
1answer
120 views

English Capitalization Rules [closed]

It's common to capitalize class names (nouns) and not variables (proper nouns). Types are not usually capitalized, but classes are. This is inconsistent if a class is indeed a type or should be used ...
3
votes
1answer
259 views

Are there published guidelines, standards, or references that propose more than 80 chars per line?

Despite increases in screen size and resolution, many sources still suggest that code be limited to 80 characters per line. I realize than there are many different opinions on this subject, but I ...
0
votes
2answers
158 views

Indenting/formatting brackets like { } and [ ] [closed]

Is there an application that can easily align/format brackets such as [ ] { and } ? e.g. change { { } } into { { } }
-1
votes
1answer
173 views

Javascript Form Validation

When validating a JavaScript form, would it be better to process each input field individually, or, where possible check collectively? e.g. validate() { noblanks() fieldOne() ...
0
votes
3answers
203 views

How to work with badly written and formatted code

I was wondering how people deal with working in a project with badly written and formatted code, I'm talking mixed tabs and spaces, unnecessary parentheses and newlines and a whole bunch of warnings ...
4
votes
2answers
234 views

What code format has been verified by case studies as most readable? [closed]

Are there any eye tracking case studies, or similar research done to verify what code format is easiest to read, maintain and work with. I always format my code this way. function thing() { ...
10
votes
4answers
348 views

Is it a good practice to use Auto Format the text?

I'm using Eclipse and I will talk about it as an example but I am sure that this is the case in any other IDE. Eclipse has the CTRL-Shift-F command which automatically formats your code. Is it a good ...
0
votes
6answers
2k views

IF ELSE shorthand. Does it hurt readability [duplicate]

Possible Duplicate: Is the ternary operator evil? Does using shorthand if else statments hurt readability? Compare: string name = street != null ? street.Owner : "Not known"; With: ...
27
votes
14answers
4k views

Why isn't rich code formatting more common?

I was reading Code Complete and in the chapter on layout and style, he was predicting that code editors would use some sort of rich text formatting. That means, instead of code looking like this ...
2
votes
2answers
154 views

Parameter order: size, count or the other way round

I hope this is the right forum for this ... Well, in C, the standard library uses usually (void* buffer, int size) when referring to some data buffer. I wonder if there is a rationale for this order ...
6
votes
2answers
1k views

Algorithm for formating SQL code

I need a tool (for in house usage) that will format SQL code (SQL Server/MySQL). There are various 3rd party tools and online web sites that do it but no exactly how I need it. So I want to write my ...
6
votes
3answers
764 views

Closing tag (?>) on PHP files?

Some people swear by closing their PHP files with ?>, some say it's more optimized to leave it off. I know that it's not essential to have it on there, I'm just wondering what the pros and cons ...
22
votes
5answers
654 views

Formatting code a bad thing when using a VCS?

I almost always format my code before I commit to make sure it's done properly. Most of my team don't really care and don't always format their code properly (minor things that don't affect the code ...
8
votes
3answers
250 views

Code formatting : Laying out functions based on call hierarchy within a class file?

A suggestion from Bob Martin's "Clean code" has me scratching my head.. "If once function calls another, they should be vertically close and the caller should be above the callee" So far, I've been ...
5
votes
1answer
2k views

Header comment format

I realize that the "header comment" format varies from programmer to programmer, but what would be an example of a "good" header comment?
5
votes
3answers
4k views

SQL Query Builder/Designer and code Formating

I write SQL query every now and then, I could easily write them freehand, but sometimes I do create SQL queries using SQL Query Designers for various reason. (I wont start to enumerate them here ...
1
vote
3answers
375 views

Formatting PHP, what works more efficiently?

I was just wondering what makes PHP work faster. I have a few methods that I always go and do, but that only improves the way I can read it, but how about the interpreter? Should I include the curly ...
24
votes
27answers
3k views

Is it common to print out code on paper?

I like to keep my lines of code under 80 characters because: I don't have to do any horizontal scrolling; I know the line is probably too complicated if it exceeds this limit; and it prints out ...
12
votes
2answers
897 views

Best way to organize SQL queries stored in your code ? (or should you?)

I am sure I am not the only one who gets frustrated when they see a page of code littered with SQL queries. The ActiveRecord and other ORM patterns help mitigate a good amount of SQL used in a ...
0
votes
4answers
160 views

How do you format arrays within parameters?

I'm talking about something like this: echo $form->input('general_addresss', array( 'label' => 'Where will you go today?' 'format' => array('before', 'input', ...
7
votes
7answers
2k views

Code formatting SQL queries

Should I break SQL queries in different lines? For example in the project I am working on, we have a query that is taking 1600 columns! 1600 + tab chars. I wrote queries like this: "SELECT bla , ...
26
votes
29answers
9k views

How do you use blank lines in your code?

There has been a few remarks about white space already in discussion about curly braces placements. I myself tend to sprinkle my code with blank lines in an attempt to segregate things that go ...
60
votes
39answers
21k views

Should curly braces appear on their own line? [closed]

Should curly braces be on their own line or not? What do you think about it? if (you.hasAnswer()) { you.postAnswer(); } else { you.doSomething(); } or should it be if (you.hasAnswer()) { ...