A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

Verbosity and Strains In Programming Languages


In theory, the verbosity in programming languages shouldn't affect the programmer much since it takes longer to think out the program than it does to type the program on the keyboard.

In theory, the amount of finger strains (such as alt-key, shift-key, and other hard to stretch keyboard zones) in programming languages shouldn't affect the programmer much since it takes longer to think out the program than it does to type the program on the keyboard.

In practice, the verbosity and finger strain effect from a programming language detour a programmer from doing work and too much verbosity can obfuscate the source code.

In modern Pascal, Ansistrings are a terse way of saying this:

  string1 CONCATENATE--> string2 CONCATENATE--> string3 CONCATENATE--> string4
If we replace CONCATENATE with the plus sign
  string1 + string2 + string3 + string4
In theory, one could argue that having to type CONCATENATE--> will not affect the programmer since most of the coding he does is in his mind, and that the keyboard plays a very small role in the end result of a program.

In practice, humans have hormones and chemicals in their bodies which do not enjoy extra effort if there is a cleaner and more precise way. For example, why would you go to the store 3 times in one day, if you could go once? In theory, going to the store three times may give you a chance to meet more people and see more of the store from a different perspective. In practice, it isn't going to happen for several reasons:

  • you'd feel awkward visiting the store three times (but why? who is going to hurt you if you go three times?)
  • you'd feel it was a waste of time to go three times instead of once (but why? there are 24 hours in a day and you may discover something new at the store if you make extra trips)
  • you feel don't have the energy to go to the store three times (humans have much more energy than what we think, but what we feel plays a big role in our life)

If you had to drink a glass of juice or milk with chopsticks (you couldn't gulp it down) you could eventually do it, but you would be annoyed of the time it took. It won't take that much more energy to drink juice or milk with chopsticks, since moving chopsticks into a glass isn't that hard. Why do people choose to sip or gulp down milk or juice? It will take a bit extra time to drink the milk or juice with chopsticks.. but it will allow you to digest the milk slower and lose weight. But people won't do it, because it is annoying. Even if it makes sense to drink milk and juice with chopsticks for weight reasons, people will not do it.

In programming languages, it becomes a trade off. Many people deny that verbosity and shift key strain affect the programmer - but since we "feel" and have sense for "aesthetics", the reality is the verbosity and shift key strain does matter.

Try typing like this for 10 minutes:

   ThIs iS a TeSt tO sEE iF ShIfT KeY EvEnTuAlLy bEcOmes AnNoYING afTeR a WhILe.
 
Humans have a sense of "annoyance" in their brains. Even if in theory the above didn't take that much more energy to type than using no shift keys, what humans feel in practice is much different.

The human's natural instinct or natural hormones/brain cells guide us. One of our survival mechanisms is finding more efficient ways of doing things. If our brain sees that STRING + STRING looks just as readable as (or more readable than) STRING CONCATENATE--> STRING then our brain immediately sends good hormones out to our body. Our brain tells us that STRING + STRING is better. Is it better? Who says? Our hormones do.. not a theory, just what our brain tells us.

Now more on the shift key strain...

Although verbosity plays a role in what we feel while programming, another issue is the shift and alt keys, or other hard to reach areas on the keyboard. The shift key effort that we put into our keyboard has a very similar effect to the verbosity we have to put into our keyboard. The below code snippet may not appear to be verbose, but it takes a lot of shift key effort:

  #$tHiS!@is)(a{}tEsT!@*&tOsEE"howmuch":shiftKeY~TiCkS_YoU+OFf
One of the reasons that Pascal and C programmers always argue about verbosity, is because C programmers and Pascal programmers do not realize they are fighting the same battle. In the C language, one has to use a lot of shift key efforts. In the Pascal language, one has to use a lot of words. Worse yet, sometimes C is more verbose than Pascal even when C uses symbols. A simple FOR loop in C is more verbose than in Pascal - even though C uses symbols. However, a simple function in C is much less verbose since in C there is no requirement to type out the entire word FUNCTION. In other words there are trade offs.

People get into arguments about the verbosity of languages but they argue back with incorrect reasoning. Most Pascal programmers argue that the verbosity of the program is a small disadvantage (or it is an advantage), because verbosity "self documents" the code - which is total nonsense. Most C programmers argue that their language takes less effort to type and the words like "begin" and "end" get on the nerves and obfuscate the source code. The C programmers don't realize that shift keys used to type { and } curly braces also get on the nerves, and all the symbols required to type a simple FOR loop in C also gets on the nerves. The Pascal programmers don't realize that verbosity is not an indicator of cleaner code - for example Java has tons of verbose typecasting and it does not necessarily make code cleaner, nor does it self-document that code. It is true that some code is cleaner when it is more verbose though. It's just not always the case.

As you can see I'm not being biased here. I'm not for one "true way". I have however critically analyzed myself during programming, and I have found and know that the verbosity and shift key strain does matter a significant amount. If you had to use the F1 and F5 keys each time you had to type the letters R or A or S, your brain would eventually get so annoyed that you would design a custom keyboard for yourself where you did not have to reach up to the F1 and F5 keys. True over time you could get used to the F1 and F5 keys, but you could also get used to eating bread each day and nothing else. But would you get used to eating bread each day and nothing else, if there were other alternatives that felt better, especially if these alternatives didn't cost much more?

Is there a language like C or Pascal that doesn't require verbose words, and is there a language like C or Pascal that doesn't require lots of shift key strains? Perl has a lot of shift key strains but not many words - so it is just as annoying to type at times. PHP is very much like C in syntax, so it is just as annoying to type at times. Java has a lot of typecasting and verbosity, so it is just as annoying to type at times. Python has some verbosity and lots of C-like symbols, so it is just as annoying to type at times (and the bondage and discipline TAB takes a bit of effort but not much.. but maybe enough to tick a human off a tiny bit, and a tiny bit can be a lot depending who it is).

I know what you are thinking. You are back to thinking "it doesn't matter about the verbosity since it takes longer to think up the program than to type it on the keyboard". In theory, you may be correct. In practice, there are many other more complicated factors.

One of the reasons people use Classes and Objects is because it can actually hide some obfuscation that is required in structured or procedural programming, at times. Some people choose object orientation for reasons which they don't actually consciously know about. If you've ever programmed in C or Pascal and you passed in a structure and some callback functions into a procedure, you are actually doing similar to what object oriented programmers do with SELF. Instead of passing in the structure, object oriented programmers unconsciously know that there is a hidden SELF structure being passed in to the function or procedure. In fact some programmers don't even see it this way in their mind, hence why I said unconsciously. Some programmers just know SELF is there, and they know it is there magically - they don't see it as a hidden self parameter. One of the reasons people are attracted to object oriented programming, believe it or not, is the fact that it offers syntax shortcuts at times like this (where you don't need to pass in the structure, self is just automatically there and ready). Other times though, people choose not to use object orientation because it is too verbose - so they choose a simple procedure or a simple structure instead of a class. In the case of modern pascal or C++, many people choose to use the ansistring because it offers some syntax shortcuts over using a Class with an ADD procedure. You'll have a hard time finding people that admit to using programming practices due to syntax shortcuts.

Most people will deny the above, because they don't know what is going on in their mind and they aren't critical enough of themselves while they are programming. Most people think that they choose programming techniques because of theory and experience, when in fact a lot of the decisions made during programming are actually aesthetics. For example, what is more aesthetically pleasing - assembly code instructions, or paragraphs of C or Pascal code? If assembly code is more verbose than pascal or C code, shouldn't assembly actually be better since it describes what is going on more? See, the reality is the human brain is looking for shortcuts. Reusing code is a shortcut. People that choose perl choose it because they think it is a short cut. People that choose higher level languages choose them because they see them as a shortcut (as opposed to assembly code which is going to take long hours).

I am very critcal of my brain and I try to get inside my brain and study WHY it is that I prefer one way over another. Please keep an open mind - and the next time you get into an argument about verbosity, remember that there is also shift-key strain too.

After years of modern pascal programming I chopped down the language and created a language of my own which is fully compatible with C libraries and Pascal libraries.. and I called it Qompute. I haven't had time to promote the language since I'm prioritizing other things in life right now - in fact only about 20 people probably know about it at the time of writing. I found out that although I could get used to typing "begin" and "end", if there was a neat alternative that looked pretty much the same but was much shorter, why not go for it? The same reason why we feel walking up the stairs twice instead of once takes so much more effort - it really doesn't, but we feel it does.

prog hello;
b
  outln['Dear sir or madam, '];
  outln['This is your first Qompute program. '];
  outln['Instead of begin and end, or { and }'];  
  outln['we use b and e'];  
  outln['Instead of pointers to characters'];  
  outln['we use built in ansistrings'];  
  outln['Objects and classes are available but so are structures'];  
  outln['One paradigm isn't enforced, unlike C or Lisp'];  
  outln['Qompute can be terse but easy on the eyes'];  
  outln['C can be obfuscated with symbols and even verbose'];  
  outln['Pascal can be verbose and obfuscated with big words'];  
  outln['Qompute is a fine balance'];  
  outln['For systems, applications, and web programming'];  
e.
Although the square brackets are slightly less aesthetically pleasing than round brackets, they require less shift key strain - and they are still more aesthetically pleasing than say pointy brackets (html style enclosers). After typing out HTML for years and after typing out FOR loops in PHP, and after typing out 'begin' and 'end' in modern Pascal for years, I realized that shift key strain and verbosity of a language did matter - no matter how many people tried to deny it or come up with reasons why it didn't matter.

Normally one wouldn't create a programming language based on only syntax benefits - however, I found that C/Pascal/D were nice languages with some aesthetics missing. If I could have a language like C/Pascal/D that wasn't so dang ugly (either ugly through verbosity or ugly through symbols, or ugly through finger strains, or ugly through keyboard efforts) then I would satisfy my human cravings and my human nature. If I found the syntax of Qompute to be terse but readable, and if Qompute were basically as powerful as C/C++/D/ModernPascal, then why shouldn't I go for it?

Other folks are continually creating new compilers and language that offer something RADICALLY different (at the same time, completely backwards incompatible with all old technologies). I wanted to create a compiler that wasn't RADICALLY different. I wanted to create a compiler that was COMPATIBLE WITH C/PASCAL/D and backwards compatible with other compiler binary object files. I wanted to create a language that was more fun to type out on the keyboard with as much power and compatibility of c/pascal/d. Who would use a language that was designed for these reasons, when everyone seems to be switching over to RADICALLY NEW PARADIGMS that CHANGE THE WORLD.

About
This site is about programming and other things.
_ _ _