A few months ago, we started developing an app to control an in-house developed test equipment and record a set of measurements. It should have a simple UI, and would likely require threads due to the continuous recording that must take place. This application will be used for a few years, and shall be maintained by a number of computer science students during this period.

Our boss graduated some 30 years ago (not to be taken as an offense; I have more than half that time on my back too) and has mandated that we develop this application in ANSI C. The rationale is that he is the only one that will be around the entire time, and therefore he must be able to understand what we are doing. He also ruled that we should use no abstract data types; he even gave us a list with the name of the global variables (sigh) he wants us to use.

I actually tried that approach for a while, but it was really slowing me down to make sure that all pointer operations were safe and all strings had the correct size. Additionally, the number of lines of code that actually related to the problem in hand was a only small fraction of our code base. After a few days, I scrapped the entire thing and started anew using C#. Our boss has already seen the program running and he likes the way it works, but he doesn't know that it's written in another language.

Next week the two of us will meet to go over the source code, so that he "will know how to maintain it". I am sort of scared, and I would like to hear from you guys what arguments I could use to support my decision.

Cowardly yours,

  • 220
    "Oh no, this is not the final version, it's just a C# version we quickly wrote in a few days for prototyping and testing, to make sure we understood the requirements and to fine-tune the UI. Implementing this in ANSI C will take another X weeks, because, you know, we have to work around not having all those fancy data structures. ... Well, yes, now that you mention it, the C# version does already do everything the final program should, but you said you need it in ANSI C. ... OK, if you insist, let's stay with this version..."
    – Heinzi
    Commented Sep 7, 2012 at 5:17
  • 8
    @Heinzi: I've had the same experience: Writing a C# prototype of a library in 2 days, and spending several weeks rewriting it in C. Fortunately, after that project, I was offered the chance to transfer to another team with a more sensible language choice.
    – dan04
    Commented Sep 7, 2012 at 6:31
  • 49
    Global variables and threads? You are in trouble, my friend, regardless of the programming language you use. Commented Sep 7, 2012 at 12:43
  • 16
    The argument you really need is why you should keep your job.
    – epo
    Commented Sep 7, 2012 at 14:35
  • 11
    Your assumption is incorrect - ANSI C is adequate for nearly all projects. That's why it's still popular after all these years. Whether it's optimal or not is a different question. Commented Sep 7, 2012 at 15:25

11 Answers 11


Notice that the "Please do it like this so I am sure I can maintain it" is actually a very good requirement - most programs spend much longer being maintained than being written and keeping a solution in a known technology is usually a good idea.

Just imagine if some new computer kid when asked for writing a C# application wrote it in Haskell in two days and said "Hey, it works and I'm gone, bye" leaving the maintenance on you.

Just imagine if some new computer kid when asked for writing an ANSI C application 15 years ago had written it in Visual Basic 6 in two days and left it. Now you have to maintain it and Windows 7 starts complaining already when the installation media is inserted.

This might be a good opportunity to say - as Heinzi hinted in the comments - that "this is a quick prototype written in C# which happens to look very much like C - shall we make it production ready, or reimplement it in ANSI C like you asked", and then take the discussion now. Having actual source to see, is much better than "Hey, shouldn't we write our next application in Haskell because its faster".

In other words - you now have the opportunity to demonstrate that a new platform could be considered. Bring up that you wrote a prototype before the code review - this will help removing the impression that you are trying to sneak C# in under the radar. I would suggest that you also demonstrate that all existing code written in ANSI C can be used from within C#. Personally I believe you will be told that the target remains ANSI C to stay in a single platform.

  • 26
    +1: for pointing out the requirement "do it like this so I am sure I can maintain it". C# is for sure much easier / faster than C to develop in (in general), but C has changed in the last 30 years less than C# has changed in the last 15 years. So for a product that has to be maintained over many years C could be better suited. You have to compromise between all requirements: complexity of the project (C# is probably a better choice), long term maintenance (C seems to be more stable), who is going to do the maintenance, etc.
    – Giorgio
    Commented Sep 7, 2012 at 5:40
  • 4
    @Ramhound I am not talking about VB6 support, but about supporting the Visual Basic 6 development environment. My copy of Windows 7 explicitly notified me when inserting the installation media that this was not a good idea.
    – user1249
    Commented Sep 7, 2012 at 12:16
  • 12
    Good points, but what if the boss had asked for it to be written in COBOL? Or 6502 assembly? At what point can you say to your boss, "That language is obsolete for this purpose, and once you're gone there will be no-one left who understands this stuff"?
    – Ant
    Commented Sep 7, 2012 at 15:03
  • 6
    @Alex: Consistency is nice, true. But would you write a new web system in C if all of the other (non-web) software written by your department was written in C? I think it comes down to a balance between choosing the appropriate technologies for the system you're writing versus the team's existing skills. Choosing a language with no deliberation because that's what you always use can be detrimental.
    – Ant
    Commented Sep 7, 2012 at 17:24
  • 8
    @ant, the one who pays the band get to choose the music. (and we are a COBOL shop - no problem supporting that)
    – user1249
    Commented Sep 7, 2012 at 18:41

Your boss would seem to be your customer in this case, and his primary requirement is that he be able to maintain the application when you move on. This seems quite reasonable.

So, the choice is to do what he asks, or demonstrate that you can complete development AND teach him how to maintain a C# application within the time constraints and at a lower cost. If you cannot do that, you are not meeting the requirements of the project.

  • 21
    The OP explicitly ignored requirements without notification or discussion. Were the boss a commercial customer he could refuse payment and possibly sue for costs incurred due to wasted time. Reverse the roles, what if you e.g. ordered a bespoke suit and found the tailor didn't like working with the cloth you specified so silently substituted one he did like, in his choice of colour? The OP's problem now is that he can't be trusted with projects without close supervision, demonstrably lacks people skills and has no respect for management.
    – epo
    Commented Sep 7, 2012 at 14:32
  • 1
    @epo I believe I understand your assertion that the boss can't trust the OP since they didn't do what was asked. However, if he is a reasonable manager, that shouldn't happen. If the dev approached the manager with a better solution than originally considered, I would hope the manager would be open to it. If I may modify your example slightly, it is like the tailor making a suit in the desired color/pattern with a newer, more durable, better feeling, and cheaper type of cloth than what was asked for even though the buyer asked for a type of cloth they were familiar with. Commented Sep 7, 2012 at 15:35
  • That being said, I also agree that, in this case, maintenance is an important requirement. The OP is now beholden to prove to the manager that they solved the rest of requirements in a way that the manager can quickly and effectively learn to maintain. Commented Sep 7, 2012 at 16:02

You haven't given a lot of info but I think C is absolutely the right choice - I work as an Engineer in an industrial plant and most (if not all) of our code is written in C. If you need to get measurements from a device (I'm assuming a flow meter or thermocouple or similar here) and display it in near to realtime C is an excellent choice.

It's fast, portable (I've never written in C# but I don't think it works without a particular version of the framework installed and it is usually only windows based).

By all means you could use another language to do the GUI. But you could save yourself the effort and just use a pre-existing trending package (there are some good opensource ones available).

