Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Can anyone tell me what would be more efficient: A large program is written in visual-C++ years ago is now intended to be written in C#. What would be better, re-writing the whole code of visual-C++ in C# or write C++ DLLs to be used in C# program via DLLimport?
I guess it depends on how data-centric your code is. If you can easily separate out the functionality that does not require an interface, then you'd most likely be better off writing a DLL to utilize this functionality, and then re-writing the interface in C#.
If the program is rather interface heavy, and you do not want to go through separating out all of the data functions, then I'd just go ahead and re-write the whole thing in C#, although I'd expect to lose some performance.
VisualC++ is still a very widely used language - is this your only reason for wanting to move to C# (i.e. finding it hard to recruit people, lacking skills to continue development)?
There is only a single answer to this: "it depends". We cannot possibly know this, it's something you must decide.
Check what you need in terms of time and other resources for both. Check what benefit your gain from both. Weigth cost against benefit. Decide.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Of course, it does depend on the application in question. If I am using, for example, a grammar checker to check for mistakes to make the code more readable, I don't think that that is a bad practice (though tell me if it is).
But I am thinking about bigger extensions like Resharper that adds so much, with me not even knowing 95% of what it does.
My big question is: is it a bad practice to use Resharper or similar applications that I mostly don't understand (while the few bits I do understand does help me), while I don't even know how most of the basic Visual Studios application works?
A productivity tool (like R# or others) is supposed to enhance your productivity.
That means you should be able to do your job, just do it faster (or cheaper or whatever other metric you use) with the tool.
If you catch yourself not being able to do the job without the tool, because you don't understand what the tool does or cannot replicate it without the tool, that is a problem.
Just keep in mind that a tool can vanish for any reason at any time. Your employer may not want to pay for it, may not like it, use a different product or maybe the product does not support your preferred environment anymore or simply has bugs. You cannot tell an employer that you cannot do something because a $100 tool broke when you are paid $100K. It's acceptable that you take longer, but not that you have to give up.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to use a c++ project to do some calculations for a c# project and return the results.
I was wondering if I would benefit a more efficient calculation speed in c++ if I do so?
Would still be efficient if I wrapped the native code in c++/cli?
Are there any examples out there?
Just as simple example say you have two double values A and B in C#, how would you have c++ project to receive A and B and a string value "plus" or "times" to calculate and return A + B or A * B?
Use Process.Start(); to spawn your optimized program. You will be able to pass parameters and even read the output. Start here: https://msdn.microsoft.com/en-us/library/53ezey2s(v=vs.110).aspx
You've got two separate issues in your question: "How do I", and "Should I".
If you're having problems with the "How do I", please post a question with the specific code you have, and what problems you're having.
"Should I" is somewhat of a nebulous question: It depends a lot on the type of calculations you're trying to do. These questions often have no one right answer. (Also note that this type of question is often offtopic for Stack Overflow for that very reason, so this question may be closed.)
For some types of calculations, the C++ compiler might produce more efficient code than the .Net Jitter. For some types, it won't make a difference. C++ would also let you do things like using the GPU to perform the calculations.
Also, consider how long it will take you to write this optimized code, and how often you're going to run it. If this needs to run overnight once a month, maybe a couple hours to run is fine.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm just curious if #region is really necessary in C# coding, because I don't think I really need it since I can keep track of everything I do(mostly because the projects are small).
So is it really necessary to learn at all?
Good and strong responses to why and why not are very welcome!
No, it isn't necessary and some would say that it isn't even useful.
Personally, I'll use regions if it makes sense to group functionality together - related unit tests, for instance is a place that I'll use regions - but I know that folks differ on this opinion.
The whole point with regions is that it is simply a convenience for collapsing an area of code. It doesn't enforce anything, doesn't check that you've not put functions in the wrong place, etc. But it can be helpful in certain circumstances.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Opinion-based Update the question so it can be answered with facts and citations by editing this post.
Improve this question
I'm currently developing an application where it's rather crucial to keep the user from decompiling the code. Now, I'm aware of the fact that most .exes are decompilable if executed by an experienced programmer. However, my goal is simply to keep it safe from the "regular" user with basic programming knowledge.
I've come across several obfuscators, and the one I'm using right now is Codeplex Confuser, which you can find here. Since I'm no obfuscation guru, or that experienced within programming of any high level, I'm asking you if you know anything about the safety of this obfuscator.
From my experience Confuser is one of the hardest (free) obfuscators to reverse at this moment. At least by 1-click tools.
Personally I had a few issues with it, namely, a few false positives when using max settings and a few cases that made my .exe's unable to run.
Keep in mind that regardless if it's a bit harder to reverse than other free alternatives it's still very possible for someone to do so if he devotes a bit of time.
Using an obfuscator will make it a lot harder to decompile the code, but it's still not safe.
The only way to keep your code safe is to keep it out of the hands of the users. You can put critical code in a web service, and let the application call it. Unless the user can actually hack the server and get to the code, it's completely safe from decompiling.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Seems like it would be a good way to introduce some people to unit testing.
Well for one thing, the documentation for doctest talks about "interactive Python sessions". There's no equivalent of that in C#... so how would the output be represented? How would you perform all the necessary setup?
I dare say such a thing would be possible, but personally I think that at least for C#, it's clearer to have unit tests as unit tests, where you have all the benefits of the fact that you're writing code rather than comments. The code can be checked for syntactic correctness at compile-time, you have IntelliSense, syntax highlighting, debugger support etc.
If you're writing code, why not represent that as code? Admittedly it's reasonably common to include sample code in XML documentation, but that's rarely in the form of tests - and without an equivalent of an "interactive session" it would require an artificial construct to represent the output in a testable form.
I'm not saying this is a bad feature in Python - just that it's one which I don't believe maps over to C# particularly well. Languages have their own styles, and not every feature in language X will make sense in language Y.