开发者

is managed code really necessary [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

I'm just wondering what are the really advantages of managed langage over native code

portability: C#/Jave need to have a VM implementation for each plateforms, c++ has to have a compiler

garbage collector: we can have a thread in c++ which check for memory alloc/desaloc

reflexion: maybe we can have a similary mechanism with native code (???)

Today managed code has gain a lot of popularity, however native code has the advantage to be more efficient in general, and lighter ie: there is no VM to have on the target plateform.On the other hand,according to me, the advantage of managed code are not really big, I am wrong ? I开发者_如何学运维s managed code is the good way to follow for the majority of application ?


Your statement about portability:

C#/Jave need to have a VM implementation for each plateforms, c++ has to have a compiler

Is not quite true, or clearly true - C#, VB.NET, Java, etc. need to be compiled once to IL, bytecode, etc. but C++ needs to be compiled to a different version for each platform, which also may require changes in DLLs used (if any) or methods for managing memory.

As for garbage collection, I don't know much about doing that on a thread in C++; but in managed code, you don't have to do any work to have a garbage collector. It's already there. Also, in managed languages you tend to write a lot less code to do what it is you need to do, and that has a huge advantage in clarity. (I find this is especially true when designing the UI of an application.) Also, optimizations can be done in real time using managed code execution, and updates can be made to the engine to make it better.

There are several advantages to both managed and unmanaged code, and in the end, it depends what you're doing. I think big projects are more suited to managed code, and parts that require speed can be done with unmanaged code. After all, unmanaged libraries can be used in managed code and vice-versa.

So, in my opinion, yes, you're wrong. It's a bit of a subjective question, though.


Managed code is the best way to go for the majority of applications. The reason is that it will be faster for you to implement, simpler for you to unit test and easier to maintain.

There are certainly applications where this is not the case. Applications that must be fast or applications that need special access to the hardware should probably be native apps. Yes you can re-implement the services provided to you in managed applications using native code, but why would you?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