To summarize I'd say for the underlying interfacing with hardware part C is a fine choice.

  • 7
    I've had more success porting C# code from Windows to Linux (using Mono) than I've had with C++ code.
    – dan04
    Commented Sep 7, 2012 at 6:37
  • 8
    @dan04: What problems did you have with C++? I thought C++ would be quite portable. Also, C++ is not C. I always found using C with the GNU C library pretty portable, e.g. between GNU Linux and cygwin.
    – Giorgio
    Commented Sep 7, 2012 at 9:18
  • 4
    @dan04 C != C++.
    – user1249
    Commented Sep 7, 2012 at 11:55
  • 2
    @Giorgio: An annoyingly large part of it was strings. We had to take out all of the Windows-specific TCHAR crap (which we weren't using consistently anyway) and adopted a team standard of using UTF-8 at the same time as the Linux transition. Unfortunately, this required re-implementing a big chunk of the standard library on Windows, boost::nowide not having existed at the time.
    – dan04
    Commented Sep 7, 2012 at 13:04
  • 3
    @dan04: As said, C is certainly not as expressive as C# (or C++ for that matter), but I have been using the GNU C library (gnu.org/software/libc) since 1997 and that's really stable and portable. For C++ I would look at Qt (or at boost and the standard libraries) because they are quite portable. I would avoid Windows-specific stuff if possible: AFAIK it has never been Microsoft's goal to produce portable software since customer lock-in is part of their marketing strategy.
    – Giorgio
    Commented Sep 7, 2012 at 13:22

Oh dear. This is a real-time application? Controlling equipment in real time? Gathering data in real-time? Using a language with a garbage collector? Oh dear.

While I agree that you can probably do the app in a more modern language in less time, that's probably not the major criterion. EASE OF YOUR PROGRAMMING IS PROBABLY MUCH LESS IMPORTANT THAN THE OTHER CRITERIA, such as the ones your boss laid down, AND response time, and deterministic behavior.

I would have suggested you do a prototype in C# or Python, just to test out the main functionality and UI. THEN test the heck out of it, measuring actual latencies and response times, when the app gets hit with a lot of data, over many days of continuous running. Odds are, the app could end up being too slow or fall behind at random times, when VM or the garbage collector kicks in.

I suggest you present what you've done as a PROTOTYPE.

Coding in C isn't that hard. If you're not up to it, say so. There's plenty of us up for the challenge. ( I've been doing real-time C coding for, argh, decades now ).

  • 3
    Lets phrase the first bit differently. Oh dear. This is a real-time application? Controlling equipment in real time? Gathering data in real-time? RUNNING ON A NON-REALTIME THREADED ENVIRONMENT? Oh dear. You are always going to have to sample when you cross device boundaries. 'Real time' is a straw-man argument and an ill defined requirement. C# is fine.
    – Gusdor
    Commented Oct 17, 2013 at 10:45
  • You've obviously not heard of Joe Duffy's work. He's been working on Systems programming in C# since at least 2013. The Roslyn compiler can compile into native code (that's how UWP works) and garbage collection isn't an issue if you pay attention to what you're doing.
    – RubberDuck
    Commented Sep 25, 2016 at 23:26

Well, the first thing to do is to go to your boss and fess up. You've disregarded his clear request, and worse have been doing so for months. I don't know how much time you've got into this, but assuming that it's most of the time allocated for getting the project done, you have to face up to the fact that you may soon be looking for a new job.

The sooner you deal with this the better.

Secondly, I don't think you can convince him that ANSI C is inadequate, what you need to do is convince him of several other things (1) that c# is adequate, (2) he can easily learn to maintain c#, (3) that you were inadquate to writing it in C. Assuming that you still have a job and a part to play with this project, I would concentrate on 2, emphasising the similarities between c and c#.

Quotes in response to comments...

A few months ago, we started developing an app [...] After a few days, I scrapped the entire thing and started anew using C#

  • Nowhere did he mention he'd been building a C# version for months?
    – Anonymous
    Commented Sep 7, 2012 at 11:08
  • 1
    @Anonymous - It does not matter if it was days or months he still DID NOT follow his managers instructions. The author clearly did not have the skills required to develop the application in ANSI C.
    – Ramhound
    Commented Sep 7, 2012 at 12:19
  • 1
    @Ramhound - I'm not disputing that he didn't follow his managers instructions, I'm just saying jmoerno was making out as if he'd spent months going off on tangents. Besides, if he pieced the project together in a couple of days to serve as a working prototype upon which the more stable C version specified can be based upon then it makes perfect sense. It's part of the planning stage.
    – Anonymous
    Commented Sep 7, 2012 at 12:33
  • @jmoreno - Apologies, I must have misread the question.
    – Anonymous
    Commented Sep 7, 2012 at 14:56
  • 2
    @jmoreno - Of course. I posted my last comment after seeing the quote you added. Apologies once again.
    – Anonymous
    Commented Sep 7, 2012 at 15:34

has mandated that we develop this application in ANSI C. The rationale is that he is the only one that will be around the entire time, and therefore he must be able to understand what we are doing.

This is a pretty reasonable requirement.

He also ruled that we should use no abstract data types;

This doesn't make sense. Now it is starting to smell a bit suspicious, because this is a program design requirement and not a language requirement. If the code should be easy to maintain, implementing ADTs or using well-tested, pre-existing ones should be a priority.

he even gave us a list with the name of the global variables (sigh) he wants us to use.

