User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 3:20 pm

I know this is a dangerous topic to broach, but we've had several topics discussing which programming language should be taught and have done fairly well keeping it civil. So I wanted to do an objective look at pros and cons of specific languages and maybe how to do the hello world in that given language.

Here's an example:

Python:

Pros:
Easier to pick up
Cross platform

Hello world:
print "Hello, World!"

Java:

Pros:
Modern programming language
Used in web development, cell phones, etc
Cross platform

Cons:
Large memory footprint
CPU Heavy

Hello World:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Dear forum: Play nice ;-)

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4155
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 3:28 pm

not hello, world but always a fun read

http://99-bottles-of-beer.net/abc.html

User avatar
Jongoleur
Posts: 1179
Joined: Thu Aug 11, 2011 12:47 pm
Location: O'erlooking the sea, and all those effin windfarms...

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 3:38 pm

We're in dangerous territory here, folk get terribly defensive over their chosen language....

Given we'll all be playing nicely, another pro/con factor to consider is the bureaucratic overhead of various languages. Ok, we'll all want a nice editor to type the code into (I'd not want to inflict an 80s micro BASIC interpreter/editor on anyone nowadays), but once the code is there will there be an endless compile/run cycle, or will the language bravely plunge in and start interpreting the code?
I'm just a bouncer, splatterers do it with more force.....

hippy
Posts: 6079
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 5:52 pm

Every generation seems to have its favoured language taught in education; Algol, Basic, Fortran, Cobol, Pascal, Coral, Modula, Ada, Java, C, C++, C# and then there's Assembler, APL, Caml, Comal, Delphi, Eiffell, Euphoria, Forth, Haskell, Lisp, Pilot, Prolog, Smalltalk, Snobol and many others I've forgotten which have their advocates. Lua, Python and Ruby seem to have pushed out Perl lately and I'll admit I enjoyed programming in Javascript, while others prefer Flash Action Script and PHP.

Some of those can be discarded as outdated or irrelevant these days but many are still valid and I'm not sure there should be a single language which is taught, but everyone has to start somewhere. That somewhere though should be based on what the student's capability is and what is being taught.

When it comes to what the R-Pi is delivered with we do have to decide what's on the SD Card, in any download image, but in general the R-Pi should be an enabler, allow anything, rather than be a means to steer people down our own preferred paths. It's really which languages to include by default rather than a single choice.

User avatar
Burngate
Posts: 6049
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 6:13 pm

Looked at 99-bottles-of-beer, hadn't realised just how many there were (languges, not bottles).
Yes, seems a good idea for a topic, and should give some of the more knowledgeable of you something to think about, as long as you don't all start dogfights as to whether something is a pro or a con.
But since we're getting Python to start with, and adding another seems to me to be a lot of work,we need a voting system.
From a quick trawl through the forum, C in its various guises, & Java seem to have the most adherents, with Forth sticking its head over the parapet (my fault).
Assembler would get my vote, but it's so basic it's hardly a language at all.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 6:17 pm

@hippy, for the moment I'm wanting to focus a little more broadly than a language for the r-pi device per se. Until we actually have the r-pi in hand, it's easy to get lost in theory and navel gazing, so I don't really want to focus on programming language theory as much as here's some cold hard facts about programming language X.

I'm also willing to accept that some people will list a pro that other people might consider a con ;) , so it's also not really about critiquing others pro and con's lists (unless it's just something flat out wrong like saying a language does automatic garbage collection when it doesn't) as much as just a general look at what we each thing about programming languages.

C (not C++ or C#) Programming language

Pros:
Widely used (lots of teaching material)
Taught by colleges (so learning it ahead of time can have long reaching benefits)
Programming syntax translates easily to C++ or C#

Cons:
Memory leaks can lead hard to find programming errors
Not Object Oriented
Older Language

Edit: (I forgot to include the hello world example)
Hello World:
#include<stdio.h>

main()
{
printf("Hello World");
}
Dear forum: Play nice ;-)

hippy
Posts: 6079
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 6:47 pm

There's a handy list of languages used in education here ...

http://en.wikipedia.org/wiki/E.....g_language

For the pros and cons of potential languages, I'll don a fireproof cloak and suggest modern and structured Basic.

Pros:
Easy to understand.
Many computing professionals started with it and came to no harm.
Easy to use string handling and dynamic arrays.
Good for 'quick and dirty' programming / RAD.
Can be interpreted or compiled.

Cons:
Rejected and hated by most advocates of other programming languages.
No standardised syntax.
Not object-oriented.
Often limited to monolithic programs rather than using linked modules / libraries.
Can be slow if interpreted.

PRINT "Hello, World"
END

I'm a great fan of Basic ( PowerBasic, VB, VB.Net, RealBasic ) and pointedly use it to write compilers, assemblers and similar tools simply to prove it's not the 'toy language' it's often dismissed as nor as sluggish as people imagine.

User avatar
ukscone
Forum Moderator
Forum Moderator
Posts: 4155
Joined: Fri Jul 29, 2011 2:51 pm
Contact: Website

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 7:00 pm

i'll be making sure that I can run binaries that OpenCOBOL creates so that I can get the one space invader space invaders I wrote for my COBOL course at college running on the raspi. (OpenCOBOL runs ok in the qemu emulation i have so it shouldn't be too hard)

