Posts

Showing posts with the label C

My journey to Rust

As most folks who know me already know, I've been in love with Rust language for a few years now and in the last year I've been actively coding in Rust. I wanted to document my journey to how I came to love this programming language, in hope that it will help people to see the value Rust brings to the world of software but if not, it would be nice to have my reason documented for my own sake. When I started my professional career as a programmer 16 years ago, I knew some C, C++, Java and a bit of x86 assembly but it didn't take long before I completely forgot most of what I knew of C++ and Java, and completely focused on C. There were a few difference reasons that contributed to that: Working with very limited embedded systems (I'm talking 8051 ) at that time, I quickly became obsessed with performance and C was my best bet if I didn't want to write all my code in assembly. Shortly before I graduated, I got involved in GStreamer project and beca

Ich bin ein Berliner

Well, no, not really but maybe I'll be able to claim that at some point because I'm moving to Berlin to join Kinvolk. I'm told that I'm changing countries and companies too often but that's not true. I was at Red Hat for 5 years and at Nokia before that for 5 years as well. The decision to move out of Finland was not exactly mine. Regarding Pelagicore I'm not as much leaving Pelagicore as I'm leaving the automotive industry, more specifically the software side of it. While the automotive industry is changing and mostly for the good, I realized that it still is not a place for me. Things typically move very slowly in this industry and I realized that I don't have the required patience for it. Also, C++/Qt are big here and while an year ago I thought it's just another language and Open Source UI framework, I no longer think so. Since you can find a lot of rants from very experienced C++ developers on why C++ is a horrible language, I won't rant

GNOME ❤ Rust Hackfest in Mexico

Image
While I'm known as a Vala fanboy in GNOME, I've tried to stress time and again that I see Vala as more a practical solution than an ideal one. "Safe programming" has always been something that intrigued me, having dealt with numerous crashes and other hard-to-debug runtime issues in the past. So when I first heard of Rust some years back, it got me super excited but it was not exactly stable  and there was no integration with GNOME libraries or D-Bus and hence it was not at all a viable option for developing desktop code. Lately (in past 2 years) things have significantly changed. Not only we have Rust 1.0 but we also have crates that provide integration with GNOME libraries and D-Bus . On top of that, some of us took steps to start converting some C code into Rust and many of us started seriously talking with Rust hackers to make Rust a first class programming language for GNOME. To make things really go foward, we decided to arrange a hackfest , which took place

Think before you create GObjects

I had always been hearing that GObjects are slow and it's not always a good idea to use/write them but I never saw any evidence to support that. I had this desire to write a test application to get this evidence but felt too lazy to do it in C. I realized a few days ago that I can write such an app very easily in Vala without giving up much on my laziness. :) So here is an app that I wrote last evening after returning from vacation. Here are the results on my laptop: $ ./test-perf 0.000182 seconds taken in creating 10000 structs. 0.001598 seconds taken in creating 10000 instances (compact). 0.003522 seconds taken in creating 10000 instances. 0.090455 seconds taken in creating 10000 instances (GObject). The ranking is exactly how I expected it to be but didn't expect such a big difference between them all.

Why Vala?

When I told some people that I will write (which involves re-writing existing code first) the gupnp-media-server in Vala, their question was "Why Vala? Why not Python, Java or C#?". So here are the strong points of Vala, not all of which are found in these languages: Statically-typed Back in the days, when I was hacking on Gazpacho I found the lack of types on variables and function/method parameters really annoying in Python. This can become quite a pain when you are reading other's code and that is exactly what I was doing most of the time. The fact that Johan and Kalle wrote very nice and readable code, helped a lot though. No runtime dependency/overhead This might seem like a small point to many developers but as an embedded-systems developer, this is a big plus for me and I am sure to many (if not most) of the embedded-systems developers out there. Easy integration with C/GObject A big plus for all the GObject/C developers out there. Besides, there are situations