languages

Tips for beginners

From a today's post on the squeak-beginners mailing list:
  1. Squeak image is like a 'software computer' - an entire computer, not just an IDE. The 'quit' doesn't shutdown, it only suspends this computer and the vm resumes it from where you left off next time you start it. Objects created in this image can live on for years! This soft computer even crashes like a real one. I always work with copies of images when experimenting with it.
  2. Commands take the form "<subject> <verb> .." instead of the usual "<verb> <subject>". Though, this sounds simple, it takes some time to switch mental models from imperative mode to message sends.
  3. Most tutorials exhort beginners to "doIt". Please don't. Use "debugIt", so you can see trace the execution and learn a lot from it. Tracing something even as simple as "3+4" can be very illuminating as it takes you through compiler, string conversions, primitive calls and so on. After a few hours browsing code, DNU pop-ups are no longer scary :-(. Morphs (like menus) can be traced by using the debug halo item.
  4. I find the "explain" menu item very handy while browsing code (e.g. Is SoundPlayer a class or a variable?). It is buried one level deep in content menu :-(. I also make liberal use of "implementors of" and "senders of" to understand the larger context.
  5. The "browse protocol" is another useful menu item listing all messages (including inherited ones) for an object. Here again, the most useful category, '--all--', comes in the end :-(.
Thanks Subbu

Ocaml

Mal wieder eine neue Programmiersprache. Ocaml ist aber was besonderes. Es ist eigentlich eine funktionale Sprache, hat aber auch imparative und objektorrientierte (daher das O) Bestandteile. Das erlaubt einem gewissermaßen das für die Lösung angepasste Paradigma zu wählen.

Spannend ist, dass es sowohl Interpreter, als auch Compiler für Bytecode und native code gibt. Geschwindigkeit soll in der Dimension von C/C++ liegen.

Unter anderem existieren Gtk+ und ODBC Bindings. Sogar ein Ocaml-Plugin für Apache ist verfügbar. Bekannteste Anwendung ist vermutlich mldonkey.

Ich schau erst seit gut einer Woche durch die Tutorials, aber sieht sehr vielversprechend aus.

Zeit müsste man haben…

...dann könnte man sich mal mit anderen Sprachen beschäftigen. Smalltalk zum Beispiel und für die kleinen Dinge des Lebens awk.

Kleines Beispiel: Wie rechne ich den Speicherverbrauch aller Programme von xfce zusammen?

ps axu | grep xf | awk '{total = total + $6 } END {print total}'

So einfach kanns gehen...

LISP

Just looked over the code of some planner we write for university. We decided to write in LISP because its called the AI language. LISP is a very old language. But with the newer standard Common LISP its fairly modern.

The great thing about it is that you can express your thoughts very quickly without have to look on details. The planner generates a plan (a list) out of a list of facts and a list of actions. LISP stands for LISt Processing, so its made for these things.

For further reading I recommend the LISP primer and Practical Common LISP.

Syndicate content