Lakes
Posts: 267
Joined: Wed Aug 24, 2011 2:17 pm

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 7:18 pm

Page full of "Hello World"
http://helloworldsite.he.funpi......htm#index

User avatar
Jongoleur
Posts: 1179
Joined: Thu Aug 11, 2011 12:47 pm
Location: O'erlooking the sea, and all those effin windfarms...

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 7:53 pm

At Uni, Cobol and Pascal were the pedagogical languages. I also got exposed to x86 assembler and Occam, which was seen as important as the Transputer was the British answer to the US hegemony. *sigh* It was also the time of the so-called 4GL languages, mainly aimed at manipulating databases, so Powerhouse and Pro IV were chucked into the mix.

All trendy stuff and only the loquacious dinosaur COBOL has any commercial relevance nowadays. Although I've never used it since, the idea of COBOL on the Raspberry Pi has a certain morbid fascination (IE DP!).

I'm wondering how many of the current crop will fade away in like manner?
I'm just a bouncer, splatterers do it with more force.....

asb
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
Contact: Website

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 8:05 pm

Quote from Lakes on October 14, 2011, 20:18
Page full of "Hello World"
http://helloworldsite.he.funpi......htm#index

Not quite as many languages, but Rosetta Code is rather fantastic:

http://rosettacode.org/wiki/Ca.....ming_Tasks

hippy
Posts: 6079
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 8:20 pm

Quote from Jongoleur on October 14, 2011, 20:53
Although I've never used it since, the idea of COBOL on the Raspberry Pi has a certain morbid fascination (IE DP!).


Anyone who has never used it has missed out on the COBOL pleasure of ...

PERFORM SEX UNTIL EXHAUSTED

:-)

euxneks
Posts: 26
Joined: Mon Sep 19, 2011 5:55 pm

Re: Pros and Cons of programming language X

Fri Oct 14, 2011 8:53 pm

PHP

Pros: Used very widely in web development projects, scripted and works with every web server out there, excellent documentation, has plugins for pretty much everything you need, instant gratification when debugging or creating something new.

Cons: It's a scripted language, cannot be compiled, not entirely efficient, there are inconsistencies in the language that can be frustrating even for a long time user - not consistent with symbols, not powerful enough for video games.

HelloWorld.php:

<?php
echo "Hello World!";
?>

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Pros and Cons of programming language X

Sat Oct 15, 2011 5:49 am

I rather like Inform.

MarkSmith
Posts: 29
Joined: Sat Sep 17, 2011 3:58 pm

Re: Pros and Cons of programming language X

Sat Oct 15, 2011 8:29 am

Smalltalk
Although I am not a Smalltalk programmer, it was a language learned to forced my (old school) mindset from linear procedures to object orientated. This issue can be often seen in C++ and PHP open source programs on the net that do not really utilise the OOP strengths.

