Computer Science Teacher

I saw a side by side comparison of a bunch of scripting languages online recently. Scripting Languages: PHP, Perl, Python, Ruby My first, and second reaction was yuck! Now I have my biases – biases which may  not be shared by others of course. But I like readable code and for me anytime I see a special character (anything not an alphanumeric) it slows me down. This got me thinking about where we are going in design of programming languages? Are we moving forward (what ever that means) or backwards or just sideways?

Back when I started programming close to 40 years ago the big three programming languages were FORTRAN and COBOL with an up an coming language called BASIC. FORTRAN (short for FORmula TRANSlation) was used by mathematicians (my math major brother had to learn it) and scientists. COBOL (the B stands for Business) was used for business applications. BASIC was a teaching/Learning language that was spreading into business. COBOL was both loved and hated by different people for its wordiness. But it was at least understandable. Take the loop below:

```PERFORM VARYING WS-BOTTLE-NUM FROM 98 BY -1
UNTIL WS-BOTTLE-NUM < 2```
`END-PERFORM`

Pretty close to an English sentence. Compare that to this sample for a C-style language (C#)

`for (WSBOTTLENUM = 98; WSBOTTLENUM >= 2; WSBOTTLENUM--)`
`{`
`}`

Which one is more obvious? Pretend you are not an experienced programmer.

BASIC (Visual Basic in this case) is somewhere in the middle.

`For WSBOTTLENUM = 98 To 1 Step -1`
` `
`Next`

The step – the counting down – is more easily understandable for me at least. Now let’s take a look at something very simple. k = i / 10;

This drives beginners crazy. What’s going on here? Sure we programmers know but a lot of beginners struggle with which direction the operation is going. Compare that to the same code in COBOL

`divide i by 10 giving k`

Wordy? Sure, but at least even a beginner can read it. Now I am not arguing that we should all go back to COBOL though honestly with modern IDEs and features like Intellisence it would be a lot easier than it was back when I was typing out punch cards. Rather I am suggesting that beginner languages can and probably should be more wordy rather than more obscure – that English is easier to pick up than “what does # in this programming language mean?”

Just for fun, if you want to see what different programming languages really look like visit the 99 Bottles of Beer site.

This Website holds a collection of the Song 99 Bottles of Beer programmed in different programming languages. Actually the song is represented in 1434 different programming languages and variations.

Somewhat related posts:

• Most languages look like gibberish in comparison to Powershell.

ForEach (\$Computer in (Get-Content \$TextFile))

{

Get-Process -ComputerName \$Computer

Start-Sleep -Seconds 1

}

That's about as close to English as you can get in a scripting language.

• For the ultimate(?) in un-readable code, google for obfuscation, and read The Twelve Days of Christmas, written in C.

• For a language designed by user-hating martians (OASIS to be precise), check out XACML sometimes.

Yes its a language. An XML-based functional language for access control.

Sets a scale all its own.

• Rich -- PowerShell syntax is horrible. Just because a language reads like English doesn't mean it's readable.

So was the PS team's response to my comment about their syntax: blogs.msdn.com/.../issues-with-windows-powershell-syntax.aspx

• Rich -- PowerShell syntax is horrible. Just because a language reads like English doesn't mean it's readable.

PS team's response to my comment about their syntax was terrible too: blogs.msdn.com/.../issues-with-windows-powershell-syntax.aspx

• Visual Basic has the prettiest syntax imo.

Tell application Finder

sleep

End tell

• for (WSBOTTLENUM = 98; WSBOTTLENUM < 2; WSBOTTLENUM--)

should be

for (WSBOTTLENUM = 98; WSBOTTLENUM >= 2; WSBOTTLENUM--)

and if

For WSBOTTLENUM = 98 To 1 Step -1

is correct then it should be

for (WSBOTTLENUM = 98; WSBOTTLENUM >= 1; WSBOTTLENUM--)

• Cobra has a clean syntax for both small bits of code and the larger constructs like classes and methods.

http://cobra-language.com/

• I guess that based on the mistakes done in the for-loop for both COBOL and C (running loop infinite) , BASIC should be the most obvious and easier for beginners.

• (k = i / 10;) VS (divide i by 10 giving k)

Can you see the difference in number of characters used to represent the same statement? It's obvious that (/, *, -, +) are used extensively in code. So, would you like to use

* or multiply by

- or subtract from

Just one character compared to 2 words (saves a great deal of time)

• (k = i / 10;) VS (divide i by 10 giving k)

Can you see the difference in number of characters used to represent the same statement? It's obvious that (/, *, -, +) are used extensively in code. So, would you like to use

* or multiply by

- or subtract from

Just one character compared to 2 words (saves a great deal of time)

• I still use COBOL every now and then ( and get paid dam well for it too ), I might add when I first started we hand coded it on gragh paper and a operator entered it via a terminal - ha those were the days. (You might laugh but it paid for 3 houses), now I use php and VS2010 c# it is like a second language also, but COBOL and ADA will remain high on my like list.

• The COBOL examples are not only wordy, but to my eyes borderline incomprehensible! It's English words, but bizarre phrasing.

Applescript, as the poster above mentioned, it much more like English, and quite easy to program in (at least going by my experience of the similar Hyperscript).

Beginners are important, but you can learn syntax quite quickly. Clarity and readability are very important to people who read a lot of code, and that doesn't necessarily equate to 'using lots of English words'.

• I only know one language and that Visual Basic(and only a little bit of that. I concur with Alfred the nearer a language is to that of the natural language of the user the easier and therefore the better, at least from my point of view

Page 1 of 3 (37 items) 123