As a programmer who is new to Vala, what is your number one piece of advice to someone who is new to the language?
Tip: You can speed up your build time significantly by using TinyCC instead of gcc for development. Vala uses CC env variable for selecting backend compiler, so "export CC=tcc" will do the trick.
My #1 piece of advice is to learn about GObjects. They are the backbone of Vala's power and flexibility, and learning how to wrap various libraries with GObject gives your Vala programs access to everything c can link against (which is a lot!).
Here are a few links that might be of interest:
* http://library.gnome.org/devel/gobject/stable/
* http://fosswire.com/post/2009/7/gobject-vala/
* http://developer.gnome.org/doc/tutorials/#gobject
* http://en.wikipedia.org/wiki/GObject
- For multiple resources, this will be a general resource for a bit: Vala - GNOME Live!.
- To get up close and personal with GObject: GObject Reference Manual.
- I don't know what background you're coming from, but you will find this helpful: Vala Quick Intro for C# Programmers
In any event, knowledge of C will be of great use. Our team is actually considering a progressive revamp and porting to Vala. We have members with strong backgrounds in C#/C++ and this change in direction (over time) will be beneficial to the performance and flexibility of our products.
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.
Caveat: I am not familiar with Vala, but hopefully my answer applies to learning any new language. I just want to offer some thoughts in case they help...I should definitely not get the bounty for my answer.
Bottom line: It depends on why you are learning it...
If you are intrigued because it is a cool new language, but you are not sure how you might use it in practice, try recreating/porting something with which you are deeply familiar to see how it compares.
If you are learning it because you believe it solves a specific problem you are facing, make sure it is worth the up-front investment, since learning any new language can be incredibly time consuming, and there may be a reasonable solution in a more familiar language.
Otherwise, it's all about how you learn best. Are you someone who needs to understand the internals of the language, or just get things done quickly? (Or, like me, somewhere in the middle?) For the getting things done approach, I just look for simple tutorials and try to get something basic up and running to see how it feels. If I am enjoying the language, then I'll start to read more in-depth information about the language and understand what's going on under the hood.
Whatever your approach, best of luck!