From C# going to c++

Discussion in 'Microsoft Dot NET' started by herr, Jul 7, 2007.

  1. herr

    herr Guest

    Hi all,

    For some reasons, I am moving away from managed c# (after using it for 3
    years) and want to code my windows application in native C++ (perfomance
    issues mainly). I already have a small knowledge of c++, but don't really
    know what to read to learn writing advanced windows applications with it.
    Any one can help me on my way to mastering c++ windows software writing?
    I need some books, tutorials, online communities or what ever you guys just
    know tell me.

    Thanks for you help anyway!
     
    herr, Jul 7, 2007
    #1
    1. Advertisements

  2. "herr" <> wrote in message
    news:...
    > Hi all,
    >
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly). I already have a small knowledge of c++, but don't really


    Probably not a good idea to rewrite the whole thing. Use a profiler, find
    out what portions of the code have performance problems, and rewrite just
    those.

    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys
    > just know tell me.
    >
    > Thanks for you help anyway!
    >
     
    Ben Voigt [C++ MVP], Jul 7, 2007
    #2
    1. Advertisements

  3. herr wrote:
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly).


    I am very skeptical on whether you will see significant
    performance improvements by that change.

    > I already have a small knowledge of c++, but don't really
    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys just
    > know tell me.


    What GUI library do you want to code against ? Win32 API ? MFC ?
    wxWidgets ? Qt ?

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jul 7, 2007
    #3
  4. herr

    herr Guest


    > I am very skeptical on whether you will see significant
    > performance improvements by that change.


    Then why is it that .net is not used by big software companies like Adobe,
    Yahoo, Google and even Microsoft (even in Vista) ? I mean in Desktop
    applications.


    > What GUI library do you want to code against ? Win32 API ? MFC ?
    > wxWidgets ? Qt ?


    I don't know! What is the most used GUI library in the market? The best for
    windows XP / Vista platforms.
     
    herr, Jul 7, 2007
    #4
  5. herr wrote:
    >> I am very skeptical on whether you will see significant
    >> performance improvements by that change.

    >
    > Then why is it that .net is not used by big software companies like Adobe,
    > Yahoo, Google and even Microsoft (even in Vista) ? I mean in Desktop
    > applications.


    I was not aware that Google and Yahoo made desktop apps.

    I am very sure that more and more of MS desktop apps will be
    coded using .NET (and Adobe also unless they have cross platform
    requirements that prevent them from doing so).

    The reason they are not already has probably more to do with the cost
    of rewriting millions and millions of lines of code than for
    performance reasons.

    >> What GUI library do you want to code against ? Win32 API ? MFC ?
    >> wxWidgets ? Qt ?

    >
    > I don't know! What is the most used GUI library in the market? The best for
    > windows XP / Vista platforms.


    There are a lot MFC code out there.

    But I would consider .NET and WPF a much more future proof
    route than MFC.

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jul 7, 2007
    #5
  6. herr

    Peter Duniho Guest

    On Sat, 07 Jul 2007 10:11:36 -0700, herr <> wrote:

    > Then why is it that .net is not used by big software companies like
    > Adobe,
    > Yahoo, Google and even Microsoft (even in Vista) ? I mean in Desktop
    > applications.


    For a variety of reasons, none of which have anything to do with
    performance.

    Also, I doubt it's true that the companies you mentioned don't use .NET in
    any of their applications. For sure, it's not true for Microsoft, though
    as is also the case for Adobe, the major desktop applications (e.g.
    Microsoft Office programs) aren't going to be in .NET because .NET wasn't
    around when the bulk of the code for those applications was written.

    >> What GUI library do you want to code against ? Win32 API ? MFC ?
    >> wxWidgets ? Qt ?

    >
    > I don't know! What is the most used GUI library in the market? The best
    > for
    > windows XP / Vista platforms.


    ..NET is IMHO the best GUI library to use on Windows.

    If you're not going to use .NET, then you might as well learn the native
    Win32 API and stick with that.

    Personally, I think the business of "performance issues mainly" is
    invalid. Only certain specialized applications would have "performance
    issues", and even in those cases that's no reason to abandon .NET
    altogether. It _is_ a reason to identify the elements of the application
    that are not performing well and do something about it.

    But most of your performance problems will turn out to be algorithm design
    errors, rather than something inherently slow about .NET, and for the tiny
    fraction of things that really are a limitation of .NET, you can implement
    those in some other language in a separate module and then call that from
    your .NET code. That will allow you to take full advantage of the
    services .NET offers without sacrificing performance.

    You should, of course, feel free to redevelop your code however you like.
    If you want to stop using .NET, that's your perogative. But if you
    believe that you will see significant performance gains doing so, I
    suspect you are in for some disappointment.

    Pete
     
    Peter Duniho, Jul 7, 2007
    #6
  7. herr

    Ben Rush Guest

    "Any one can help me on my way to mastering c++ windows software writing?"

    Start fixing your problem by identifying exactly what is poor in your C#
    application and fixing it one by one. If you have to ask how to write
    advanced windows applications in C++ you're not going to get the performance
    gain you expect out of doing something in C++; an application can suck no
    matter what language you write it in.

    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Ben Rush
    Microsoft .NET Consultant
    http://www.ben-rush.net/blog
    http://www.sideshowsystems.com


    "herr" <> wrote in message
    news:...
    > Hi all,
    >
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly). I already have a small knowledge of c++, but don't really
    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys
    > just know tell me.
    >
    > Thanks for you help anyway!
    >
     
    Ben Rush, Jul 7, 2007
    #7
  8. herr

    OD Guest

    Like some others in this thread I'm not sure you will see a big
    difference about performances..

    I recently wrote a complete test between C# and Delphi 2006, a kind of
    benchmark.
    Each code does exactly the same thing, one built on BDS 2006, the other
    on VS 2005. Each code has been written to respect each language (no
    unfair trick to give advantage to one language).
    Results are that the C# version is about 25 to 40 % faster than the
    Delphi 2006 one (depending on the computer, Intel processors giving
    best C# results than AMD ones, but always C# faster than Delphi).

    Memory management, strings, maths, file IO, I tested what most
    applications are supposed to do when they're working.

    So, as I'm knowing C++ is very near Delphi on the performance side (I
    tested this a couple of years ago), I think switching to C++ will
    decrease the overall performances of your application. And you'll lose
    all the benefit of the CLR and the object API of the framework. Win32
    API is a mess...

    --


    OD___
    www.e-naxos.com
     
    OD, Jul 7, 2007
    #8
  9. herr

    herr Guest

    Thanks guys for your valuable help.

    I have one other questions. What is the largest application written in .net?
    (except for the Framework itself).

    "OD" <webmaster @ e-naxos dot com> wrote in message
    news:mn.3cc67d77cb45103c.18651@e-naxosdotcom...
    > Like some others in this thread I'm not sure you will see a big difference
    > about performances..
    >
    > I recently wrote a complete test between C# and Delphi 2006, a kind of
    > benchmark.
    > Each code does exactly the same thing, one built on BDS 2006, the other on
    > VS 2005. Each code has been written to respect each language (no unfair
    > trick to give advantage to one language).
    > Results are that the C# version is about 25 to 40 % faster than the Delphi
    > 2006 one (depending on the computer, Intel processors giving best C#
    > results than AMD ones, but always C# faster than Delphi).
    >
    > Memory management, strings, maths, file IO, I tested what most
    > applications are supposed to do when they're working.
    >
    > So, as I'm knowing C++ is very near Delphi on the performance side (I
    > tested this a couple of years ago), I think switching to C++ will decrease
    > the overall performances of your application. And you'll lose all the
    > benefit of the CLR and the object API of the framework. Win32 API is a
    > mess...
    >
    > --
    >
    >
    > OD___
    > www.e-naxos.com
    >
    >
     
    herr, Jul 7, 2007
    #9
  10. If you're moving away from .Net, you need to decide what technology you want
    to use.

    There are several options that come to mind for Windows Forms development:

    - You can write a pure C / C++ Win32 application. This is a major pain in
    the ass, but is certainly possible. For this, go buy Charles Petzold's book,
    "Programming Windows". It's circa 1998 or so - be sure you get the Win32
    version, and not the newer C# versions. You'll probably need to end up
    buying this book anyway, regardless of which choice you end up making.

    - MFC is a good, and very popular choice. There are tons of books out there
    on this.

    - ATL is probably not the right choice these days - but I don't know the
    current status of this technology though, or where it sits in relationship
    to MFC.

    - You could go with an older Borland product (Delphi or C++ Builder). These
    both produce native code - no CLR requried.

    - You can use VB6, depending on what you're needing to do.

    - There are also a number of libraries out there for C++ you may want to
    look at. I've heard good things about qt, although I've never used it.

    It's all going to depend on what you're needing to do...

    --
    Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
    http://www.coversant.com/blogs/cmullins

    "herr" <> wrote in message
    news:...
    > Hi all,
    >
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly). I already have a small knowledge of c++, but don't really
    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys
    > just know tell me.
    >
    > Thanks for you help anyway!
    >
     
    Chris Mullins [MVP], Jul 7, 2007
    #10
  11. herr

    Ian Semmel Guest

    Learning to write C++ native windows apps won't do your career prospects any
    harm, as there are zillions of apps out there that will need maintenance and
    development for many years to come (COBOL programmers are still in demand).

    That said, be prepared for a rather steep learning curve.

    If you are going to write windows apps in C++, MFC is really your only
    choice in my opinion. MFC is a fairly thin C++ wrapper around the Windows
    API (which is 'C').

    C# does a lot of things for you that MFC doesn't (like garbage collect) and
    you are programming at a lower level.

    As far as learning MFC, go through the documentation before you go out and
    buy a book. There are lots of examples there.

    "herr" <> wrote in message
    news:...
    > Hi all,
    >
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly). I already have a small knowledge of c++, but don't really
    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys
    > just know tell me.
    >
    > Thanks for you help anyway!
    >
     
    Ian Semmel, Jul 7, 2007
    #11
  12. "herr" <> wrote:
    >> I am very skeptical on whether you will see significant
    >> performance improvements by that change.

    >
    > Then why is it that .net is not used by big software companies like Adobe,
    > Yahoo, Google and even Microsoft (even in Vista) ? I mean in Desktop
    > applications.


    I agree with Peter on this one.

    There are lots of reasons to not use .Net, but in most cases, performance
    isn't one of them. The number of apps in which "performance" is even an
    issue are really pretty few and far between these days.


    >> What GUI library do you want to code against ? Win32 API ? MFC ?
    >> wxWidgets ? Qt ?

    >
    > I don't know! What is the most used GUI library in the market? The best
    > for
    > windows XP / Vista platforms.


    If I were to guess, I would say the most popular, in terms of number of apps
    deployed, are (in order):
    - Pure Win32
    - MFC
    - VB6
    - .Net Windows Forms

    --
    Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
    http://www.coversant.com/blogs/cmullins
     
    Chris Mullins [MVP], Jul 7, 2007
    #12
  13. herr

    Guest Guest

    The size of an application can be determined many ways. You can write an app
    in a handful of lines that declares a huge array, or one with many lines,
    that uses little memory. We have a couple of systems that are in the 10K to
    50K code line range each that are extensions to a commercial GIS product.

    "herr" wrote:

    > Thanks guys for your valuable help.
    >
    > I have one other questions. What is the largest application written in .net?
    > (except for the Framework itself).
    >
    > "OD" <webmaster @ e-naxos dot com> wrote in message
    > news:mn.3cc67d77cb45103c.18651@e-naxosdotcom...
    > > Like some others in this thread I'm not sure you will see a big difference
    > > about performances..
    > >
    > > I recently wrote a complete test between C# and Delphi 2006, a kind of
    > > benchmark.
    > > Each code does exactly the same thing, one built on BDS 2006, the other on
    > > VS 2005. Each code has been written to respect each language (no unfair
    > > trick to give advantage to one language).
    > > Results are that the C# version is about 25 to 40 % faster than the Delphi
    > > 2006 one (depending on the computer, Intel processors giving best C#
    > > results than AMD ones, but always C# faster than Delphi).
    > >
    > > Memory management, strings, maths, file IO, I tested what most
    > > applications are supposed to do when they're working.
    > >
    > > So, as I'm knowing C++ is very near Delphi on the performance side (I
    > > tested this a couple of years ago), I think switching to C++ will decrease
    > > the overall performances of your application. And you'll lose all the
    > > benefit of the CLR and the object API of the framework. Win32 API is a
    > > mess...
    > >
    > > --
    > >
    > >
    > > OD___
    > > www.e-naxos.com
    > >
    > >

    >
    >
    >
     
    Guest, Jul 7, 2007
    #13
  14. "herr" <> wrote:
    > I have one other questions. What is the largest application written in
    > .net? (except for the Framework itself).


    Your decision to use or not use the .Net framework should NOT be based on
    what people in this group tell you.

    Figure out the requirements you need from a development platform, the look
    at the available platforms. This is how you should make your choice.

    For 95% (or more!) of applications today, .Net and/or Java are the right
    choice. These two offer a good balance of developer productivity, perfomant
    and reliable code, and a large talent pool to choose from for staffing and
    maintenance purposes. I personaly perfer .Net over Java, but if anyone
    starts telling you one is clearly better than the other, then they're just
    being silly.

    If you have specialized requirements, you may need a more specialized
    development environment. Evaluate your requirements, then choose a platform.

    --
    Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
    http://www.coversant.com/blogs/cmullins
     
    Chris Mullins [MVP], Jul 7, 2007
    #14
  15. Chris Mullins [MVP] wrote:
    > "herr" <> wrote:
    > The number of apps in which "performance" is even an
    > issue are really pretty few and far between these days.


    There a lot of apps with performance problems.

    But I agree that there are probably few apps where classic
    micro optimizing (like the compilers ability to optimize
    a certain for loop) is an issue.

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jul 8, 2007
    #15
  16. Performance problems that I run into today tend to be related to:
    - Architectural Flaws
    - Alrorithm Flaws

    It's almost never due to "C++ executes 1.2% faster than C# or Java".

    The problems tend to be:
    - "We're making 1500+ PLSQL calls, and we should be making 1".
    - "We're calling web services synchronously, and making the user wait."
    - "We're using distributed Transactions, and one of the participants is a
    State Agency running over a 14.4k modem, and they refuse to upgrade."

    It's really much more about design and engineering than actualy
    knitty-gritty code tuning ...

    --
    Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
    http://www.coversant.com/blogs/cmullins

    "Arne Vajhøj" <> wrote in message
    news:4690289b$0$90270$...
    > Chris Mullins [MVP] wrote:
    >> "herr" <> wrote:
    >> The number of apps in which "performance" is even an
    >> issue are really pretty few and far between these days.

    >
    > There a lot of apps with performance problems.
    >
    > But I agree that there are probably few apps where classic
    > micro optimizing (like the compilers ability to optimize
    > a certain for loop) is an issue.
    >
    > Arne
     
    Chris Mullins [MVP], Jul 8, 2007
    #16
  17. Chris Mullins [MVP] wrote:
    > Performance problems that I run into today tend to be related to:
    > - Architectural Flaws
    > - Alrorithm Flaws
    >
    > It's almost never due to "C++ executes 1.2% faster than C# or Java".
    >
    > The problems tend to be:
    > - "We're making 1500+ PLSQL calls, and we should be making 1".
    > - "We're calling web services synchronously, and making the user wait."
    > - "We're using distributed Transactions, and one of the participants is a
    > State Agency running over a 14.4k modem, and they refuse to upgrade."
    >
    > It's really much more about design and engineering than actualy
    > knitty-gritty code tuning ...


    Yep.

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jul 8, 2007
    #17
  18. herr

    count0 Guest

    herr wrote:
    > Hi all,
    >
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly). I already have a small knowledge of c++, but don't really
    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys just
    > know tell me.
    >


    Beside C# and native C++, there is a third way: C++/CLI, it has the
    best of both world. You can use Windows Forms for UI, and native code
    for algorithms, and use libraries like boost.
     
    count0, Jul 8, 2007
    #18
  19. On Sat, 7 Jul 2007 20:41:36 +0330, "herr" <> wrote:

    >Then why is it that .net is not used by big software companies like Adobe,
    >Yahoo, Google and even Microsoft (even in Vista) ? I mean in Desktop
    >applications.


    A couple of reasons
    1) They have a large library of perfectly functional code that has
    been tested for server al years, sometimes decades (like Adobe). There
    would be nothing to be gained in doing it from scratch
    2) Writing an application in .NET places a requirement for the
    customer to have the .NET framework. Forcing a customer to get this
    might not be something you want to do, especially if your software is
    a small utility
    3) Microsoft DO use .NET in their commercial products. Look at
    Microsoft CRM or Microsoft SQL Server 2005. Although, truth be told,
    SQL Server Management Studio is a *HOWLING DOG*

    --
    http://bytes.thinkersroom.com
     
    Rad [Visual C# MVP], Jul 8, 2007
    #19
  20. herr

    Tom Spink Guest

    herr wrote:

    > Hi all,
    >
    > For some reasons, I am moving away from managed c# (after using it for 3
    > years) and want to code my windows application in native C++ (perfomance
    > issues mainly). I already have a small knowledge of c++, but don't really
    > know what to read to learn writing advanced windows applications with it.
    > Any one can help me on my way to mastering c++ windows software writing?
    > I need some books, tutorials, online communities or what ever you guys
    > just know tell me.
    >
    > Thanks for you help anyway!


    Hi,

    IMHO, if you move to C++, you'll *lose* performance. This is because your
    code will become a lot more complex, it'll take longer to write, you'll
    discover a LOT more bugs and it will be hard to maintain.

    --
    Tom Spink
    University of Edinburgh
     
    Tom Spink, Jul 8, 2007
    #20
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M O J O

    TextBox - what is going wrong?

    M O J O, Jul 17, 2003, in forum: Microsoft Dot NET
    Replies:
    2
    Views:
    1,784
    Armin Zingler
    Jul 17, 2003
  2. Christopher Mosses

    Missing resource file folder - what is going on?

    Christopher Mosses, Sep 9, 2003, in forum: Microsoft Dot NET
    Replies:
    0
    Views:
    189
    Christopher Mosses
    Sep 9, 2003
  3. Keith Langer

    handle count keeps going up

    Keith Langer, Feb 11, 2004, in forum: Microsoft Dot NET
    Replies:
    3
    Views:
    229
    Klaus H. Probst
    Feb 13, 2004
  4. Ken Durden
    Replies:
    8
    Views:
    209
    Ken Durden
    Mar 15, 2004
  5. William Gower

    I am going crazy trying to find the error

    William Gower, Apr 23, 2004, in forum: Microsoft Dot NET
    Replies:
    1
    Views:
    175
    Cor Ligthert
    Apr 23, 2004
Loading...

Share This Page