Aliases, to indent or not?

By Barry Harmsen

“Code is read more often than it is written”

  – common programming adage

As someone who often has to look at/modify QlikView script written by others, I have come to appreciate the value of readable script. Rather than taking an “if it works, it works” attitude, I always try to write my script with readability and consistency in mind. Somewhere down the line someone else (or worse, you) might have to decipher what a specific script is doing in order to modify or extend it.

Today I want to ask your opinion on the readability of a specific part of the QlikView script, indentation of aliases within LOAD statements. To this end, I’ve taken a piece of script from the QlikView System Monitor and formatted the aliases in three different ways. (note: I don’t agree with the absence of white space in functions and between operators, but have left that as is)

Have a look at the three options, and then please answer the two multiple choice questions below.


Option 1

QlikView LOAD script - no indentation of aliases

 


Option 2

QlikView LOAD script - indenting aliased fields

 


Option 3

QlikView LOAD script - indenting all fields

 


You might wonder what the difference between option 2 and 3 is, but I’ll let you discover that for yourself. If you don’t see it, just pick whatever you found most readable.

I’d be very interested in hearing your motivation for picking one option over the other, especially if you answered Something else to the second question. If you’d like to elaborate, or have any other thoughts around this subject, I welcome you to share them in the comments section below.