Ok, so now it stinks. Now we can tell that your boss has limited experience not just from various programming languages, but from programming in general. A skilled veteran programmer, no matter language preference, would never make such a statement. (The only exception that I can think of is if most of the code is intended to run on a fairly small embedded system, and therefore that all necessary working memory for the code was expected to be pre-allocated. The idea that the same code is expected to have a screen level UI argues against strongly that being the case, however).

I'm guessing that your boss has never been involved in large scale, mission critical software projects, but he has more likely been floating around in various low-quality ones.

So this has nothing to do with the programming language C. You can easily write equally icky programs in C# as well. It is a very common mistake to believe that good program design depends on the language. That is simply not true!

C# certainly has prettier, cleaner and less obscure syntax than C. It has plenty of program design support, since it has far more OO-related keywords than C. But apart from that, it does not tell you how to write your programs. If you believe that everything written in C is awful by default and everything written in C# is heaven by default, I bet you are currently writing rather awful C# programs without realizing it.

What I would suggest is that you make an abstract, language-independent, but detailed program design before anything else. Use the normal, object-oriented approach. What objects are there and how do they communicate between each other, what are the dependencies needed etc etc. When you have given the program design enough thought and gotten it down on paper, it shouldn't matter much to you nor to your boss which language you chose to implement it in.

  • 1
    +1 for " You can easily write equally icky programs in C# as well."
    – Javier
    Commented Sep 7, 2012 at 19:13

The first issue you have to address is an emotional, irrational one. The IT industry is one in constant change and, although there are places for everything, refusing to improve or embrace change is a problem.

Why is your boss clinging to ANSI C? If that is the only language he or she knows then maybe it is time for a change but a rational argument may be insufficient. Will your boss feel undervalued or possibly fired if forced to work in an unfamiliar language? Emphasize the experience that he has and other benefits he brings.

If you do not solve this problem, all the rational arguments you can bring will be wasted. As a subordinate, you may not be the one that can have this discussion with him. Perhaps broach this subject to one of the other managers, if there are any.

Also consider it from your perspective. Why do you want to use C#? How much of this is the desire to use something new and cool? Be honest with yourself. If you recognise this, it will help you argue more effectively.

The second issue is one of risk and cost. Writing software is expensive and the choice of language is a major factor in that. Consider:

  1. How long will it take to write in C# versus C? With easier object orientation and better garbage collection, C# may be easier. However, if the application uses lots of unmanaged API calls, C may be easier.
  2. If you use C#, do you need to purchase additional tools? It sounds like you already use Visual Studio but do you need additional tools for localization, code review and analysis, debugging and so on?
  3. How easy is it to maintain? If you find a bug, how quickly can it be fixed. C# can reduce this object orientation. Automatic garbage collection also avoids most memory leak and pointer issues.
  4. How easy is it to support? If you have support staff, they may know how to read a crash dump but do they know how to use windbg with SOS? Do the target machines already have an appropriate version of the .Net framework installed?
  5. Consider staffing. How many people know C versus C#? If either or both of you left the organization, how easy would it be to replace you? Are C developers cheaper or more expensive than C# developers?

I could go on but the point is to stop arguing on the technical merits of the languages alone. Technical merits are things only you and your boss understand. If you start talking business impact, you pull in a much wider group of people and make a far more convincing argument.

Maybe C is a better choice. C# is no automatically better for all situations. Maybe you do this project using C but do a C# proof of concept for the next one. Remember you can lose the battle but still win the war, too.

  • 5
    I disagree with the implicit assumption that C# is by default a better choice than ANSI C. For instance if you want to stay platform independent C# is most likely a bad choice.
    – user1249
    Commented Sep 7, 2012 at 11:18
  • @ThorbjørnRavnAndersen I agree. Please see last paragraph. I also mention cases like calling unmanaged code. I assume that platform independence would have excluded C# in the OP. Perhaps this is an incorrect assumption.
    – akton
    Commented Sep 7, 2012 at 11:20
  • 1
    Platform independence was just one possible reason. Wording like "clinging to ANSI C" does - in my opinion - indicate a bias.
    – user1249
    Commented Sep 7, 2012 at 11:54
  • @akton - Since when can you not call unmanaged code from C#. Of course it requires a wrapper and that introduces additiona support problems but it is possible. Furthermore you can support C# on multi-platforms if you want. Mono is support on every major desktop platform ( OS X, Windows, and Linux ). Granted as the Microsoft Windows based .NET Framework advances the feature base of Mono won't match it exactly ( that is already the case with WPF ) and of course you won't be able to develop Metro applications that run on Linux. Of course its unlikely that would be done in this case.
    – Ramhound
    Commented Sep 7, 2012 at 12:12
  • @Ramhound I did not say you cannot call unmanaged code from C#, just that lots of it can be a pain. Similarly, you can do cross platform development in C# but C is almost universal, as Thorbjorn said.
    – akton
    Commented Sep 7, 2012 at 12:15

