Hacker News new | past | comments | ask | show | jobs | submit login
Why are embedded systems software developers getting a D- in C? (embedded.com)
19 points by sruffell on Jan 15, 2010 | hide | past | favorite | 16 comments



That quiz ranged from silly curiosities to actual common mistakes.

I really dislike questions like "Most portable", etc where you have to answer what you know they want you to rather than say "I don't know how good all compiler compliance is in this respect, I suspect most do it fine, but c-compilers vary widely in quality, would you really like me to go research the standard and find out how good compliance is with respect to this behavior?"

Portability is only a concern for a subset of embedded programmers, whereas most of the other questions are a concern for most people.

Ditto for the multithreading operation item (Although I suppose most embedded programmers have ISRs at least to deal with).

In general, the author of the article is completely misinterpreting the test results which answer:

How well are embedded programmers at passing a test which involves esoteric declarations, overly detailed knowledge about compiler compliance and general portability questions probably in excess of what you worry about in any embedded design position, and otherwise designed to be beyond the experience of most practitioners in the field?

The use of a grade school grading scheme for the test is juvenile at best. They are VASTLY underrating the embedded developer pool.

For single platform coders, especially working on largely modern code, 6/10 is a fine score.

People who write for single platforms have no reason to be good at the portability questions. People who write for single platforms have no reason to be good at the compiler compliance questions. People who do not work on old code without "don't be tricky" condemnations have no reason to have memorized esoteric declarations of C variables which aren't commonly used.

Anyone who wanted 80-100% scores for MOST embedded positions would be completely wasting their companies money on overly expensive engineers. Only companies which have a multi-threaded legacy codeset which is designed to be compiled on unknown systems, running on multiple processor machines actually needs all the knowledge the test tests for, and if the company has good code reviews, such as all the "oh no" cases the article writer put out there, only SOME of the staff needs to know all these things, the rest can learn them in code reviews.


You beat me to it. The one I got wrong: I said most ANSI C compilers supported volatile const, not all. I guess I get a B+. Another question: "which expression resets the least significant bit in the variable". "Reset"? That means "clear", right? I got it right, because only one of the expressions actually changed the value of the variable.

In the whole survey, I found one question that was actually relevant and specific to writing C in embedded environments: when do you declare a variable volatile. The answer was "All of the above".

So yeah, not a good quiz.

There is one thing Hacker News has to learn from this article: silly little quizzes like this have spectacular PR value relative to the amount of effort they take to generate.


Possible answer to the post title: Their quiz-taking webapp is terrible. You can't retake the quiz or review previous questions, and can only try each question once, and if you go back and choose a different radio button as an answer for a previous question, it answers the current question instead (basically throwing away your answer).

So maybe people just couldn't use their damn webapp.

Several of their questions:

Which of the following is the most portable way to declare a C preprocessor constant for the number of seconds in a (non-leap) calendar year?

    #define SECONDS_PER_YEAR 60 * 60 * 24 * 365
    #define SECONDS_PER_YEAR 60 * 60 * 24 * 365;
    #define SECONDS_PER_YEAR (60 * 60 * 24 * 365UL)
    #define SECONDS_PER_YEAR (60 * 60 * 24 * 365)
Which of the following is the most flexible way to declare a C preprocessor macro that takes two arguments and returns the smaller of their two values?

    #define MIN(A, B) ((A) < (B) ? (A) : (B))
    #define MIN(A, B) { if (A < B) A; else B; }
    #define MIN(A, B) ((A < B) ? A : B)
    #define MIN(A, B) A < B ? A : B;
Which of the following constructs can be used to create a portable infinite loop in C?

    while (1) { ... }
    for (;;) { ... }
    loop: ... goto loop;
    All of the above
And then they asked a question which says "what was the intended effect of [some terribly misleading line of C]" and I became fed up, because I have no idea what the intent was, even if I could figure out the actual behaviour.


I don't like any of those MIN macros, and that question irritated me. Until C overhauls its macro system, the only good MIN macro is the kind that's actually a function. A good compiler will inline that for you anyway, probably, and most compilers let you declare functions inline in C.


I think their test is best described "If you're not looking up the answers to half of these, you're a shitty, arrogant, and dangerous embedded programmer because you are going to make mistakes, and those mistakes are likely going to be subtle"


I didn't see a lot of questions here that needed "looking up".

Most embedded C devs know what "volatile" does, because if you get that wrong your program crashes.

Very few developers know how to craft hygenic cpp macros, but since the question didn't ask about hygiene, I wouldn't expect anyone to feel like they should "look it up". You kind of either know it or you don't.

If anything, the problem with this quiz is that it was far too superficial.


1. C Compiler Compliance question

2. Behavior of UL on a non-32 bit system according to modern standards and the compliance of compilers to that standard

and

3. That the declaration of a pointer to a constant int array was actually that. This is a prime case for using C-Decl or whatever the name of the program is that is mentioned in K&R, (or at least some googling).

All three of these should be looked up. If you have experience with a particular system that uses the last item a lot, then you possibly should not be looking that up. The other two items most assuredly should be looked up. Very very few people have the experience of writing code that works on all sorts of systems using processors of differing word size while compiling on modern compilers. Only those few souls shouldn't be looking up the answers to #1 and #2


The compiler compliance question would be good to look up if it was easy to look up. It is in fact just a bad question (I got it wrong, saying "most" where they expected "all").

Embedded developers don't usually need to look up word size issues; it's hard to do your day to day job if you don't know what an "int" is. Nevertheless, that issue actually has very little to do with the question, which you answer simply by choosing the constant that is most specific about its storage requirements.

If you don't know how const works, you probably don't use const much; keeping code const-correct (a waste of time, for what it's worth) drills this stuff into you pretty quickly. Again, it's not a great embedded dev question, but it assessess what it means to assess: whether you know how const works.


^ Not being bitter, have worked with embedded engineers who don't believe they're wrong about stupid points which if they'd looked up would have seen that they're 100 miles off course.


Hmm. I got 9/10, and the one I got wrong wasn't the one I expected to get wrong. It was also one that in some sense "doesn't matter," but I'm still slightly embarrassed.

An interesting quiz, certainly. The problem is that the article contains no suggestions for the question asked: why?


May I suggest an answer. I started in computer engineering and have done embedded systems programming, in assembler though. Later I switched to software engineering and got a CS degree. In my experience there is generally very little proper CS in actual computer engineering education. Computer engineering is well founded theoretically and well taught generally; except when it comes to programming.

(Well, thinking about it, where do you find proper programming education?!)

(By the way I've never programmed in C - got 7/10 ?!)


Isn't this just a public online quiz that could be taken by anyone? Who is to say that the majority of people that took it are embedded systems software developers and not highschoolers?


There are only 10 questions, you can't review your questions before final submission of the test, some of the questions are pretty silly, and some of the terminology is questionable.

I think these kinds of "standardized" tests only make sense when the results are normalized against the population of test takers. That most embedded software developers received a D- only tells us that a combination of the performance of the test and the performance of the test taker was poor.


If C is proving too hard, perhaps they should use Lisp for embedded systems ala http://news.ycombinator.com/item?id=1052858


I chose #define SECONDS_PER_YEAR (60 * 60 * 24 * 365) instead of #define SECONDS_PER_YEAR (60 * 60 * 24 * 365UL)

I realised that 365UL would make 16-bit machines happy. I haven't worked on such one from a long time.

I also make a mistake on int (*a)[10], and I had no idea about "volatile const".


I've got 7/10 - I'm a poor "C" programmer.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: