The code-formatting tag has no wiki summary.
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 ...
2
votes
2answers
286 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 ...
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 , ...
-3
votes
1answer
115 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 ...
57
votes
39answers
19k 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())
{
...
3
votes
1answer
257 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
153 views
Indenting/formatting brackets like { } and [ ] [closed]
Is there an application that can easily align/format brackets such as [ ] { and } ?
e.g. change
{
{
}
}
into
{
{
}
}
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 ...
0
votes
4answers
159 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', ...
-1
votes
1answer
172 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
196 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 ...
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
...
4
votes
2answers
222 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
340 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 ...