Should I go with C # /. Net OR C ++ for my application?

I am working on a project that speaks to SQL Server

and most of the end of the code is in C++

.

It is an application that controls the flow of multiple fluids when loaded onto media. Some of the rear modules that talk to the controllers, which in turn control the flow of fluids into C++

. Since they have memory leaks and some other bugs, an attempt was made to port them to .Net

.

As far as I understand, performance decreases when we use modules.Net

for back end . So my opinion was not for converting these back end modules to .Net, but for fixing issues in C ++ itself.

The code under discussion uses an application that interacts with the controller firmware. It basically takes some commands and gets a response from the controllers. This code has no interface, and the same code interacts with SQL

and also to update data. Both are part of the same exe .

.Net

considered good when performance is not strictly expected. This would be handy if new code had to be written and especially when it involves user interface design. Another school of thought, .Net is good for higher levels, but not for lower levels in a layered architecture.

I would like to know the opinions of other people from different points of view. Some of the aspects to consider are as follows:

  • speed
  • code maintainability
  • risks associated with migration in the future
  • and etc.

Comment out the rewrite angle of the existing code. It will be a one-to-one C ++ to C # string conversion if we decide to go for it.

0


a source to share


5 answers


Quick response:

If you have capable C ++ programmers who can use debuggers and understand their application domain and how to use controllers, it would probably be easier to do a thorough review and fix bugs and memory issues. After all, time and effort has already been spent on the code, and if it's not trivial code, rewriting in C # could introduce new logic errors.

Questions for OP:

The code under discussion uses driver code that interacts with the controller firmware. This basically accepts some commands and receives a response from the controllers. This code has no user interface and the same driver code interact with SQL and also to update data.



Are you talking about user-mode software that you called "driver", or are you talking about a kernel-mode device driver?

It will help if you can provide more information about these firmware controllers that control fluid flow. Does C ++ back-end support connecting to controllers via RS232 (Serial)? Ethernet? USB? TCP / IP? PCI?

If you are connecting to controller hardware over TCP / IP or RS232 (serial), C # /. NET is well suited for this task. For anything else like USB, PCI, Ethernet, etc., you will need a device driver, which must be programmed in C or C ++ depending on the driver's requirements. Of course, you can encapsulate the user-mode portion that is in C ++, or encapsulate direct calls in Win32, but it will add more development tasks to your project.

+2


a source


Apparently the only problem with existing C ++ code is memory leak.

It seems to me an insufficient reason to rewrite the whole thing in C #.



Instead, I suggest running a memory leak detector to find leaks.

+1


a source


each language is special in its own way, you have to figure out which language is best for the script

0


a source


Do not rewrite the whole program in another language due to multiple errors - the new product will only have different ones and the Q&A loop must be restarted. I will fix the bugs in the C ++ program. If the issue is memory management I would heavily peek into std::auto_ptr

or std::tr1::shared_ptr

, which will automatically delete memory for you when you're done. If that's not an option, I'm pretty sure running something through valgrind, or even paying for commercial memory chips, will be cheaper than rewriting the whole thing (both in time and in money).

0


a source


"language is special in its own way" I need to hug a person, for real. Don't change languages ​​because the code isn't well written ... write better code and use the resources available to you.

0


a source







All Articles