63 points · by yitchelle · 14y ago · 86 comments
Let me summarise the task: Continuous measurement of custom hardware in real time with some trivial user interface.
There are two parts to this:
1) real time device I/O <--- Really important.
2) user interface <--- Irrelevant, will probably be replaced multiple times over the life of the project.
This is how the OP needs to pitch it to the boss.
(1) is critical and C is flat out the best language for real time I/O, and it's the best choice for making an easy-to-use DLL that can be loaded and used by any number of other systems (C#, python, etc.)
(2) is hard to do nicely in C, but we can have a very trivial very rubbish ANSI C user interface if that's what you want. However, we can do a much better job by calling the library from (1) from another target (eg. c#).
We can also repeat the process in (2) to build an alternative 'user interface' that is in fact a test harness / test suite for (1), increasing reliability (something that C once again, sucks at (testing that is)).
"Here I made a prototype in a language you didn't ask for! It's the ROZZXXEOR!!!111" is just about certain to generate a negative reaction.
However i agree that making the hardware interface in c would be the best option. But in most cases your hardware would already come with this and using P/Invoke to call it from C# is then piece of cake.
It's hard to give a definite answer since the OP doesn't specify if the application also has hardware output or just recording. And what are the time constants? Are we talking seconds or microseconds?
That is simply not true. You can set a windows process to use real-time priorities.
While the author's boss might have too narrow of a field of view in technologies, the author shares his/her boss's strategy to use a hammer as his sole tool, regardless of whether he's driving nails or screws.
Hard? Like "registering a window class, writing a window message handler, creating a window and running a message loop" unbearably hard? That's not to say that there shouldn't be a split into an engine and a UI modules, potentially running in separate processes (and done in different languages if need be).
That said, the right answer is probably still to deliver it in C as requested, and walk away. The customer has spoken, and seems to broadly know what he is talking about (ie, it isn't a nontechnical customer who is asking how "cloudy" your solution is, it's a programmer), so... well... OK... if that's what you really want....
The client asked for C, they know the future, you do not. If, as the service provider, you recommend C# and detail all the advantages and the client still wants C you go with C. Simple as that.
Saying C# is beautiful and powerful is irrelevant. The task can be done in any number of languages but the client asked for C, go with C.
You talk to your manager and recommend something but the buck stops with him and you do what he says. He is essentially in charge.
If you can't accept this then leave, you have no respect for then, why would you want to work with them. If you need the money they get on with it.
Programmers need to be more professional. As a professional you give your professional opinion but that isn't gospel. You note your protest and then get on with the job you are paid to do to the best of your ability.
BTW I am a programmer. I've been junior, lead and manager so I've seen it from all sides.
C's benefit historically has been performance. I think the case for performance is becoming less compelling for 2 reasons:
1) The performance gap is closing, thanks in particular to projects like cython that let you write python code that gets converted over and compiled as c++ that's often more performant than the c++ code that devs might write themselves.
2) In general, the cost of hardware continues to drop while the cost of developers goes up. C takes longer to write than eg Python--I don't care who you are, it does. And if you're the god programmer of C, you probably cost a lot.
So what would be the benefit of c for your boss really? It will cost more to develop, and the performance gains may not be as noticeable. It would quite possibly be bad business.
Well it's obvious you haven't done any systems programming.
>In general, the cost of hardware continues to drop while the cost of developers goes up. C takes longer to write than eg Python--I don't care who you are, it does. And if you're the god programmer of C, you probably cost a lot.
That's not what experiments have borne out, time-to-develop generally has a lot more to do with proficiency in the language of choice and in the problem domain than the language itself. I will say, however, that it is generally slower to write things in C, but not so drastically that it merits abandonment.
>So what would be the benefit of c for your boss really?
A solution that would reliably fit within the real-time and maintainability requirements of the problem being solved, unlike a throughput-focused GC'd language like C#.
Specifically what experiments have shown that people can write in C faster than python? You even admit yourself that it "generally" takes longer. I think it just plain takes longer. Of course that's anecdotal, but if you've got something non-anecdotal, I'd love to see it.
And since you've been so steeped in systems programming, would you not agree that the performance gap is shrinking? I think that's hard to argue against. And who said anything about abandonment? There's a place for C, but there are fewer than there used to be.
But hey man, sorry if I offended you, maybe you're having a bad day.
While it may be true in this case, this is the sort of insulting and dismissive argument that I don't like to see here.
Having done my share of kernel development I can assure you that anyone who brings up a topic of rewriting Linux kernel in (even) C++ gets laughed out of the room. When someone starts suggesting that there are plausible alternatives to C for kernel development, it is indeed a clear indication of no prior experience with the subject matter.
I'd have my resume up to date if I were you. Your technical arguments are irrelevant at this point -- you spent a significant amount of time deliberately ignoring the clear instructions of your manager and, apparently, not communicating with him. I would fire you on the spot regardless of the quality of your solution.
One way to salvage this situation without getting fired might be to come clean now, be contrite, stop using incendiary words like "inadequate" and demonstrate the new solution as something that just got out of hand. It's hard to hire programmers right now, and the manager would have to weigh the (legitimate) desire to fire someone on the spot with the fact that getting a replacement would be expensive and annoying.
One could even say "now that I understand the problem better, I have a better handle on implementing it in ANSI C, as requested".
1-Automate pointer creation so you don't spend time with them.
2-Automate string creation.
The good thing of programming is that you could automate anything. C# just automates it for you by default, but it is not god either.
In fact for platform independence is one of the worst languages to choose(and windows future looks no brighter than its past with iOS and android). You could use c inside Obj c, on c++, on python and java super easy.
It seems to me that "inadequade" is "I don't know enough about programming, and I only know one (proprietary) language, so I want to only use it"
And as it happens, I used it not because I'm not able to write C or C++, but because doing so is a waste of effort better suited to doing other tasks.
Sorry to be so pedantic, but C# is absolutely not a proprietary language. Yes, it's predominantly used in a proprietary context (OS and tooling), but the language itself isn't proprietary.
It doesn't matter if it's the right or wrong technology choice, this is really an issue of 'work ethic'. Perhaps if the language was left unspecified, or it was a suggestion to use C rather than a requirement then it might be different, but this sounds like a rather blatant violation of trust based on a lack of respect.
I'd have no problems removing the programmer from the project, even if the software was awesome.
What would be said if a future requirement, unknown to you, were for an ARM chipped portable controller for said instrumentation, as a student project.
Bad move.
There have been many studies on Change Management and certain strategies work in some situations better than the others. Most of them take a structured and step-wise process - e.g. Preparing for Change, Managing Change then Reinforcing Change.
It is certainly hard to master the skill of convincing others to take up change, but it is paid off many times over the years in numerous situations. So it is well worth trying.
We programmers tend to look at all things as technology problems, even in the way the question was asked ("inadequate?" what?) when it's almost always an interpersonal problem.
I've had to write some C that interfaces with C#, so providing a low level library for a C# UI might be an option, but implementing it without the Boss's permission...yeah probably not so wise.
He failed to follow the first requirement (ANSI C). Everything else afterwards is merely more justification to distrust him or her.
If Linus Torvalds it's starting a new project, C is probably a good choice for almost anything. Why? Because he's an incredible C programmer. But we shouldn't confuse every developer with Linus Torvalds.
I had that exact same thing happen to me once. There's no shame in it.
Sorry for the bad tidings.