Maybe another argument: It's probably very hard to find computer science students who have enough experience to write C code without making mistakes. ANSI C is not the first thing people learn today.

Now all computer science students will kill me.

  • ANSI C was actually one of the first things I learned at college. I started in 2004. So within the last 10 years it was still being taught. I spent many late nights connected via SSH to a Unix environment trying to compile my code.
    – Ramhound
    Commented Sep 7, 2012 at 12:14
  • 1
    Funny, I didn't learn ANSI C until my final year at University. The first language taught was Pascal, so that I am protected...
    – tehnyit
    Commented Sep 7, 2012 at 14:25
  • Recent graduate here; we had exposure to both C and C++, however the C was in an embedded context and minimal. Both were in my final year - purely C# and Java before that.
    – Ross
    Commented Sep 7, 2012 at 14:41
  • 2
    C simply being hard to program right is probably the best point against using C. Commented Sep 7, 2012 at 16:06

You have completely failed to convince us that ANSI C was inadequate. C is an excellent language that seems adapted for the kind of tasks you have described. With the short description of the task (except the language requirement), I would also recommend C (or maybe go).

I think the problem is that you were programming in C with your mind thinking in C#. I have a similar problem when I switch from Perl to C or java. You must learn to adapt to the language, and not learn to translate from your way of thinking toward the language of the day.

The problem is not your boss or the C language, the problem is to open your mind toward different ways of thinking. Changing programming language is something that will benefit you.

  • 4
    Thank you for answering your first question on Stack Exchange Programmers. However, you may wish to make your future answers a little less personal by not using phrases like "you have completely failed", "the problem is to open your mind". Please review the FAQ programmers.stackexchange.com/faq#etiquette . I think you can make a good description of your point with neutral language. Commented Oct 1, 2012 at 22:01

First off, you need to tell your boss it's in a different language, now. He'll be (understandably) angry if you bring back something purposefully against the requirements with no notice.

Now, the best way to explain these things to boss/managers is to put it in terms of time and money. Estimate how much time such a project would take in ANSI C, and then estimate how much time it would take in something higher level such as C#. Note I said higher level, not modern. This may help to smooth things over as well. I mean, you wouldn't tackle painting a room with just a tiny paint brush, you'd use rollers and other things that make each stroke(line of code) cover more area of the project. Also, if you or one of your team members do not know C, or comfortable making a large project in C, this eats into the time issue even more because they'll be having to get up to speed.

It also sounds like your boss is trying to micromanage. I'm sure one of the other answers will try to explain how to get your boss to do that less

  • Affordability seems a possible argument. While the boss (as a customer, per @MatthewFlynn's suggestion) argues that he cannot afford the program not being written in C, OP can argue that the the boss will also not be able to afford the implementation and maintenance costs associated with the program being written in C. Either way, compromises are needed to make things happen.
    – rwong
    Commented Sep 7, 2012 at 7:47

The supervisor aversion to ADTs was addressed elsewhere, as was the dev's seeming unawareness of GC costs, so I'll focus on "threads".

Perhaps rather than thinking in terms of .NET (or JVM, if so indoctrinated) threading, what you may want is multiple processes, using some inter-process communication (IPC) mechanism to communicate between them. E.g - windows messages, shared memory, memory mapped file buffer, named pipe, whatever. Dedicate small processes to interacting with a device or aspect of the device and checking the IPC to communicate updates and acknowledge requests, and have a somewhat larger process to maintain the GUI and communicate with the equipment "monitors" using whatever IPC you select.

Not the answer you're looking for? Browse other questions tagged or ask your own question.