Judging programming languages by the results

There is much to be said about programming languages. If I mention any language, someone will always have something bad to say. The syntax might be ugly, a feature may be missing or the executables might run too slow. Even if you benchmark languages, you can adjust what’s important to you to make almost any language win the benchmark. The really troubling thing is that even if you found your perfect language, that was theoretically brilliant, you still might not be able to become productive with it. Even if it had all the features and the nicest syntax in the world, it still might not be efficient for developing a real-world program.
About six years ago, I started programming with Python. It’s wonderful in so many ways. And if you create a real executable that is optimized to native code with Psyco, you can’t just dismiss it just for being a scripting language either, like some people do, since it won’t matter for all practical situations. However, any Python-program above a certain size get to feel the downside of the dynamic nature of the language. Parts of a Python-program can be totally wrong, but go unnoticed if it’s in a rarely used part of the program. In small programs, this isn’t a problem, since most of the code is tested every time it’s run. But for larger projects, the code hidden in exotic branches quickly can get out of hand. To compensate for this, all companies I know of uses testing-frameworks to test as much of the program as possible with small specially made tests. I’ve worked for a company like this, where the flagship-program was written in Python and we used as much time writing tests as writing the actual program. This doesn’t make Python bad, I still love it, I’m just saying that for programs over a certain size, a lot of testing is required. This problem is also in place for Ruby and all other dynamic languages.
So, after my encounter with Python (and several other languages), I tried searching for a solid language. A language that would give me the feeling of robustness and completeness - a language that would compile executables I could really trust. I learned Scheme at the university, Haskell in my spare time, went through an Erlang tutorial and took a second look at Lisp. Scheme and Lisp are just so much writing. Erlang looks great, but Haskell is the language that really convinced me. Haskell has a strong background from academia, which really shows if you visit #haskell at irc.freenode.net - it’s filled with phd’s and whatnot. So, off I went to learn Haskell. I read tutorials, bought a book, asked questions at IRC and wrote small programs. And indeed - Haskell feels incredibly solid. When you’ve written a program, then you really know that you can trust it. It may take a few attempts to make it compile in the first place, but the result is pure rocket science.
Python and Haskell are opposites, in many ways. Python is a dynamic and object oriented scripting language, while Haskell is static, functional and easy to compile to native executables. Python is like a young dolphin while Haskell is like a big white rhino.
Then I discovered Pixel, a program like Photoshop, written by a single Slovakian guy named Pavel Kanzelsberger, which rivals Paintshop and The Gimp. And unlike Photoshop, it runs on Linux and many exotic platforms like BeOS, QNX and SkyOS. I wonder if it runs on Haiku, please let me know if you find out! I downloaded the demo a few hours ago, and it looks great. The interface is smooth and responsive, and it’s at least as comfortable to work with as Photoshop, Krita, The Gimp, Paintshop and the like. Since it’s uncommon that a program runs on so many platforms - especially programs made by a single guy - I did some research and found out that it was made in Pascal. Pascal! The language of my childhood, right after I learned QBASIC.
While I was first surprised by this, another great program written in Pascal came to mind: Fast Tracker II. It’s a brilliant program for making music with samples, still to see its equal on Linux. Soundtracker is functional, but ugly and Cheesetracker is an Impulsetracker clone. Milkytracker looks great, though, but I wish it was open source. Why select the lukewarm “freeware” instead of trying to earn money like “Pixel” or going the full way with open source? I bet FT2 would be open source if it was written today.
Anyway, to get back on track. My point is that some of the applications I’ve seen written in Pascal are absolutely brilliant! Even though there are good programs written in other languages too, of course, there is something special about FT2 and Pixel that just seems to be harder to achieve with other languages. This might just be my very subjective feeling, but it is my heartfelt impression so far. Besides, the free pascal compiler is really good! It’s mature, compiles quickly, is more cross platform than the average program written in C (not many C-programs are as cross platform as Pixel). It’s object oriented, has templates and is a modern, up-to-date language, unlike the old dialects of Pascal. And Lazarus, an IDE that looks a bit like Delphi, is a lot more responsive then say Eclipse, while having many of the same features. The screenshots of Lazarus looks a bit dated since they compiled Lazarus with the old Gtk. Gtk2 with nice fonts is now possible. FPGUI looks promising too.
Judging by the actual results, in form of applications, Pascal might be the thing! For sure, I’ll give the Free Pascal Compiler a shot next time I’ll write a full fledged GUI-program. What would you choose for your next project?
25 Responses so far
Spug
January 11th, 2008
21:03
I’m going to learn Scheme this semester as well. I’m looking forward to expand my horizon. I just taught some math people who know Python (from INF1100) Java, because they’re going to have INF1010 this semester. Python does look interesting.
Neil Mitchell
January 12th, 2008
13:42
“Haskell is … easy to compile to native executables”
Not really! It took over 20 years of research to figure out how to compile a lazy functional language to efficient native executables, and people still aren’t finished.
J. Pablo Fernandez
January 12th, 2008
14:48
Unit testing is not a tool for poor dynamic languages. You should unit test programs no matter what language you use, even Haskell (well, you can quickcheck there, but I consider quickcheck a superset of unit test).
Miran
January 12th, 2008
15:15
Well, I think you’ve taken a rather small sample here and based your conclusions off it while completely ignoring other factors that might have something to do with the quality of the end application. I’m of the opinion that the language itself is not such a big factor in the quality of the final product. It’s a big factor in the time it requires to finish it, programmer productivity, etc. but in the end what matters most is the competence of the programmers and how well they model the problem at hand.
If you look at Pascal from the other way around, it’s really nothing special. You still have to write a lot of boilerplate code, do explicit memory management, it has no built in data structures except for the standard array, struct (called record in Pascal) and some simple object oriented concepts.
I’m sure that if Pavel chose a more modern language to do his app it would have been equally good but he would have done it much faster.
Will
January 12th, 2008
16:19
Knuth’s TeX is also written in Pascal.
Imperative languages represent the straight line from point A to point B. They reflect the true nature of the beast.
If you had to slay a dragon, would you try to convince another dragon to fight for you, or would you grab a damn weapon?
gwern
January 12th, 2008
17:23
Neil: I think he meant how easy it is for the *user* to compile it to a native executable.
You have to admit, it’s generally pretty easy, and I find it in more complex cases to be more straightforward than for languages like C.
David Waern
January 12th, 2008
17:56
I totally agree on FT2 being a wonderful program. The developers were really, really good hackers. I still use it.
Sam Livingston-Gray
January 12th, 2008
20:53
“This book is great! I know — if I want to replicate its success, I’ll just use the same font!” ;>
Name
January 12th, 2008
22:18
“Psyco”, not “Psycho”.
Argo
January 12th, 2008
22:20
This article provides no real evidence and blatantly over generalizes. If we judge programming languages by their output then we’d all use C and C++. Oh wait.
MrX_TLO
January 12th, 2008
22:27
The original MacOS and apps were written in Pascal. They had multitasking in 512K and everything was fast and responsive. System 7 was rewritten in C++ and was slower and buggier and required 8x as much RAM just for a basic system.
Niklaus Wirth, the designer of Pascal had a lifetime of compiler design experience and found it critical to design a clean language from scratch. He focused on catching and avoiding the most common bugs at compile time, because he knew that most people, as soon as their code compiles, consider it done.
C on the other hand was a stripped down version of B, which was a stripped down version of BCPL which was a stripped down version of CPL, which was the designed by committee frankenstein replacement for FORTRAN and COBOL. Most of the designers had no compiler design experience. Most were not even programmers!
Because of the terrible and conflicting legacy design issues, at each redesign it was cut back to be easier to impliment. In the end it lacked even basic checks and and compiles even obviously wrong code. That’s why you get so many dumb-dumb runtime errors with C/C++ like buffer overflows and stack corruption - problems that were solved in real languages decades ago.
One thing is true though, C was a great fit for the x86 because it suffers from many of the same bad legacy design choices.
mikeb
January 13th, 2008
4:19
He’s Slovakian, NOT Slovenian!
gwenhwyfaer
January 13th, 2008
4:34
MrX_TLO, I humbly beseech thee to obtain a clue. Pretty much every assertion you make is at least partly factually incorrect, which makes your conclusions worthless.
admin
January 13th, 2008
7:59
Hi guys, thanks for all the comments!
I’ll fix the typos!
I agree that you can’t make a great book by using a great font, but programming languages are more than fonts - they influence they way the programmer thinks.
I might be generalizing, but since this is a blog and not a research paper I’m happy to do so. By supplying my very subjective opinion I hope to give you something more interesting than dry facts.
Thanks for reading!
Victor
January 13th, 2008
10:08
I’d like to give PHP for standard apps a shot. I like PHP a lot and it seems interesting.
Bart
January 13th, 2008
17:14
A good FT2 replacement for Linux appears to be SkaleTracker, although I didn’t get it working..
Graeme Geldenhuys
January 13th, 2008
18:14
Something I would really like to make clear is that there is a BIG difference between Pascal (from the 80’s) and Object Pascal (as used with the Free Pascal Compiler and Borland Delphi).
Object Pascal is a much more modern language. Yes it’s derived from the original Pascal language, but now includes Objects and many other modern language constructs like Generics etc…
http://en.wikipedia.org/wiki/Delphi_(programming_language)
Lazarus, Pixel and the fpGUI Toolkit are all written in Object Pascal.
ailaG
January 14th, 2008
1:10
Ohhhh, try Ada.
What a terrible course that was. It’s VERY strict. Very OO too. It’s a great one when you’re not stuck shouting at your program that refuses to compile.
Scheme is very annoying. I’ve had a class on it a few years ago, the intro to CS class. They only taught us how to set variables around the end of the semester, and then told us not to use that. (We (wrote (everything (in (recursions))))).
bee
February 1st, 2008
12:32
@Miran:
> I’m sure that if Pavel chose a more modern language to do his app it would have been equally good but he would have done it much faster.
You know nothing about Pascal that you’re talking about.
Compare GIMP (written in C/C++??) with Pixel. Both in final quality, crossplatform, and code quality. GIMP is written by many people, Pixel is written by A SINGLE PERSON! Yet Pixel is better than GIMP, IMO.
(Object) Pascal that being used nowadays which is used by Pixel is much more modern than C/C++. Go try FreePascal and Lazarus (cross platform open source) or Delphi (win32 only). You’ll surprised to see what modern Pascal can do!
C/C++ people… get a life! See what is going on outside your “world”! Perhaps you don’t know that there’s something called iPhone today. In case you’re still thinking that phones need cables and has no display.
bee
February 1st, 2008
12:37
@admin:
> For sure, I’ll give the Free Pascal Compiler a shot next time I’ll write a full fledged GUI-program. What would you choose for your next project?
Go give it a shot. I’ve been doing web app and GUI app using Pascal for years. I found myself more productive than people that using other languages.
megaribi
February 9th, 2008
18:06
Pascal is European language, and therefore it is more popular in Europe than in America. Borland’s implementation (now CodeGear’s) of Pascal called Turbo Pascal, later Delphi, was and still is so good that I still find it better solution than C, Java, C++, C#, Visual BASIC etc.
Just mention several properties:
- Pascal code is more readable than any C derived code. Keywords “and” “then” “begin” look easier to read than “&&” “){” “{”,
- DOS version of TurboPascal generated incredibly short executables
- No need to create make or header files, copiler will solve all source code dependances
- Delphi is point and click development tool. It is quick way to enter the GUI development.
- Everything you need is in your executable. Forget OCX registrations, JAVA virtual machines dependancy, .NET versions
- There are about 300 included components in Delphi and about 4000 additional components available on Internet, not counting ActiveX controls.
- Components are for different kinds of software. It is possible in 10 minutes to write program that will browse through Oracle base and send notification E-mails to addresses found in database.
- Debugger and IDE editor are very easy to use and configurable.
- There are also FreePascal and Lazarus. Although they are lower quality than Delphi they allow Delphi programs to be ported to Linux and Solaris.
pailes
March 3rd, 2008
19:52
“I bet FT2 would be open source if it was written today.”
You don’t seem to know much about FT2
Regards
Thorolf A. Holmboe
March 3rd, 2008
21:21
Thanks a lot for a refreshing and interresting read! It is indeed a vital point that code size and complexity should determine the choice of programming language. I tried a lot of different stuff in the early days of computing, and find your assertions very plausible!
Interrestingly, the two last programming languages I learnt was Pascal and C respectively! And as a hacker at heart, C was very appealing in its maximum compactness and ablilty to swallow cryptic but ingenious operator combinations, but Pascal was appealing in its lightness and clarity. If I was to take on a bigger programming project, this blog notice might tip the balance in favour of Pascal!
Jilani KHALDI
March 25th, 2008
16:59
I think that Object Pascal (Free Pascal and Delphi) is one the very few true high level and complete languages. You can develop every kind of software you want without the need of any other language.
Maggie
October 28th, 2008
17:59
You write very well.
Leave a comment