Questions tagged [whitespace]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
3 answers
2k views

Why do we still have programming languages that rely on indentation / white space? [duplicate]

A long time ago when starting learning programming I remember a teacher saying that compiler do not care about whitespace and they are useful to make code readable for human beings. It made perfect ...
user avatar
  • 424
3 votes
1 answer
4k views

Why tabs are evil in ES6? [closed]

As I have recently started using ES6 in production, I was going through an ES6 style guide (having more than 350 stars on GitHub). This guide mentions at least three times that "Tabs are evil. Don't ...
user avatar
  • 155
2 votes
4 answers
321 views

What coding practices are most useful dealing with trailing whitespace in data fields in binary files?

We have an application that consists binary files (containing a mix of text and numeric information) and programs written in various languages that create, modify and read these binary files. Because ...
user avatar
  • 2,510
0 votes
2 answers
92 views

Use spaces between parameters? [closed]

Is it poor practice to not use spaces between parameters in a scripting language (or any for that matter)? With spaces: def does_a_thing(x, y): ... does_a_thing(5, 9) Without spaces: def ...
user avatar
  • 167
-2 votes
2 answers
145 views

Tracking column (offset) in presence of tab characters

Imagine that you first write a compiler for your language where you necessarily report errors to the user. Compiler also collects location information for backend tools. They must know where the ...
user avatar
5 votes
4 answers
2k views

Should I edit a codebase's whitespace to conform to a coding style? [duplicate]

We have a large Java project (1m+ SLOC) with mixed whitespace - some files have tabs and some have spaces. It's tricky to make my editor work with whichever file I happen to be editing. We are ...
user avatar
  • 314
8 votes
11 answers
19k views

Is too much whitespace a bad thing? [closed]

I'm often told by my friends and colleagues that I use way to much whitespace. I guess I do use a little too much whitespace. I often add a line break almost after every line and large blocks of ...
user avatar
  • 225
5 votes
4 answers
1k views

Is lack of whitespace a sign of a cargo cult programmer? [closed]

Eric Lippert has written about cargo cult programming, and Steve McConnell has tackled the subject from a Software Engineering point of view. Eric provides a fairly succinct description: They ...
user avatar
0 votes
1 answer
72 views

How using tab affects commands like diff

In the page at http://pear.php.net/manual/en/standards.indenting.php, it is advised to use space instead of tab as it causes issue with diff, patches. Here is the excerpt from the page. Use an ...
user avatar
9 votes
4 answers
1k views

How strict should you be about indentation/white space? [closed]

Our development process is as follows code the task -> someone else QAs code and documentation -> task is merged into trunk. Recently a colleague is refusing to pass the code QA due to issues with ...
user avatar
  • 2,463
12 votes
3 answers
7k views

When should you trim input?

I am intern learning tons about the industry outside of academia. One thing I thought about today was trimming input. On one side of the coin I don't want the user/implementer to constantly ...
user avatar
15 votes
7 answers
6k 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 ...
user avatar
  • 1,042
1 vote
2 answers
495 views

Python code style - blank lines in long list

I'm curious, is there a standard approach to dealing with long lists in the Python community, and in particular, is there any antipathy toward doing blank lines followed by comments to break up a ...
user avatar
2 votes
5 answers
2k views

Is "watermarking" code with random trailing whitespace a good way to detect plagiarism?

Consider this: int f(int x) { return 2 * x * x; } and this int squareAndDouble(int y) { return 2*y*y; } If you found these in independent bodies of code, you ...
user avatar
  • 383
3 votes
4 answers
1k views

Convention for writing Python without newlines or whitespace?

Is there a convention for writing Python when deprived of newlines and whitespace? For example, stackexchange comments, Twitter, text messages...
user avatar
3 votes
6 answers
803 views

How do you limit whitespace differences for developers using different IDEs/environments?

I've used UltraEdit for years and never had a problem with sharing code with fellow developers whether they worked on Windows, Mac, Linux, Eclipse, Visual Studio -- what have you... But now I am in ...
user avatar
  • 532
130 votes
8 answers
114k views

Why is trailing whitespace a big deal? [closed]

Trailing whitespace is enough of a problem for programmers that editors like Emacs have special functions that highlight it or get rid of it automatically, and many coding standards require you to ...
user avatar
10 votes
10 answers
9k views

Do Python programmers find the whitespace issue inconvenient? [closed]

Many programmers, upon first encountering Python, are immediately put off by the significance of whitespace. I've heard a variety of reasons that this is inconvenient, but I've never heard a complaint ...
user avatar
  • 12.1k
15 votes
6 answers
5k views

Vertical alignment: yea or nay? [closed]

For instance, non-vertically aligned: Name: Hamt Version: 0.1.0 Cabal-Version: >= 1.2 License: BSD3 Author: Jason Baker Or vertically aligned: Name: Hamt Version: 0.1.0 ...
user avatar
  • 9,565