Colorization Required

Black and white works fine when I'm reading newspapers. But when I'm reading computer languages of any kind-- from Perl to SQL, from C# to Regular Expressions, from HTML to XML -- I can't bear to read them in black and white any more.


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2006/02/colorization-required.html

I have enjoyed a program called Notepad++, it’s free. I’m going to compare it with Notepad2 and report back.

Notepad++ has a tabbed MDI and Notepad2 doesn’t. That makes me want to stick with Notepad++ right away, but I suppose I can deal with Notepad2 having multiple windows floating around…

you just need Notepad2

I found that XML chunk hard to read without some 4-space tabs to show the different levels of indentation.

Of course, but this entry was about color considered alone, independent of other factors. Better whitespace and layout is a constant.

It’s all about making Notepad2 be your default text editor.

I agree, but colorization isn’t a high priority for Notepad’s future development. We’d be lucky to get the basics like a toolbar, much less an advanced feature like colorization.

And colorization is no help at all for reading plain text files. Which is what a typical Joe Six-Pack user would be doing with it-- and even that would be rare.

I think you are spoiled Jeff. :slight_smile:

Somehow I of cause agree with you, I code visual studio allmost every day and it shows almost the same coloured output.

BUT when I looked through your two examples above, I am not too sure about the colored one is more easy too read. I have the following thoughts…

mono example:

The clean black and white “minimalistic” output is way more easy on my eyes. I have a little defficult see what is begin and end tags, but it is just plain tekst, no noise and fuzz. As you said, I read/write a newspaper.

coloured exampled:
Alot of different colours, I can see the colours explain something. But are they really showing what is important to me? What my eyes first see is the blue colour and it sees the xml namespace ? … I dont change that very often … the attribute ( mimetype ), but I dont change that. I can click on url’s ? But why do I want to do that, I am probably editing/reading an xml file.

Why make everything so pretty and cofusing? What would improve the reading for me would be setting the tab posistions and show the structure for me. Where does the xml node start and where does it end. Is the xml valid?

Give me intelisence and document outlining tools before/instead of the colours.

i think it comes from what the experts from the brain research (don’t know exactly what it’s called in english) call the 2 types of analyzing data from your eyes.

you have 2 main types of analyzing graphical input:

  • serial:

you must concentrate on whats in front of your eyes to tell differences on elements.
just think about the xml document. you cannot tell on first sight whats just text and whats an element name.

but if for example all strings have color a and all elements the color b you can quickly scan the whole document for the structure of the elements.

furthermore like the example above urls are underlined and you can immediately tell there are 3 urls in this document (the other 2 urls in this example are colored as normal strings and cannot be processed serial).

  • parallel:

you can tell on first sight what kinds of elements are in front of you. think of a paper full of geometric forms. 5 squares and 1 triangle. you can immediately tell where the “other” geometric form lies.

sorry for typos and such :slight_smile:

Well I think you hit the nail on the head when you mentioned angle bracket noise. If the data was marked up differently, for easier human consumption for instance, it becomes a little easier to read:

InfoCard

Card ID: http://www.xyz.com/CardId/asd7879das78
Card Name: XYZ Membership card.

and so on…

Colorization would still obviously help because it is adding a sort of metadata about what we’re looking at.

Instead of the color, the first thing I noticed about your colored image was that the quotation-mark characters had changed. (Although in illustration of your point, I suppose it was the colorization that allowed the incorrect characters to stand out from the rest of the text.) Did your colorizing program actually change them to the wrong characters, or does the font you use just have an inappropriate glyph?

Are you aware of any syntax-highlighting editors that allow separate colors for the namespace and the element or attribute names? As I look at your example, I lose track of the element names in a sea of maroon. I think a distinguishing color for the namespace prefixes might alleviate that problem.

Jeff, NotePad2 is not a wished-for upgrade to MS NotePad. It is a separate program written as a replacement for NotePad:

http://www.flos-freeware.ch/notepad2.html

One of the reasons I can’t live without Resharper anymore is the way it colours member variables differenly to locals. Neatly does away with all those annoying “this.var” and “m_var” conventions without sacrificing clarity.

Only indentation could have made either of those XML docs readable.

I second Notepad2, I couldn’t function without it. I even created a U3 version so it’s on my flash drive anywhere I go (download it from a href="http://portableapps.blogspot.com/2006/01/notepad2-programmers-best-friend.html"http://portableapps.blogspot.com/2006/01/notepad2-programmers-best-friend.html/a )

My favorite coloring customization consists in using a light gray background for comments (text color remains black).
This simple thing dramatically boosts the readability of the code IMO: It makes an obvious distinction between comments and code. Browsing through the code by reading comments becomes really easy.

Agreed with Joost : when reading a XML file, indentation is more important than colour.

And I prefer jEdit’s way of colouring XML : tags are blue, content black, and attribute content pink. In the second screenshot, I think that there’s too little difference between black (content) and dark-red (tags).

Our brains seem to aggregate things that are alike thus giving us the ability to group things and grasp them quicker.

I agree with David Chapman - wouldn’t/couldn’t code without Resharper in VS. I use a href="http://www.flos-freeware.ch/notepad2.html"Notepad2 /a for similar reasons.

Yes, I know about Notepad2. I like it, but it has problems with largeish files (due to the Scintilla colorization engine), which is why I use EditPad Pro:

http://www.codinghorror.com/blog/archives/000229.html

Jan is about to release EditPad Pro 6, which I’ve been beta testing. Massive improvements all around, including doing the colorization on a seperate thread for better performance.

Hm, I’ve never seen (much less tasted) Yoo-hoo in Europe, so the seemingly irrelevant question I must ask: is Yoo-hoo better than Coke and/or Pepsi?

As for an online code formatter, I like this one: http://www.manoli.net/csharpformat/

Handles htmlxml,aspx,t-sql,msh, vb, c#

Yes you are spoiled.
But I do find XSL somewhat hard to read especially if it isn’t indented. And unfortunately I usually edit it in notepad, wordpad, or gvim.