Coffeehouse Thread

8 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

managed vs unmanaged?

Back to Forum: Coffeehouse
  • User profile image
    footballism

       I'm a .net dummy,I've spent about one year learning C#,inner working of CLR, managed code, type safty and the like,what I feel most excited about .net architecture is its simplicity,uniform programming model etc,but after I have some experience with .net and c# language,I feel pretty confused when I find out that in most cases,what I know about managed code is just something like a wrapper around the unmanaged code-for instance,com,win32 api etc.
       so my question arises now.I just wanna know whether or not it is a neccesity to learn com architecture,or win32 apis before I take on the managed code,bcos I've no experience working with com or activex components something like that.
       now,many people are talking about .net purity,and now what I wanna talk about .net programming purity,I hope all c9 guys here can lead me to the right programming direction.

  • User profile image
    stevem

    That's a good question. The answer is: it depends on what you're trying to do.

    The .NET framework is a pretty powerful thing. There's a lot that can be done without ever having to P/Invoke to the Win32 API or interop with a COM object. My advice would be to spend your time learning the details of managed code and leave the other stuff until you need it.

    I think it's important to have a general understanding of COM and the Win32 API, but it's important not to get bogged down in them. Should you know how COM objects are architected? Yes. Should you know what IID's, QueryInterface, and CoCreateInstanceEx are? Probably. Do you need to know the ins and outs of every last esoteric COM API in order to be an effective .NET developer? Almost certainly not.

    Same with the Win32 API. Go read about message pumps, WNDPROCS and all that jazz. Learn enough to know what you don't know, but don't go much further. All you want to do is learn enough to ask the right questions, should you ever find yourself in a position of needing those answers. 

    These days, the software technology space is so large that you have to be strategic about how you approach it. It's impossible for one person to have a deep understanding of every Microsoft technology in play to day. Part of the job is knowing what technologies are worth understanding in detail, and which ones are OK to understand more superficially. These are different for everybody -- build skills in the technologies that are relevant to the type of software that you want to build.

  • User profile image
    Frank Hileman

    I say you should not learn much about COM or unmanaged code. By focusing on .NET, you will get a greater return on your time investment. .NET programming is simply easier. COM is obsolete, and you won't need to use either COM or win32 unless you run into a problem you cannot solve with the framework.

    COM at it's core is not complex, but remember that COM by itself is just plumbing -- what the CLR completely replaces, in a beautiful way. The only good thing that ever came out of COM is binary reuse.

    COM is only plumbing, but it can be very complex. If you try to avoid COM, you may very well save yourself from a world  of pain.

  • User profile image
    footballism

    Frank Hileman wrote:
    COM is only plumbing, but it can be very complex. If you try to avoid COM, you may very well save yourself from a world  of pain.


       well,I think some understanding of COM is neccesary,but I don't know how many things about COM I have to understand.ya know I have never learned something like c++,or vb6,so what I know about COM is just some quite superficial concept.I believe if I can develop some COM components,definitely I will have a much clearer understanding of it.
       anyway,thanks for all the excellent and eloquent words from c9 guys.

  • User profile image
    sriraag

    i have a question?

    when should i use managed code and when should i use the unmanaged one.

    say i have an application which takes command line parameters do i use managed or unmanaged code.

  • User profile image
    ZippyV

    double post [remove]

  • User profile image
    ZippyV

    Use managed code as much as you can. If you need performance for your application use unmanaged code or if the .net framework doesn't allow you to do something you want.

    The .NET framework can handle command line parameters, use managed code.

  • User profile image
    timf

    sriraag wrote:
    when should i use managed code and when should i use the unmanaged one.


    Use managed code unless you know you shouldn't, or can't.

    For someone just getting started, which is what I'm sensing from you (no offense if that's not the case), "unmanaged code" shouldn't even be in your vocabulary at this point.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.