scratch/content/html/en/blog/programming-language-experience.md

386 lines
14 KiB
Markdown
Raw Normal View History

2011-06-10 14:10:47 +00:00
-----
isHidden: false
menupriority: 1
kind: article
2011-09-06 06:59:30 +00:00
created_at: 2011-09-05T12:21:41+02:00
2011-09-27 15:11:40 +00:00
title: Programming Language Experience
2011-06-10 14:10:47 +00:00
author_name: Yann Esposito
author_uri: yannesposito.com
# tags:
-----
<%= blogimage("main.png","Title image") %>
begindiv(intro)
<%=tldr%> My feelings about programming languages I used.
enddiv
### BASIC
2011-07-05 12:39:59 +00:00
The language of my firsts programs!
I was about 10, with an `MO5` and `Amstrad CPC 6128` and even with my `Atari STe`.
This is the language of `GOTO`s.
Ô nostalgia.
2011-09-06 06:59:30 +00:00
Unfortunately this might be the only interesting part of this language.
2011-07-05 12:39:59 +00:00
Today this language is obsolescent.
It not even a good language to learn programming.
I know there exist some compiler now.
But this is not enough to try to learn it.
2011-06-10 14:10:47 +00:00
<code class="zsh">
READY
10 PRINT "HELLO WORLD!"
20 GOTO 10
RUN
</code>
2011-07-05 12:39:59 +00:00
I remember also to had copyied some game source code from some magazine.
Most lines were like:
2011-06-10 14:10:47 +00:00
<code class="zsh">
3110 DATA FA,01,FF,FF,FF,FF,00,23,22,43,DA,DE,EE,FF,FF,FF,00,03,4A,F2
</code>
2011-07-05 12:39:59 +00:00
What a pleasure!
2011-06-10 14:10:47 +00:00
### Logo
<%=leftblogimage("dragon.jpg","Dragon fractal")%>
2011-07-05 12:39:59 +00:00
Also when I was about 10.
I played with logo to draw on the computer.
I remember the Bach's music while the program loaded.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
Yes, at that time we had to load the program into the memory using tapes.
This one was a rare one that didn't made an awfull 'Krrrkrr cssssss krrr' noise.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
I used them without any loop.
Some years after, I had used it to learn programming to my college students.
In fact it was really good as first language.
Making fractals is like a game for children.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
Here is an example of code that results in the dragoon fractal.
2011-06-10 14:10:47 +00:00
<code class="zsh">
HIDETURTLE
PENUP
SETXY -200 0
RIGHT 90
PENDOWN
to dragon :degree :size
setpensize 1
2011-07-05 12:39:59 +00:00
if :size>5 [setpensize 2]
2011-06-10 14:10:47 +00:00
if :size>10 [setpensize 3]
if :size>20 [setpensize 4]
if :size>40 [setpensize 5]
ifelse :degree=0 [
fd :size
2011-07-05 12:39:59 +00:00
][
left 45 dragon (:degree-1) (size/4)
right 90 dragon (:degree-1) (size/2)
left 90 dragon (:degree-1) (size/4)
right 45
2011-06-10 14:10:47 +00:00
]
end
dragon 6 3000
</code>
2011-07-05 12:39:59 +00:00
### Pascal
The always second.
I made my firsts real serious program with Pascal.
I must confess I found it inferior to C.
I made graph algorithms, sort algorithms even some IA like genetic algorithms.
In the end I prefer C.
### C
The language of pointers.
_Le_ programming language.
Once you understand loops and recursivity.
It is time to make things serious.
If you want to have good quality code, knowing C is almost mandatory.
This language is close to machine language.
So much, there is (mostly) a linear relation between the size of your code and the size of the compiled one.
In short, each time you write a C instruction there won't be anything strange that will occurs, like starting a long algorithm behind the scene.
It is very close to the machine while keeping a sufficient abstraction to be fun.
I made a lot of program with it.
From sort algorithms to AI ones (SAT3), system, network prgramming, etc...
It is a very useful language that will help you understand how things works on your computer.
Most modern computer language hide a lot of informations.
This is not the case with C.
### ADA
The super-clean one.
I liked ADA. I must confess I didn't used it a lot.
May be one day I will try it again.
I was impressed by asynchronous programming with it.
What you need to know is this old language had certainly inspired most new object oriented languages.
## Object Oriented Languages
Until here I just described imperatives languages without any object notion.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
More clearly, the language didn't helped you to structure your program.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
In order to limit the number of bugs, particularly for huge programs, we started to thing about how to best organize computer programs.
In the end, from the imperatives language culture, it produced the Object Oriented programming (OOP).
Beware, the Object Oriented programming isn't a miracle. Proof? How many bug-free software do you use?
Furthermore, OOP doesn't fit all problems.
But to make a bank application, an application which help to manage stock, clients or text archives.
I mean an information system, the OOP is not so bad.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
Then Object Oriented Languages appeared everywhere.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
### C++
The ugly
2011-07-06 21:17:54 +00:00
Industry wanted an Object Oriented Language without loosing all their old C code.
Solution, keep C and add an Object layer on it.
The main concern about C++ is it do too many things.
I particularly appreciated multiple inheritage and templates.
In reality I liked a lot C++ while I was working alone.
I used it to write `DEES` my main thesis software.
My only concern was about a lack in the STL.
In the doc, one could use `String<T>`.
But in reality, T have to be only `char` or `char16`.
Then I had to reduce my alphabet to $2^16$ letters.
Except for some application, the alphabet must be far larger than that.
2011-07-05 12:39:59 +00:00
### Eiffel
2011-07-06 21:17:54 +00:00
Yes, it is a really nice language.
Full object in mind. Far cleaner than C++.
But it isn't so popular.
Behind C++ there is a large community to help new users and to write libraries.
Furthermore, I preferred working with C++.
2011-07-05 12:39:59 +00:00
### Java
2011-07-06 21:17:54 +00:00
The first time I heard about Java it was _le Grail_!
2011-07-05 12:39:59 +00:00
2011-07-06 21:17:54 +00:00
Perfect portability, your program will work on all platform.
There was incrusted inside the language architecture concepts to help limit mistakes, and force you to use good programming habits... But.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
But It is extremely verbose.
And limitations are quite boring if you know what you're doing.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
For example, there is no multiple inheritance.
Generally it is a coherent choice if it is compensated by something else.
In Java, there are interfaces.
Except, interfaces are a way to add only methods to classes.
In no way, you can add any attribute.
It was really a lack to make a graphic interface.
I made a GUI using Java Swing and I created my own notification system between different element of the GUI.
Then, at the begining I only needed to send notification 1 to 1.
After some times, I needed to make 1 to many notifications.
And I add to make a bunch of copy/paste inside all my subclasses!
Copy/paste are exactly what should be avoided the most by Object oriented languages.
2011-07-05 12:39:59 +00:00
2011-07-06 21:17:54 +00:00
Another thing, I had to handle threads.
Except I had to make my own thread gestion system to avoid locks and notifications between threads (this thread ended, ...).
At that time I used Java 1.5.
Normally this problem should have been solved with Java 1.6.
I wish it is the case, but lacking such an essential feature for a language was very bad.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
In the same idea, it was very long to wait for the foreach loops.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
After my experience, I don't recommend Java.
Portability does not worth this price.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
GUI protability mean, mediocre experience on all platforms.
Any system it might be (wxWidget, QT, etc...)
Then for applications that might be distributed it is a bad idea.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
The Java ideology is "closed". But it resolve a big problem.
It helps medium to low quality developper to work in team without the ability to make too much harm to the product.
A good programmer will be able to make very interresting with it thought.
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
### Objective-C
2011-07-06 21:17:54 +00:00
The language I learned and used only to make application on Apple(c) platform.
I learned Objective-C just after Python.
It was hard to do it.
At first I didn't liked the syntax and many other details.
But it is this kind of language you like more and more you use it.
In fact, Objective-C is a simple language, but associated with the Cocoa framework it is a really good tool.
Cocoa is very different to other framework I used before.
I find many of its idea extermely good.
Both simple and efficient.
It might seems like small details on paper, but once you start using it, it make all the difference.
2011-07-05 12:39:59 +00:00
2011-07-06 21:17:54 +00:00
Even if Objective-C is a relatively low level language.
Its dynamic typing ability make it very good for GUI programming.
I recommand to continue working with this language.
In the end you'll certainely find it better than expected.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
## Modern Scripting Languages
2011-06-10 14:10:47 +00:00
2011-07-05 12:39:59 +00:00
### PHP
2011-07-06 21:17:54 +00:00
This small script language that we used all to make our website in the time of animated gifs.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
Nice but no more. Apparently there were a lot of progress since PHP5. Maybe one day I'll use it again. But behind it, this language has a "script kiddies only" reputation.
A long history of security holes easy to make, low level community, etc...
2011-07-05 12:39:59 +00:00
2011-07-06 21:17:54 +00:00
In reality PHP is just behind C for the abstraction level.
Therefore it has a lot of organisation problems and make it easier to create bugs.
For web applications it is a real problem.
2011-07-05 12:39:59 +00:00
2011-07-06 21:17:54 +00:00
PHP remains for me the SQL injection language.
I make a bit of PHP not so long ago, and it was a pain to protect my application to SQL injection. Yep, I didn't found any standard library to make this, but I didn't searched a lot.
2011-07-05 12:39:59 +00:00
### Python
2011-07-06 21:17:54 +00:00
Revelation!
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
When you were used to work with compiled languages (C++, Java) and you start learning Python, it's like a punch in the face.
Programming like it always should have been.
Everything is natural, it's _magic_.
Yes, as good as this.
But something so good must have some drawback.
2011-07-05 12:39:59 +00:00
2011-07-06 21:17:54 +00:00
And yes, an all interpreted languages, Python is _slow_.
Beware, no just a bit slow like 2 or 3 times slower than C. (like Java for example).
No, really slow, about 10 to 20 times slower than C.
Argh... But it is completely usable for many things.
But some application are just forbidden to it.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
### Awk
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
If you have to "filter" some files and the filter is not too complicated awk is the ideal language to do this.
For example, if you want to know which words in a text file are most used.
I used it to modify hundred of XML files in an easier manner than XSLT.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
### Perl
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
Perl is magic, but the syntax is so hideous nobody can like to work in an environment with many different person in Perl.
Or at least, all other collaboratos must be excellent programmers.
But the very good feature is the integration of some perl syntax.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
<code class="perl">
$var =~ s/toto/titi/
</code>
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
This program will replace every toto by titi inside the `$var` variable.
The Perl code is often very compact and usally unreadable.
But it is a language good to know.
It is a kind of `awk` under steroids.
### Ruby
Ruby is a very good language. It is often compared (opposed ?) to Python.
There are the regular expression operators Perl inside the langage.
But the syntax is extremely clear, like in Python.
Many feature were inspired by functionnal programming (as in Python).
I used it a lot.
It is the worst language I know in term of efficiency.
This is the language that lose almost all benchmarks.
But it is the perfect tool for prototypes.
If you want to make a website prototype, RoR (Ruby on Rails) is certainly one of the best system known to mankind.
From idea to realisation, few time will occur. Make this site work for thousand of people, will, on the other hand, certainly require a lot of optimisations.
### Javascript
It is the good surprise.
During years, javascript was considered as an annoying web experience language.
In reality, javascript has many really good qualities.
Particularly, it is easy to pass a function in parameter and to create anonymous functions (closures).
Recently, javascript became far faster than before and many frameworks and libraries appears:
- Cappuccino, Objective-J (as in objective-C but with javascript)
- Sproutcore
- Spine.js
- Backbone.js
- jQuery
- prototype.js
Particularly with jQuery we can chain functions.
It is very nice to use.
As I said, this is a good surprise.
Javascript was chosen by chance as the script inside your navigator.
Instead of the java inspired syntax, everything else is very good.
In order to compensate the syntax, you can use CoffeScript.
## Functional Languages
### CamL
I learned CamL during the college. I founded this really interresting. Functional programming is very different to imperative one. I had good mathematic intuitions to use this language. But I must confess I never used it for something serious.
### Haskell
I am still learning this language.
I must say it is a pleasure.
Generally it tooks me only some hours to some days to learn a new programming language.
Each language has his new concepts to grab.
Concerning haskell, this is very different.
The concepts behind haskell are really deep.
I feel many weeks will be necessary to understand it correctly.
The community behind haskell is very friendly and nice. There is no "LOL! URAN00B! RTFM!"
And no concession on the language as been made to make it more popular. Therefore this langage remain pure (I know there is two meaning).
## Unpopular Languages
Some languages are designated to create documents.
### MetaPost
Metapost is a language to program drawings.
What make metapost very good?
It contains a linear solver.
This is really usefull to draw things.
For example if you write:
<code class="ruby">
x=(2*y+z)/2
</code>
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
It will place the point x at 2/3 of y and 1/3 to z.
This feature is very nice. Most programming language should think about adding it.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
### zsh
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
Yes, zsh is a shell.
But it is also a script language extremly well suited to file traitment.
For now, it is the best shell I used. I prefer zsh to bash.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
### Prolog
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
I never made somthing serious with Prolog, but I really loved to use and learn it.
This language try to resolve constraints as much as it can.
It is kind of magic.
We only write constraints, we never put order.
A bit like functionnal programming but far more powerful.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
## Languages to discover
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
It remains many language and framework to try.
Actually I believe I will stay a while with haskell.
Maybe tomorrow I will see LISP, Scala or Erlang.
I also certainly look at clojure to make web application.
2011-06-10 14:10:47 +00:00
2011-07-06 21:17:54 +00:00
Tell me if you have any other experience with these programming languages.
I had only given my impressions.
But I used them all.