Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

so I'm developing an application that will take information from a tanning bed and display it on a webpage, so customers can see how long the wait is. The bed will be connected to a control module which will be connected to a computer via RS-232 and USB. My question is, should I be writing this is C or C#? What are the advantages/disadvantages?
Posted
Comments
Sergey Chepurin 26-Jan-12 6:11am    
Everything concerning Web is faster to develop with .NET languages.

I would use C#, because of faster development (C would probably give you best application speed, that is almost irrelevant in such a case).
 
Share this answer
 
Comments
Espen Harlinn 25-Jan-12 16:03pm    
5'ed :)
CPallini 26-Jan-12 3:16am    
Thank you.
fjdiewornncalwe 26-Jan-12 9:37am    
+5.
CPallini 27-Jan-12 3:02am    
Thanks.
You mentioned three different languages, not two: C++, C and C#.

The short answer is: it's up to you. It also highly depends on your knowledge and skills.

As to advantages and disadvantages: first, the answer could be too long to fit the format of Quick Questions & Answers. Also, many items would be ambiguous: and advantage could appear as a disadvantage from a different point of view and visa versa. No, this question is not perfectly valid.

You cannot compare C# with C/C++ just as languages as the platforms are very different. There is a limited number system-specific problems that could not be solved in .NET. In this case, you can use native solution or a mixed solution: part of the work is written in, say, C, a part of it in .NET (C# or something else, does not really matter). This can be a case with USB which is not directly supported by the libraries bundled with .NET. RS-232 is fully supported, please see System.IO.Ports.SerialPort, http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^].

I would personally try to do as much as possible using C#, as this language not so archaic as C++, provides much better support of the programmer's work and invite less bugs; and interoperability with different platform is not a problem for me. Besides, CodeProject provides a number of ready-to-use USB solutions: http://www.codeproject.com/search.aspx?q=USB&doctypeid=1[^].

For someone else, the choice can different.

—SA
 
Share this answer
 
This[^] was one of the first things I published here on CP - basically a code dump. It's also just about what you need for your application, and it's better explained here[^].

In his answer SAKryukov has provided the links to Microsofts documentation.

Best regards
Espen Harlinn
 
Share this answer
 
The app should be written in C#. It will be faster and less error prone.

However, you must consider what you already know (your current skills), what you want or like doing (what kind of programs do you like writing?), and context (if you work with people who all program in C or C#, etc).

Whatever the choice you make, try to write clean code, to document it and to understand it. And use google to find what has been done (do not reinvent the wheel).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900