Pros: Message-Oriented Programming at its heart and relatively easy to learn. It can be thought of as a pure reflective system, whereby the Smalltalk system itself, is built using Smalltalk. If I were to model a large complex system it would be in Smalltalk.

Cons: It forces you to think and use OOP and it doesn’t care that you have always do it this way. There a few variations and it’s not a mainstream programming language.

Hello World
Transcript show: 'Hello, world!'.

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Pros and Cons of programming language X

Sat Oct 15, 2011 9:09 am

Smalltalk is beautiful. Everyone should have a play with it.

Eiffel is worth a look, and for elucidation of the different ways of doing OO, one might do well to look into Self, Dylan, the CLOS extensions to Common Lisp, and the aforementioned Inform (although to truly understand it, one needs to delve "under the hood" of Inform7 and peer into the guts of Inform6).

Ruby is a less "pure" OO language, but particularly useful (not to mention trendy), and has, as a side benefit, Why's (poignant) guide to Ruby.

Personally, though, I'm more into Scheme and Lisp.

I haven't bothered to post "Hello World" examples, you can find all of them (and more) here.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Pros and Cons of programming language X

Sat Oct 15, 2011 2:12 pm

@tuffy can you list some pro's and con's on those languages? It's good to list some good ones, but ultimately saying something is good boils down to personal opinion. But a pro/con list let's people objectively consider the language for themselves.

Also feel free to add pro/cons to lists already made!
Dear forum: Play nice ;-)

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Pros and Cons of programming language X

Sat Oct 15, 2011 3:58 pm

Sure thing. I would argue that objectively considering a language involves delving in and having a shot, to be honest, but hey.

Smalltalk has been covered by MarkSmith and about the only other "con" I can think of is the relative slowness of the extra indirection caused by message passing rather than direct function calling.

Eiffel is possibly *the* reference in Design by Contract, (which, unsurprisingly, is something Bertrand Meyer cares deeply about). Other pros of Eiffel are the way it handles optimisation (i.e. automatically, with no programmer intervention needed or allowed). On the downside, it's overly verbose, and, of course, not very well known.

Self is interesting in that it's a prototype-based OO language (rather than class systems, one clones objects and behaviours). The standard implementation of Self comes with the "Morphic" user interface, which is somewhat reminiscent of Squeak Smalltalk's UI, but which can accomodate multiple users (sharing of windows between workstations, collaborative editing, and all that jazz). Downside - well, it's uncommon, and you probably won't be able to convince your boss to move over to it.

Dylan is a functional programming language derived from Lisp (and CLOS), and thus has many of the same benefits and downsides. It uses a more "standard" syntax than Lisp or Scheme, which is less intimidating to beginners coming from a C/Java/etc background. The limited number of implementations mean you don't have a great deal of choice with regards to compilers.

CLOS is not a language as such, rather an extension to Common Lisp that provides object orientation (Common Lisp Object System, natch). It's a class-based OO system, so won't scare C++/Java users *too* much (although the fact that methods don't belong to classes might boggle a few minds). It uses multiple dispatch, which makes many relatively common tasks trivially easy to carry out compared to single dispatch languages like C++ or Java, where a significant amount of framework code is required to emulate DD). Downsides - well, it's in Lisp, innit :)

All of the above (or equivalents) should be pretty much "required reading" for anyone interested in OO, and who thinks, coming from a C++ or Java background, that they know what OO is all about. Apart from Smalltalk and CLOS, I wouldn't necessarily recommend them for regular software development, they are mostly too esoteric and / or too slow. Travel opens the mind, though.

