Vala: Gotchas, Tips and Tricks

Ande Turner picture Ande Turner · Jan 30, 2010 · Viewed 7.6k times · Source

As a programmer who is new to Vala, what is your number one piece of advice to someone who is new to the language?

Answer

user274045 picture user274045 · Feb 16, 2010

It largely depends on what background you are coming from. If you're coming from C/C++/Java, the best bit of advice is to learn functional programming. Vala supports true closures, and so you should learn (deeply) how to use lambda expressions. The best resource for this is Structure and Interpretation of Computer Programs by Abelson and Sussman. It was the introductory textbook for CS at MIT for many years. It is available free on-line at http://mitpress.mit.edu/sicp/full-text/book/book.html, but the paper version is more readable. Video lectures are available at http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/. Problem sets are available free at http://icampustutor.csail.mit.edu/6.001-public/.

Aside from that, I'd generally just try to learn the C# programming style well. It is similar to Vala, but there are many books on that topic.

Catches:

  • Be aware Vala doesn't have garbage collection. It does reference counting.
  • Be aware that Vala is still being developed. It is a rather new language, and it has not reached 1.0. Code you write now may break in the future.
  • If choosing to learn Vala, be aware that it is slightly obsolete, as far as programming language concepts go. It does not do anything to help with multicore programming. It does not do anything to help with memory management (code performance is based largely on cache coherency -- good garbage collected languages can reorganize memory to help here). It is a wrapper around C, and comes with many of C's limitations (although it does add closures).

Also, one of the posters recommended tinycc. This is a reasonable choice for development, but you should use an optimized compiler like gcc (or if supported, Intel's compiler) for deployment.