First off, you should know that trying to understand code you didn't write is 5x harder than writing it yourself. You can learn C by reading production code, but it's going to take a lot longer than learning by doing.
Being degenerated by the Ruby's philosophy of TDD/BDD, I'm unable to understand how people write and test code like this. I'm not saying it's a bad code, I just don't understand how this can work.
It's a skill; you get better at it. Most C programmers don't understand how people use Ruby, but that doesn't mean they can't.
Is it even possible to do TDD on embedded devices or when developing drivers or things like custom bootloader, etc.?
Well, there are books on the subject:
If a bumblebee can do it, you can too!
Keep in mind that applying practices from other languages usually doesn't work. TDD is pretty universal though.
You can mix even perl (with eperl), but it's generally a bad practice.
You should think through the following:
- Is your data to be indexed by Google?
- Is this a webpage or an application?
If it's an application, which won't be indexed by Google, grab JavaScript, CoffeeScript, Dart or Flash, and write a standard MVC application, with your server providing the backend in form of JSON-based services. It's just way more easier to think this way and still deal with application-level complexity.
If this has to be indexed by google, and/or it's a webpage, then build a WebMVC webpage, with templates, in Spring (java), Ruby on Rails (ruby), Django (python), Symfony (php), Catalyst Framework (perl), whatever. It's easier to accommodate data changes usually with such.
Both of these solution scale considerably.
Remember, every application started small.
Best Answer
You can code CGI in any languages, and actually there are CGI applications coded in C or C++, in Lua, in Ocaml, in Perl or Ruby, even in Bash.
My feeling is that for an embedded system, C is the best choice (because the binary program would be small, and there is no need to add an interpreter).
But the language choice is up to you.
Of course, you should be aware of the limitations of CGI. the CGI program should run quickly, and you should make it store explicitly (in file or database) any persistent data to be shared from one HTTP request to the next.