Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C#: DON'T DO IT!!!

C#: DON'T DO IT!!!

Scheduled Pinned Locked Moved The Lounge
csharpc++winformsgraphicsdesign
39 Posts 25 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K khan

    Real men only use C/C++. Thanks to Microsoft for their language tools, but I can take care of my pointers, have done it before. Don't need any help on that. I believe that the only way .NET can survive is to write DLLs and Components in MFC/ATL and use them in .NET, and use .NET only as a front-end. That way you can satisfy stupid management that the code is written in C#/.NET. .NET is a complete waste of time. Just say NO to .NET! this is this.

    C Offline
    C Offline
    Chris Maunder
    wrote on last edited by
    #19

    That's great. You have fun with those pointers and memory leaks. In the meantime I'm going to concentrate on implementing functionality, not plumbing. cheers, Chris Maunder

    CodeProject.com : C++ MVP

    7 A 2 Replies Last reply
    0
    • K khan

      Real men only use C/C++. Thanks to Microsoft for their language tools, but I can take care of my pointers, have done it before. Don't need any help on that. I believe that the only way .NET can survive is to write DLLs and Components in MFC/ATL and use them in .NET, and use .NET only as a front-end. That way you can satisfy stupid management that the code is written in C#/.NET. .NET is a complete waste of time. Just say NO to .NET! this is this.

      S Offline
      S Offline
      S Senthil Kumar
      wrote on last edited by
      #20

      Well, when C/C++ came around, people would have been saying "Real men use assembly language", before that "Real men use machine language" and so on. If you get a platform that offers you a lot of power and ease of use, I'd say go with it *when it is appropriate*, instead of clinging on to something you know. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

      T 1 Reply Last reply
      0
      • M Marc Clifton

        Well, I have pretty much the following comment. The performance of any language is based equally, if not more so, on the skill of the programmer.

        Tom Ollar wrote:

        If you still think that C#/Framework is a real alternative then I'll leave the rest to BRUTAL EXPERIENCE - which will certainly take care of you...

        :laugh: :rolleyes: Marc VS2005 Tips & Tricks -- contributions welcome!

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #21

        I always suspected that Gosling is a retard... -- Pictures[^] from my Japan trip.

        1 Reply Last reply
        0
        • K khan

          Real men only use C/C++. Thanks to Microsoft for their language tools, but I can take care of my pointers, have done it before. Don't need any help on that. I believe that the only way .NET can survive is to write DLLs and Components in MFC/ATL and use them in .NET, and use .NET only as a front-end. That way you can satisfy stupid management that the code is written in C#/.NET. .NET is a complete waste of time. Just say NO to .NET! this is this.

          M Offline
          M Offline
          Matt Newman
          wrote on last edited by
          #22

          Real men don't use computers, they use there own brain power... Seriously though, while you take out the garbage I'll add functionality. I'm not saying unmanaged code is useless. Its a tool, tools are supposed to make our lives easier. Why use stone and chisel when you can use pencil and paper. Matt Newman
          Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots

          1 Reply Last reply
          0
          • J J Dunlap

            C# and the .NET core framework are fully capable of performing at a level that is competitive with that of native code. Initially I was worried that that would not be so, but the more I work with it, the more I find that, if you do things right, it is fully capable of good performance. But that "if" is very important. Firstly, C# lets you write code and design object-oriented libraries more easily, and at a higher level. This can cause many people to think less about the lower-level aspects of their application or component (performance, memory, etc) - until they have already coded it, and the performance problems hit them in the face. You have to keep those concerns in mind at all times - just as you would have to do when writing C++ code. You have to consider the performance implications of each design choice. Secondly, the .NET Framework is a different paradigm from what people coming from other backgrounds expect. To write performant code, you have to understand what is going on behind the scenes, and the dynamics of the framework that you are working with. But those dynamics are different from what people are used to. Each new way of doing things has both a good side and a bad side - and you have to consider both. I've seen even a lot of experts say things that demonstrate a lack of understanding of how the .NET framework works - simply because they have not yet had time to fully understand it. Now, that being said, there are, indeed, notable performance flaws in the non-core part of the .NET BCL, mainly having to do with native-to-managed interop wrappers. The .NET sockets implementation at least used to have scalability problems related to large numbers of transient connections, because of the way pinned objects were used. The Windows Forms wrapper suffers from a fair bit of slowness both because of interop and because the control classes derive from MarshalByRefObject, which does not benefit from a number of optimizations. The GDI+ wrapper would be much faster if it were not for the fact that interop is done in a very poor way performance-wise - buffer copies where they are not needed, poor use of caching, etc. Frank Hileman has considered abandoning the System.Drawing wrapper completely in favor of writing a custom GDI+ wrapper to get better performance by writing more efficient interop code. However, this is not a C# or core runtime problem, but a problem with the BCL, and even with the comparative slowness of the wrapper due to the way it is written, he has created a

            M Offline
            M Offline
            Matt Newman
            wrote on last edited by
            #23

            Well said, I have a question for you. What profiler do you use? I used the analysis tool that was in the Betas but I can't find it in the Pro version (guessing they put it in Team System) but I am looking for one. Matt Newman
            Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots

            J S 2 Replies Last reply
            0
            • C Chris Maunder

              That's great. You have fun with those pointers and memory leaks. In the meantime I'm going to concentrate on implementing functionality, not plumbing. cheers, Chris Maunder

              CodeProject.com : C++ MVP

              7 Offline
              7 Offline
              73Zeppelin
              wrote on last edited by
              #24

              Chris Maunder wrote:

              That's great. You have fun with those pointers and memory leaks. In the meantime I'm going to concentrate on implementing functionality, not plumbing.

              Did we code one too many lines of FORTRAN (yes, it deserves capital letters ;P ) Chris? Or, perhaps, you just weren't man enough to handle pointer arithmetic? ;)

              1 Reply Last reply
              0
              • T Tom Ollar

                I place this as a warning. If you are thinking about building a "rich client" on the C# .Net Platform - think again. It's slow. So slow that the guys in Redmond lapsed into stunned silence when I explained the kind of things my company does with C#. I heard this: "But what about performance?" "How's performance?" "You're using GDI+?" "So, how many objects get created with that code?" - in an admonishing tone, of course. and again - "What about performance?" These questions, coupled with the "Visual C++ - The Ultimate Language" poster on the second floor of building 41, kind of made me think that C# was a second class citizen, or worse... So just don't do it. Who cares about "managed code" and all that OOP crap - a 23mb Framework that's not installed ANYWHERE except stupid Windows Server 2003 and all that slow, slow, slow code simply isn't worth it. If you must have awesome UI use Flash and port it over to some PC emulator thingy - hell - ANYTHING is better than C#/Framework... Well that's it. You've been warned. If you still think that C#/Framework is a real alternative then I'll leave the rest to BRUTAL EXPERIENCE - which will certainly take care of you...

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #25

                Tom Ollar wrote:

                It's slow.

                Correction, the programmer is slow.... My code editor is 100% C#, and its still faster than VS.NET 2003/2005. xacc.ide-0.1-rc6 released! Download and screenshots

                1 Reply Last reply
                0
                • M Marc Clifton

                  Well, I have pretty much the following comment. The performance of any language is based equally, if not more so, on the skill of the programmer.

                  Tom Ollar wrote:

                  If you still think that C#/Framework is a real alternative then I'll leave the rest to BRUTAL EXPERIENCE - which will certainly take care of you...

                  :laugh: :rolleyes: Marc VS2005 Tips & Tricks -- contributions welcome!

                  R Offline
                  R Offline
                  Roger Alsing 0
                  wrote on last edited by
                  #26

                  On his defence, if its GDI+ that is his problem , he's quite right about performance problems. gdi+ is 100% software rendered and slow as crap compared to real native gdi. (even if people claim gdi+ to be a wrapper over native gdi which I would claim it isnt since it doesnt allocate gdi resources in your process (ok, it does in some cases eg if you get a hdc or hfont etc) and yes , i know its very possible to get decent rendering speeds with hardcore smart redraw optimizations in gdi+. (and Ive seen vg.net) but you can get better rendering speed in native gdi w/o any optimizations at all. So I will agree with him and say that gdi+ is slow as crap. but on the other hand , that has nothing to do with c# :)

                  J 1 Reply Last reply
                  0
                  • M Matt Newman

                    Well said, I have a question for you. What profiler do you use? I used the analysis tool that was in the Betas but I can't find it in the Pro version (guessing they put it in Team System) but I am looking for one. Matt Newman
                    Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots

                    J Offline
                    J Offline
                    J Dunlap
                    wrote on last edited by
                    #27

                    For memory-related profiling, I've always used the CLR Profiler[^]. It has a whole bunch of memory-related graphs and statistics. For CPU-usage-related profiling, at first I just used timing code inserted at various points. Then I started using NProf[^] (which seems to be perpetually in 'alpha' stage :rolleyes: ). It gives you basic statistics related to performance each method in your application (time taken for each is given as a percent of the overall time). Then I started using the VS2005 profiler, which is very convenient and pretty good as well - but now that I've upgraded to the RTM it's gone. :(( I've heard that the Ants Profiler[^] is good, so I think I'm going to check it out.

                    J 1 Reply Last reply
                    0
                    • R Roger Alsing 0

                      On his defence, if its GDI+ that is his problem , he's quite right about performance problems. gdi+ is 100% software rendered and slow as crap compared to real native gdi. (even if people claim gdi+ to be a wrapper over native gdi which I would claim it isnt since it doesnt allocate gdi resources in your process (ok, it does in some cases eg if you get a hdc or hfont etc) and yes , i know its very possible to get decent rendering speeds with hardcore smart redraw optimizations in gdi+. (and Ive seen vg.net) but you can get better rendering speed in native gdi w/o any optimizations at all. So I will agree with him and say that gdi+ is slow as crap. but on the other hand , that has nothing to do with c# :)

                      J Offline
                      J Offline
                      J Dunlap
                      wrote on last edited by
                      #28

                      Yes - GDI+ is not hardware accelerated, and then on top of that, the wrapper is poor too. I wish there was something better out there for .NET - I have my hopes up that if a wrapper could be created for AGG, it would be at least a fair bit faster. But with optimizations such as updating only the areas of the screen that have changed, GDI+ can do pretty much anything you need it to in the way of normal UIs (i.e. not complex animation) - even if those UIs are complex. The problem is in the implementation - the optimizations can be time-consuming and complex to do. I think if Tom had talked about the problems of GDI+ or the System.Drawing wrapper, he would have gotten a better response - assuming that the drawing side of things was what he was referring to - but I don't know for sure if it was. I think all of us who have worked with System.Drawing have been pained at one point or another with speed problems.

                      1 Reply Last reply
                      0
                      • Steve EcholsS Steve Echols

                        I agree about the pointers. I can deal with those myself, and when I don't, I get a nice, easy to interpret GPF message ;) which indicates I need more coffee. Maybe it's a power trip, but I'd rather have the option of shooting my foot off with pointers, than having someone collect my garbage. It makes you more responsible, so you have to think about what you're doing. As far as writing components in MFC/ATL and using them in .NET, that's essentially going back to the VB6 days. C#/VB.NET is the next evolution of VB6, in my mind. I can't help thinking C# was created so people would think "oh, it's not BASIC" or "I know C++ now", just to satisfy management and curious end-users. Wrong! Suck it up and learn C++! P.S. .NET is too sloooow! Scott me up beamy!

                        J Offline
                        J Offline
                        Jack Puppy
                        wrote on last edited by
                        #29

                        Steve Echols wrote:

                        I agree about the pointers. I can deal with those myself, and when I don't, I get a nice, easy to interpret GPF message which indicates I need more coffee. Maybe it's a power trip, but I'd rather have the option of shooting my foot off with pointers, than having someone collect my garbage. It makes you more responsible, so you have to think about what you're doing.

                        Interesting. Have you tried using auto_ptr or one of the boost _ptrs? "When you know you're going to eat crow, it's best to eat it while it's still warm." - Reader's Digest

                        1 Reply Last reply
                        0
                        • C Chris Maunder

                          That's great. You have fun with those pointers and memory leaks. In the meantime I'm going to concentrate on implementing functionality, not plumbing. cheers, Chris Maunder

                          CodeProject.com : C++ MVP

                          A Offline
                          A Offline
                          Anna Jayne Metcalfe
                          wrote on last edited by
                          #30

                          Pointers and memory leaks are pretty easy to avoid if you design in the right way. I can't remember the last time I was bitten by either of them. The real nasties are multithread synchonisation issues, and no framework can insulate you from them totally... Speaking personally, .NET would be great if it offered us what we wanted. Unfortunately, it doesn't right now, and I can't see that changing anytime soon - if at all. The discussions we had with MS people at the VS2005 launch event in London last week confirmed that. Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                          T 1 Reply Last reply
                          0
                          • K khan

                            Real men only use C/C++. Thanks to Microsoft for their language tools, but I can take care of my pointers, have done it before. Don't need any help on that. I believe that the only way .NET can survive is to write DLLs and Components in MFC/ATL and use them in .NET, and use .NET only as a front-end. That way you can satisfy stupid management that the code is written in C#/.NET. .NET is a complete waste of time. Just say NO to .NET! this is this.

                            L Offline
                            L Offline
                            Le centriste
                            wrote on last edited by
                            #31

                            No, real men use assembly language (not to be confused with .NET assembly). It is a well-known fact that C/C++ is for wussies. -------- "I say no to drugs, but they don't listen." - Marilyn Manson

                            1 Reply Last reply
                            0
                            • M Matt Newman

                              Well said, I have a question for you. What profiler do you use? I used the analysis tool that was in the Betas but I can't find it in the Pro version (guessing they put it in Team System) but I am looking for one. Matt Newman
                              Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots

                              S Offline
                              S Offline
                              S Senthil Kumar
                              wrote on last edited by
                              #32

                              Did you try using DevPartner[^]? It's free, integrates with VS .NET and worked pretty well for me. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

                              1 Reply Last reply
                              0
                              • K khan

                                Real men only use C/C++. Thanks to Microsoft for their language tools, but I can take care of my pointers, have done it before. Don't need any help on that. I believe that the only way .NET can survive is to write DLLs and Components in MFC/ATL and use them in .NET, and use .NET only as a front-end. That way you can satisfy stupid management that the code is written in C#/.NET. .NET is a complete waste of time. Just say NO to .NET! this is this.

                                J Offline
                                J Offline
                                Judah Gabriel Himango
                                wrote on last edited by
                                #33

                                Pointers are available in C#. C# people just don't use them too often when a better alternative (garbage collected "pointers"; references) is there. And let's not get elitist here; elitism already plagues too many of us, especially when it comes to languages and operating systems. To be elitist and say garbage collection is not for real men would be hypocritical; let's not forget our beloved COM uses reference counting and Boost makes extensive use of garbage collected smart pointers. We also should not forget that not too long ago was this same argument posted, only saying that C++ is for wussies, real men code in C. Or Assembler. Heck, maybe we ought to just revert back to punch cards.

                                Tech, life, family, faith: Give me a visit. I'm currently blogging about: Bought a House! Judah Himango

                                1 Reply Last reply
                                0
                                • J J Dunlap

                                  For memory-related profiling, I've always used the CLR Profiler[^]. It has a whole bunch of memory-related graphs and statistics. For CPU-usage-related profiling, at first I just used timing code inserted at various points. Then I started using NProf[^] (which seems to be perpetually in 'alpha' stage :rolleyes: ). It gives you basic statistics related to performance each method in your application (time taken for each is given as a percent of the overall time). Then I started using the VS2005 profiler, which is very convenient and pretty good as well - but now that I've upgraded to the RTM it's gone. :(( I've heard that the Ants Profiler[^] is good, so I think I'm going to check it out.

                                  J Offline
                                  J Offline
                                  Judah Gabriel Himango
                                  wrote on last edited by
                                  #34

                                  We use Ants here. Excellent profiler, you'll be spoiled by it. :)

                                  Tech, life, family, faith: Give me a visit. I'm currently blogging about: Bought a House! Judah Himango

                                  1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    Tom Ollar wrote:

                                    If you are thinking about building a "rich client" on the C# .Net Platform - think again.

                                    I have done, sorry. My app does image processing, captures images from still and video cameras, processes video as well, etc.

                                    Tom Ollar wrote:

                                    So slow that the guys in Redmond lapsed into stunned silence when I explained the kind of things my company does with C#.

                                    Like what ? Seriously, managed DirectX runs at 95% of the speed of C++ DirectX. All C# code gets compiled the first time it gets run, then it's native code. I'm interested to know what application you've written that cannot be optimised to work with C#. I would still be an advocate for C# being one possible tool, and C++ being a better one in some cases. Yours may well be a case for C++ as the best tool. I doubt, and my experience disproves, the idea that

                                    Tom Ollar wrote:

                                    Who cares about "managed code" and all that OOP crap - a 23mb Framework that's not installed ANYWHERE except stupid Windows Server 2003 and all that slow, slow, slow code simply isn't worth it.

                                    is a reasonable statement. Wait a minute - you're saying that OOP is a waste of time ? Christian Graus - Microsoft MVP - C++

                                    J Offline
                                    J Offline
                                    Jon Hulatt
                                    wrote on last edited by
                                    #35

                                    Christian Graus wrote:

                                    I have done, sorry. My app does image processing, captures images from still and video cameras, processes video as well, etc.

                                    Hi Christian, OOI, that sounds like directshow, which isn't a part of managed directx. How did you do it? COM Interop? or wrap the (C++) directshow stuff in managed c++ ? I'm tasked with extended a C++/directshow DV processing app I wrote a while ago. I'd like to start from a clean sheet and do it in C#, and would be interested to know if you already spent some time tackling these problems Cheeers Jon PS. The nipple pointing stick thing on my laptop keyboard has successfully been repaired now, I'd like to thank you for your sympathy and support the other week when the disaster struck.

                                    using System.Beer;

                                    C 1 Reply Last reply
                                    0
                                    • A Anna Jayne Metcalfe

                                      Pointers and memory leaks are pretty easy to avoid if you design in the right way. I can't remember the last time I was bitten by either of them. The real nasties are multithread synchonisation issues, and no framework can insulate you from them totally... Speaking personally, .NET would be great if it offered us what we wanted. Unfortunately, it doesn't right now, and I can't see that changing anytime soon - if at all. The discussions we had with MS people at the VS2005 launch event in London last week confirmed that. Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                                      T Offline
                                      T Offline
                                      TheGreatAndPowerfulOz
                                      wrote on last edited by
                                      #36

                                      Anna-Jayne Metcalfe wrote:

                                      Speaking personally, .NET would be great if it offered us what we wanted. Unfortunately, it doesn't right now, and I can't see that changing anytime soon - if at all. The discussions we had with MS people at the VS2005 launch event in London last week confirmed that.

                                      Out of curiosity, what doesn't it offer? Don't worry, I don't have any .NET/C# bent either way. I'm just wondering and hoping to learn something.

                                      A 1 Reply Last reply
                                      0
                                      • S S Senthil Kumar

                                        Well, when C/C++ came around, people would have been saying "Real men use assembly language", before that "Real men use machine language" and so on. If you get a platform that offers you a lot of power and ease of use, I'd say go with it *when it is appropriate*, instead of clinging on to something you know. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

                                        T Offline
                                        T Offline
                                        TheGreatAndPowerfulOz
                                        wrote on last edited by
                                        #37

                                        S. Senthil Kumar wrote:

                                        Well, when C/C++ came around, people would have been saying "Real men use assembly language", before that "Real men use machine language" and so on.

                                        Actually, assembly language programmers were only too happy to jump onto the C/C++ bandwagon. They were only too happy to leave that level to those who really knew what they were doing and had the requisite expertise. The same will be true of a move from RAW C/C++ to .NET C#/C++/J#/VB/COBOL/WHATEVER. There are different kinds of programmers and there are different kinds and levels of skill. Use the tool you feel comfortable with and that is right for the job.

                                        1 Reply Last reply
                                        0
                                        • J Jon Hulatt

                                          Christian Graus wrote:

                                          I have done, sorry. My app does image processing, captures images from still and video cameras, processes video as well, etc.

                                          Hi Christian, OOI, that sounds like directshow, which isn't a part of managed directx. How did you do it? COM Interop? or wrap the (C++) directshow stuff in managed c++ ? I'm tasked with extended a C++/directshow DV processing app I wrote a while ago. I'd like to start from a clean sheet and do it in C#, and would be interested to know if you already spent some time tackling these problems Cheeers Jon PS. The nipple pointing stick thing on my laptop keyboard has successfully been repaired now, I'd like to thank you for your sympathy and support the other week when the disaster struck.

                                          using System.Beer;

                                          C Offline
                                          C Offline
                                          Christian Graus
                                          wrote on last edited by
                                          #38

                                          Jon Hulatt wrote:

                                          OOI, that sounds like directshow, which isn't a part of managed directx. How did you do it? COM Interop? or wrap the (C++) directshow stuff in managed c++ ?

                                          *blush* at this point it doesn't yet capture the video 'live', and it does the still stuff via an SDK that comes with Canon cameras.

                                          Jon Hulatt wrote:

                                          I'm tasked with extended a C++/directshow DV processing app I wrote a while ago. I'd like to start from a clean sheet and do it in C#, and would be interested to know if you already spent some time tackling these problems

                                          There are articles on CP on using DirectShow via COM interop, which is how I presume I'll go when I move from processing mpgs to capturing the video live. Christian Graus - Microsoft MVP - C++

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups