Questions tagged [whitespace]

20 questions
132
votes
8 answers

Why is trailing whitespace a big deal?

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 eliminate all instances of it. I'm not entirely sure…
EpsilonVector
  • 10,763
  • 10
  • 56
  • 103
16
votes
6 answers

Vertical alignment: yea or nay?

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 Cabal-Version: >= 1.2 License: BSD3 Author: …
Jason Baker
  • 9,625
  • 8
  • 44
  • 67
15
votes
7 answers

Should I write compact code or code with lots of spaces?

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 judiciously in order to organize things in a way so…
12
votes
3 answers

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 receive unexpected results because their input had too…
TacticalMin
  • 265
  • 2
  • 6
10
votes
10 answers

Do Python programmers find the whitespace issue inconvenient?

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 from a Python programmer. Of course, I haven't…
Eric Wilson
  • 12,071
  • 9
  • 50
  • 77
9
votes
4 answers

How strict should you be about indentation/white space?

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 indentation and whitespace. Here are examples of…
dwjohnston
  • 2,543
  • 6
  • 29
  • 49
8
votes
11 answers

Is too much whitespace a bad thing?

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 whitespace, often 3 or 4 lines because it helps me see…
Milo
  • 225
  • 1
  • 2
  • 5
5
votes
4 answers

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

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 going to choose a convention and enforce it in…
wrgrs
  • 324
  • 3
  • 11
5
votes
4 answers

Is lack of whitespace a sign of a cargo cult programmer?

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 understood the form but not the content. There are lots…
user53019
4
votes
1 answer

What is the problem with whitespace in C that Ruby allegedly repeated?

I'm reading the book The Secret Life of Programs by Jonathan E. Steinhart. In it, he mentions in passing: many consider the handling of whitespace in Ruby to be a replay of of a mistake in the original C language that was fixed long ago What…
tsvallender
  • 255
  • 3
3
votes
1 answer

Why tabs are evil in ES6?

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 use them!" Also, another very popular JavaScript…
mg007
  • 155
  • 1
  • 4
3
votes
4 answers

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...
Steve Bennett
  • 3,419
  • 4
  • 20
  • 24
3
votes
6 answers

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 an office where some developers are using emacs and…
qodeninja
  • 532
  • 6
  • 11
2
votes
3 answers

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

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 sense back then, but I only knew some Pascal and…
Alexei
  • 434
  • 4
  • 15
2
votes
4 answers

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 the text fields are stored in a binary file, an…
Jay Elston
  • 2,680
  • 22
  • 30
1
2