The code-formatting tag has no wiki summary.
3
votes
1answer
253 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
145 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
162 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
183 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
212 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
328 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
1k 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
153 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
863 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 ...
5
votes
3answers
599 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
642 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
238 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
1k 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
3k 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
355 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 ...
23
votes
27answers
2k 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
822 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
157 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', ...
5
votes
7answers
1k views
Code formatting sql queries
Should i break sql queries in different lines ?For example in the project i am working we have a query that is taking 1600 columns! 1600 + tab chars..
I wrote queries like this
"SELECT bla , bla2 ...
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 ...
54
votes
39answers
16k 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())
{
...