Inform (in all its incarnations) is a massively interesting product, a truly literate programming language designed for producing interactive fiction (or "adventure games" as we used to call 'em). Under the hood there's a full-on prototype based OO language, but Inform 7 adds true "english language" programming built into a very usable IDE. What do I mean by "english language" programming? Here's the start of one of the example programs from the inform website. Yes, this is source code, believe it or not :
"Glass" by Emily Short.
The story genre is "Fairy Tale". The story headline is "A fractured fairy tale". The story description is "The Prince sits awkwardly on the couch, holding his glass slipper and trying to keep it from crushing. Lucinda and Theodora have the ends of the same couch, and they are taking turns seeing who can bend lowest and show off the most cleavage; while the old lady, in her wing chair, carries on about nonsense...

Glass is a conversation-oriented fairy tale, taking place in one room. It was written to demonstrate one approach to handling conversation in Inform 7.

Features a variety of additional verbs, non-player characters with an agenda, and narrative with multiple endings." The story creation year is 2006.

Release along with a solution, source text, a website, an interpreter, cover art, a file of "Walkthrough" called "solution.txt", a file of "Making of..." called "Overview.html".

Use no scoring, the serial comma, and American dialect.
The downside, of course, is that inform is tailored to one specific task, and it's not a great deal of use for anything else. But hell, it's an eye-opener.

Ruby. Ah, Ruby. It's massively trendy, and if you know Ruby (and the obligatory Rails framework), you're gonna be able to get paid a lot of money. But it's more than just a trend, it's a full-on hardcore scripting language. I use it for a lot of things (I've written assemblers and signal analysis software using it, for example). What are its upsides? Well, for starters, it's mainly OO (there are a few non-objectified things, but mostly it's a pretty classic class-based, message passing OO system. You can extend or redefine classes on the fly, even the lowest level ones, which means an end to adding levels of pointless class hierarchy because someone forgot to define method X in some base class. It's also got a certain amount of "functional programming" roots (functions are first class objects and can be passed around, for example) and the popularity of Ruby is possibly part of the reason that ObjC got blocks (and C++0x is getting them). "Blocks", of course, being about as close to first class closures that you can get. There's an enormous amount of useful code out there for Ruby, and bolting together other people's code to make something useful is fast and doesn't involve much hair-tearing compared to combining class libraries in C++. It's also terse. I write probably 1/10 of the number of lines of code to do something in Ruby than I would to do something equivalent in C++ or Java. That's a huge win in terms of productivity. On the downside, it's slow. Really ******* slow. The 1.8 MRI runtime was totally braindead slow, 1.9 is better but it's still like molasses compared to pretty much anything else. There are better implementations out there, but they are still slow.

Common Lisp. Apart from the aforementioned CLOS, it has a few real benefits, most of which are to do with the sheer amount of stuff it can do "out of the box". Most people only see the downsides, though, which are usually given as "eeeagh, bracket hell". It's odd really, it's only syntax, and in most cases Lisp and Scheme use less brackets than Java or C++. Sure, those languages are more varied with their brackets, they use [

Nobody
Posts: 16
Joined: Tue Nov 01, 2011 8:07 pm

Re: Pros and Cons of programming language X

Tue Nov 01, 2011 9:01 pm

For beginners I would say Basic is okay, but once they really want to do something they should switch to a proper language.

For that I recommend Pascal, specifically "Free Pascal"
Pros:

easy to read and understand
structure/syntax is similar to C(++), Java... , but stricter rules (good for teaching)
if you stick to the basics, memory leaks or unwanted mistakes (e.g. "=" instead of "==") are unlikely (unlike e.g. in C)
not case sensitive
has become very powerful (objects, classes, overloading, etc.)
open source
cross-compiling from and to to almost every platform
fast. Both the compile process and the resulting program.
comments inside comments are possible
many other things :)
Cons:

the text mode IDE (Turbo Pascal style) might look antique to youngsters
if you use the windowed IDE (Lazarus), programs tend to get quite big with the default settings.

The "Hello World" example:
Program Hello_World;

Begin
WriteLn('Hello, World!');
End.

subminiature
Posts: 43
Joined: Wed Nov 02, 2011 6:27 pm
Contact: Website

Re: Pros and Cons of programming language X

Thu Nov 03, 2011 4:13 am

In looking at a program that is easy to learn, quick to get up and running, fast to debug, cross platform, easy to integrate audio, video and graphics then V-Delta (http://www.vdelta.com/) is worth considering with its roots in TenCORE and CBT and education.

Cons: $38 and $18 annually.

I have worked with TenCORE and if the release V-Delta is anything like it impressive results can be produced by most secondary children fairly quickly but is still advanced enough for more advanced programing techniques.

I like the VBA environment where I can help non-programers over the phone something which is much harder to do with Pascal and possibly impossible with languages like C where you can't even speak the language but have to spell it out.

C++ will have to there for developers, along with Java and PHP but I am not sure how these fit in with encouraging teenagers to get the programming bug.

spock
Posts: 208
Joined: Sun Oct 02, 2011 10:33 am

Re: Pros and Cons of programming language X

Sun Nov 06, 2011 12:01 am

i don't understand how basic still can be considered for teaching children (except for nostalgic reasons) if there are languages like python. :)

python pros:
- easy to learn but at the same time very powerful
- clean syntax that is easy to remember
- wrist friendly (compared to other languages python code often is shorter)
- interactive (no compilation necessary)
- the huge and very useful standard library
- many 3rd party extensions for multimedia programming (pygame, pyopengl,...)

python cons:
- it is interpreted and thus quite slow

(but there are projects like cython that make it very easy to turn bottlenecks into c extensions and there is pypy with the jit compiler but i am not sure if it works on arm already.)

riftmaster
Posts: 1
Joined: Thu Nov 10, 2011 7:25 pm

Re: Pros and Cons of programming language X

Thu Nov 10, 2011 7:31 pm

I second the use of Pascal, It was the thing that I, along with most of the programmers I know, learnt to program with;

The reason I say this is because it requires you to remember things like semi-colons and uses all of the fundamental programming constructs that underpin all programming skills.

and lets not forget it was created for educational purposes: http://en.wikipedia.org/wiki/P....._language)

- riftmaster

AlanCox
Posts: 31
Joined: Thu Nov 10, 2011 7:11 pm

Re: Pros and Cons of programming language X

Thu Nov 10, 2011 8:14 pm

Pascal died years ago and its out of date on concepts around exceptions, garbage collection, object orientation, structure and a lot more little details of the modern world. It also fails the critical "can do something useful" test. Teach a kid Java or javascript and he or she (sadly 90% he) will be gleefully producing applets that do stuff, bouncing web pages and other internet horrors. Teach them Pascal and they has no way to explore.

Python is not my favourite language but it has another important advantage in an I/O constrained device which is that it can pack a lot into a very small amount of storage. Some of its UI properties (stealing Tk) also work well in small development environments as does its traceback facility, interactivity and tendancy to keep going.

vladhed
Posts: 35
Joined: Fri Aug 05, 2011 3:04 pm

Re: Pros and Cons of programming language X

Fri Nov 11, 2011 7:58 pm

I'm surprised no one has mentioned perl yet.

PROs:
Can be either structured procedural or object-oriented http://en.wikipedia.org/wiki/Perl_module
Syntax can be strict or quick and sloppy
Powerful text parsing and processing capabilities.
Tonnes of available modules for doing all sorts of things
widely used in industry - especially as "glue"
widely supported on the web - lots of tutorials
can use it to interface Db to web (cgi-bin)

CONs:
is possible to write very cryptic code
extensive use of regex can put some people off

Hello world:

print "Hello World!\n"

spock
Posts: 208
Joined: Sun Oct 02, 2011 10:33 am

Re: Pros and Cons of programming language X

Sat Nov 12, 2011 6:02 pm

google go:

- combines some of the advantages of static and dynamic languages
- simple and clean syntax
- automatic memory managment
- easy concurrency mechanisms
- extremely fast compile times
- compiles to native code (supports arm)
- performance comparable to java/c# but probably will get a bit closer to c++ in the future

cons:
- pretty new (1.0 will be released at the beginning of 2012) and not very widespread yet

hello world:

package main
import "fmt"
func main() {
fmt.Println("hello world!")
}

Return to “Off topic discussion”