Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Code Readability. Break Rule Number 5?

by robot_tourist (Hermit)
on Apr 19, 2007 at 23:11 UTC ( #611053=note: print w/replies, xml ) Need Help??

in reply to Code Readability. Break Rule Number 5?

I think the point about not requiring syntax highlighting is meant to mean that the syntax of the language should not be so complicated that the majority of users need the fancy colours and bold/italics (and even syntax error underlines) to be able to understand it easily.

I've been reading a lot of Edward Tufte's website recently and it got me thinking about this in terms of helping the user be more productive with the tools available, but still with the end goal of better tools. For the minute, though, Perl, while not as much of a soup nazi as the machine on which it runs, is still a strict language, where word order and type matters and it helps the programmer to see rather than read errors as seeing is faster than reading. Differentiating by colour is faster still than parsing the difference between a heredoc and code.

I was going to say that syntax highlighting benefits maintainers, especially those who may not be as familiar with the language as the original 'guru', so that when they open up the editor, their vision is challenged by the colours on screen and then it is easier to skip visually through the code as it is not just one lump of black and white marks on the screen (HT/HP Basic, I'm looking at you, with your lack of spatial freedom and primitive monochrome IDE). But then I thought that functional higlighting rather than syntactical highlighting would be a great useful addition, e.g. so that you can tag related bits of a program with the same colour as you try to read it and understand the flow. I think VS may already have it, I was using it today at work, but can't remember, I never thought about it before this thread. I don't think XCode has user highlighting.

On your point about extra operators (1 and 2), apart from not having the glyphs visible on the keyboard, I think a good programming language should not cause Carpal Tunnel Syndrome or force it's users to learn too much over and above the normal set of characters in order to use it. However, I think captial Sigma and capital pi are probably good suggestions for extra operators as they are likely to be well understood by any programmer who has even an high school education. As for the arrow, I think the period is slightly better for OOP and I don't tend to use arrows for hashes anyway.

Rereading your point 5 I think that it is a little more useful than I first thought, but still sounds like another way to create a watch list. My original thought was that in general, I think the value of plain text as a way of writing code is the benefit of speed of entry without too much worrying about formatting other than lining up lists vertically and stuff. At the minute, most editors and even Word 2007's ribbon, don't have the facilities to enter even rudimentary formatting faster than the average programmer can type. Speed of entry is crucial where you need the throught process to flow. Having said that, most problems could well be designed out. When you think about it CTRL+I for italic is little different from SHIFT+[ to open a curly bracket. What you then get down to is more a carryover from the UNIX philosophy/tradition of human readable plaintext wherever possible, although if you go down the rich text route you could have xml and a stylesheet, but that complicates things too much for me. I think the goal of code should be what you see is what is done. I supose as well, that code could be thought of as cash. Not always the best transaction medium, e.g. debit cards can be more efficient, but everyone accepts cash, like text flowing through data pipes. Debit cards need more infrastructure than cash in a similar way to rich text and diagrams needing more infrastructure than ASCII.

Finally, I think a slightly different take on syntax highlighting would be useful for something like LilyPond source files, e.g. each beat in a bar gets a different colour (most music doesn't go past about 12/8 and even that could be argued to be similar to 4/4).

I hope everyone here will read Tufte and his forum contributors so that they can be more creative and productive in creating user interfaces and presenting output.

How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
Robot Tourist, by Ten Benson

  • Comment on Re: Code Readability. Break Rule Number 5?

Replies are listed 'Best First'.
Re^2: Code Readability. Break Rule Number 5?
by chromatic (Archbishop) on Apr 20, 2007 at 06:18 UTC
    Differentiating by colour is faster still than parsing the difference between a heredoc and code.

    Perhaps for people with normal color vision it is.

      Er, that makes little sense. I can't think of an editor that offers syntax coloring that doesn't also allow you to choose your colors. If red/green give you problems, don't use red for heredocs and green for comments (or some such). Even if you were unable to see ANY color, you could pick strong and weak shades of gray that would help you parse visually.

      I agree in general with the "don't depend on syntax coloring" but I won't go so far as to say that syntax coloring is unhelpful.

      [ e d @ h a l l e y . c c ]

        Even if you were unable to see ANY color, you could pick strong and weak shades of gray that would help you parse visually.

        No, it really doesn't work that way. To disambiguate certain colors (and especially shades), I have to concentrate specifically on the colors to the exclusion of everything else.

        If using specific colors helps you personally, that's fine--but it slows me down measurably and raises my frustration level dramatically.

        My friends and I have gone as far as to mark all playing pieces in board games to disambiguate colors such as brown and green. Green pieces have little white dots, for example. Otherwise, I won't play because I spend too much time trying to distinguish the colors of individual pieces when everyone else can glance at the board and see what's happening.

        Again, if using specific colors helps you personally, that's fine--but despite red-green colorblindness affecting a statistically significant percentage of men in the world, the default choice of colors nearly always mixes red and green if there are more than two colors. I have my doubts that I could use any system that used color coding at its default settings.

      An interesting comment made from someone whose nick is chromatic :-)

      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Don't fool yourself.
Re^2: Code Readability. Break Rule Number 5?
by DACONTI (Scribe) on Apr 20, 2007 at 13:34 UTC
    Thank you for the very interesting Link.
    I'll look at your stuff, it will take me however much time...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://611053]
[erix]: /hehehe
[marto]: LanX yesterday I found out about Gish gallop tactic
[marto]: "Eugenie Scott, executive director of the National Center for Science Education, dubbed this approach the Gish gallop, describing it as "where the creationist is allowed to run on for 45 minutes or an hour, spewing forth torrents of error that the
[marto]: evolutionist hasn't a prayer of refuting in the format of a debate." She also criticized Gish for failing to answer objections raised by his opponents"
[erix]: one would hope evolutionists haven't any prayers anyway

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2017-07-28 15:40 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (431 votes). Check out past polls.