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# - just making an observation

C# - just making an observation

Scheduled Pinned Locked Moved The Lounge
csharpc++javaphpdelphi
67 Posts 22 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.
  • M Marc Clifton

    Not to start a flame war, I am simply relating my recent personal experience... So, over the last couple of years, I've forayed into Ruby, PHP, very recently Java, and this coming from a background of C, C++, Pascal, Fortran, even some COBOL, and of course assembly language and some things I don't or don't want to remember (BASIC, LISP and Forth come to mind.) In terms of "modern" programming languages, and especially after my recent foray in Java (granted, version 7, so I'm not able to take advantage of lambdas) I have come to the conclusion that, frankly, C# is the most elegant and well crafted language I've ever worked with. Yeah, I remember the C# 1.0 days when I was cursing the lack of templates/generics and the idiocy of single inheritance, but no more. I find that code that I write in C# can be elegant, well crafted, expressive, and just a pleasure to write. I don't have that experience with other languages, except perhaps for F#, once I get into the rhythm of FP. Marc

    Imperative to Functional Programming Succinctly Higher Order Programming

    A Offline
    A Offline
    Andy Brummer
    wrote on last edited by
    #48

    I have to say I like writing my own apps in C# where I have complete control of all the code and data types. However when I'm customizing an existing CMS platform, the flexibility of duck typing means that I have much more flexibility and power to make smaller and less invasive changes, even if I have to code in PHP :sigh: .

    Curvature of the Mind now with 3D

    1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      I agree - but it does mean it's a lot harder to get leaky programs. Not impossible, but a lot harder. You remember what it was like before C# - morons not releasing memory until the whole PC judders to a halt... X|

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #49

      OriginalGriff wrote:

      a lot harder to get leaky programs

      I disagree. When you're programming in something that demands you manage your own memory, you tend to be very aware of leaks, and program more carefully. Many a C# programmer just assumes that it will be handled for them, and happily leave event handlers waving in the wind, preventing megabytes being cleaned up. Not me, of course, but others :-O

      PooperPig - Coming Soon

      OriginalGriffO 1 Reply Last reply
      0
      • M Marc Clifton

        Jeremy Falcon wrote:

        I wouldn't use it for apps that require heavy computation

        I ended up re-writing a very computationally heavy app in C# from C++ and was quite surprised that the C# version performed as well, if not better, than the C++ version. Now, granted, I was using STL heavily in C++ and in the C# version, I optimized my data structures so I wasn't manipulating vectors and queues all over the place. Which just goes to show, that performance is less a function of the language than it is of the skill of the programmer. :) It would be interested to see how the code would fare in C++ now with the new data structures, but I'm a bit wary of STL's performance. Marc

        Imperative to Functional Programming Succinctly Higher Order Programming

        J Offline
        J Offline
        Jeremy Falcon
        wrote on last edited by
        #50

        What you're saying is totally true, but I'd still wager an expert at C/C++/ASM could still write code to outperform most things in .NET. Of course, that's not practical for every last application as they'd have to be leery of frameworks used, if any, such as STL. I mean I can write a slow program in C easy as pie, and probably make something run better in classic VB if I really wanted to. Doesn't mean classic VB is the way to go for real time code. It doesn't mean VB is quicker. It means I'd know VB better in that instance. All that being said, I sure don't enjoy the slow compile times for C++. Especially with some of newer compiler tricks with C++ 11, such as generics. But it's still pretty zippy once compiled, and C/C++ will always be my go-to language for non-business apps.

        Jeremy Falcon

        1 Reply Last reply
        0
        • P Pete OHanlon

          Sorry, DataSets and DataTables need to go - they are the spawn of Beelzebub himself.

          J Offline
          J Offline
          Jeremy Falcon
          wrote on last edited by
          #51

          Pete O'Hanlon wrote:

          DataSets and DataTables

          Oh I like it when you talk dirty Pete.

          Jeremy Falcon

          1 Reply Last reply
          0
          • J Jeremy Falcon

            Well, to be fair, my comparison is really more about the bias I've built up against the typical VB crowd than the language itself. My first language was QBasic. I did a lot of classic VB. Never really had to use VB.NET all too much thankfully. It's a good tool for what it's intended for. But the main reason would be I just don't like the mentality of the typical VBer, which is lazy when it comes to learning how to effectively program. Not all VB devs are like that of course, but you get the idea. I have the same issue with FoxPro devs. I do think C#'s syntax is much cleaner and more elegant though. Which can lead to less typing errors. Which would be enough of a reason for me to choose C# over VB.NET, regardless of the typical VB crowd.

            Jeremy Falcon

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #52

            I think VBA is where you can lay the most blame, power users who work up through the VBA/Access route and keep going. No real discipline and no training. I started out that way and can understand the mind set, I do miss the formal training and grounding most really good devs must have. I started with macros in the late 80s then went down the path of Superbase till it got completely marginalised, spent a couple of years doing Turbo Pascal and then moved to VB. I would not willingly go back to VB.net but only for comfort and familiarity not because I dislike the language.

            Never underestimate the power of human stupidity RAH

            J 1 Reply Last reply
            0
            • M Marc Clifton

              _Josh_ wrote:

              return to c++

              Why am I reminded of Darth Vader? I've been doing some cpp11 work on the Beaglebone, it certainly has changed quite a bit and requires a lot of re-learning on my part. Marc

              Imperative to Functional Programming Succinctly Higher Order Programming

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #53

              Yup, pretty much a new language. Used well it is very elegant and I've found it refreshing and enjoyable.

              1 Reply Last reply
              0
              • M Marc Clifton

                Pete O'Hanlon wrote:

                DataSets and DataTables need to go - they are the spawn of Beelzebub himself.

                I find them (DataTables more so) quite convenient, though I can definitely imagine both simpler and more flexible approaches. As long as we're not treading into dreaded O-R-M territory. ;) Marc

                Imperative to Functional Programming Succinctly Higher Order Programming

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #54

                Friends don't let friends ORM.

                1 Reply Last reply
                0
                • L Lost User

                  OriginalGriff wrote:

                  a lot harder to get leaky programs

                  I disagree. When you're programming in something that demands you manage your own memory, you tend to be very aware of leaks, and program more carefully. Many a C# programmer just assumes that it will be handled for them, and happily leave event handlers waving in the wind, preventing megabytes being cleaned up. Not me, of course, but others :-O

                  PooperPig - Coming Soon

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #55

                  _Maxxx_ wrote:

                  When you're a competent programmer is programming in something that demands you manage your own memory, you tend to be very aware of leaks, and program more carefully.

                  Unfortunately, a large number of developers aren't competent, but think they are.

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    I would agree. Started with COBOL/FORTRAN, moved to Pascal and assembler, then to C and Assembler, and C++ and assembler. Then moved to C# five or six years ago. It's a coherent, well-thought-out language, that works very, very well indeed. My only criticism is that it's become easier to abuse it: var in particular, along with ArrayList and it's unpleasant ilk still remaining in the framework years after they should have been put to sleep as a mercy killing...along with teachers who think goto is something they should start off by teaching.:mad:

                    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                    B Offline
                    B Offline
                    BillWoodruff
                    wrote on last edited by
                    #56

                    I'd really enjoy hearing your thoughts on the down-side of 'var. thanks, Bill

                    «OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. »  Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."

                    OriginalGriffO 1 Reply Last reply
                    0
                    • M Marc Clifton

                      mikepwilson wrote:

                      Ugh. Is it really that good?

                      Yeah, I think so. :) I think if I were to identify the features that I find most useful, they would be lambda expressions, anonymous methods, the Func<> and Action<> classes, and reflection. I stay away from "var" and LINQ can be useful but I usually prefer using the extension methods directly instead. There's a lot I have dived into to fully appreciate -- covariance and contravariance, for example, but the type inference is damn impressive. Marc

                      Imperative to Functional Programming Succinctly Higher Order Programming

                      B Offline
                      B Offline
                      BillWoodruff
                      wrote on last edited by
                      #57

                      I'd really enjoy hearing your thoughts on the down-side of 'var. thanks, Bill

                      «OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. »  Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."

                      1 Reply Last reply
                      0
                      • M Marc Clifton

                        mikepwilson wrote:

                        Ugh. Is it really that good?

                        Yeah, I think so. :) I think if I were to identify the features that I find most useful, they would be lambda expressions, anonymous methods, the Func<> and Action<> classes, and reflection. I stay away from "var" and LINQ can be useful but I usually prefer using the extension methods directly instead. There's a lot I have dived into to fully appreciate -- covariance and contravariance, for example, but the type inference is damn impressive. Marc

                        Imperative to Functional Programming Succinctly Higher Order Programming

                        B Offline
                        B Offline
                        BillWoodruff
                        wrote on last edited by
                        #58

                        I'd really enjoy hearing your thoughts on the down-side of 'var. thanks, Bill

                        «OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. »  Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."

                        1 Reply Last reply
                        0
                        • B BillWoodruff

                          I'd really enjoy hearing your thoughts on the down-side of 'var. thanks, Bill

                          «OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. »  Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."

                          OriginalGriffO Offline
                          OriginalGriffO Offline
                          OriginalGriff
                          wrote on last edited by
                          #59

                          var is necessary - it's hard to see how Linq could work without it - and yes, it's still strongly typed. But...it's lazy, and it promotes code that is harder to read - for the sake of saving a couple of seconds when you write the code. For example, what is this code doing:

                          foreach (var item in myList)
                          {
                          ...
                          }

                          What type is item? I don't know - so I have to go elsewhere, find the definition of myList and work it out from there. And then I find that myList is declared as

                          var myList = myUserControlInADifferentAssembly.GetAll(userInput);

                          Which means I have to hunt that down as well. If instead the original coder had spent a couple of seconds writing:

                          foreach (UserProfile item in myList)
                          {
                          ...
                          }

                          My concentration wouldn't be broken and I could keep on with the flow of the code. I've seen people write this:

                          var i = 0;

                          Which is spectacularly pointless! There is also the fun that if a var is an IEnumerable returned by Linq methods, it isn't obvious that using it twice in successive lines of code will re-evaluate the whole enumerable again! At least if you have to write the type in full, you get a clue that probably what you should be doing is converting it to a List to evaluate the IEnumerable! You don't get that from var because "the system just handles it for you" - in the same way that untyped Dim works in VB, and that always comes back to bite people! :laugh: For example:

                              private string Showme(string s)
                                  {
                                  Console.WriteLine(s);
                                  return s;
                                  }
                          

                          If you do this:

                                  List list = new List() { "hello", "there", "Paul" };
                                  var enumerable = list.Where(s => s != "c").Select(s => Showme(s));
                                  Console.WriteLine("111111");
                                  string s1 = string.Join(";", enumerable);
                                  Console.WriteLine("222222");
                                  string s2 = string.Join(";", enumerable);
                                  Console.WriteLine("333333");
                          

                          It isn't obvious that you get this:

                          111111
                          hello
                          there
                          Paul
                          222222
                          hello
                          there
                          Paul
                          333333

                          But as a List it is evaluated once:

                                  List list = new List() { "hello", "there", "Paul" };
                                  var enumerable = list.Where(s => s != "c").Select(s => Showme(s)).ToList();
                                  Console.WriteLine("111111");
                                  string s1 = string.Joi
                          

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                          1 Reply Last reply
                          0
                          • A Albert Holguin

                            Ian Shlasko wrote:

                            Granted, Visual Studio has something to do with that... Haven't found a better IDE anywhere.

                            I will have to agree with that... I'm currently using Eclipse and it pisses me off on a regular basis.

                            Ian Shlasko wrote:

                            Unity is several kinds of awesome

                            As in Ubuntu's Unity? ...there has never been a slower interface ever developed for Linux! I actually stopped using Ubuntu because of Unity, now I use Mint (grant it, it's still based on Ubuntu but with a better interface).

                            I Offline
                            I Offline
                            Ian Shlasko
                            wrote on last edited by
                            #60

                            No no no no.... Unity 3D... The game development IDE...

                            Proud to have finally moved to the A-Ark. Which one are you in?
                            Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                            A 1 Reply Last reply
                            0
                            • P Pete OHanlon

                              Sorry, DataSets and DataTables need to go - they are the spawn of Beelzebub himself.

                              D Offline
                              D Offline
                              Dan Neely
                              wrote on last edited by
                              #61

                              I've got them blighting up one of my winform apps. The worst bit is there's not even a real DB involved. :omg: They were the easiest way to get something with databinding to a grid working (at this point I don't recall exactly what); and in prototype the version of the backend that read/processed the xml data files with tables was moderately faster and had significantly less total code than the one that read it all into classes and handled it that way. After the testers finished finding every edge case I'd overlooked when playing with it the latter was definitely no longer the case and the code was a massive cluster elephant as well. :doh:

                              Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                              1 Reply Last reply
                              0
                              • N Nemanja Trifunovic

                                Python? It is the slowest language I've ever worked with. And the benchmarks agree[^]: Python is up to 100 times slower than C++ and consumes up to four times more memory.

                                utf8-cpp

                                D Offline
                                D Offline
                                Dan Neely
                                wrote on last edited by
                                #62

                                Limit yourself to the subset that Cython[^] can compile to C? A friend of mine swears by it for the intermediate level code where the python prototype isn't fast enough but which isn't worth the heavy lifting needed to write in raw cache aware C to scavenge every last cpu cycle.

                                Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                                1 Reply Last reply
                                0
                                • I Ian Shlasko

                                  No no no no.... Unity 3D... The game development IDE...

                                  Proud to have finally moved to the A-Ark. Which one are you in?
                                  Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                  A Offline
                                  A Offline
                                  Albert Holguin
                                  wrote on last edited by
                                  #63

                                  Was wondering about that... it didn't make sense but I've also never heard of Unity 3D. :-O

                                  I 1 Reply Last reply
                                  0
                                  • A Albert Holguin

                                    Was wondering about that... it didn't make sense but I've also never heard of Unity 3D. :-O

                                    I Offline
                                    I Offline
                                    Ian Shlasko
                                    wrote on last edited by
                                    #64

                                    I haven't actually managed to make anything playable with it, but that's because I aimed a little too high... Like... Alpha Centauri... But I wrote a hex-map model and generator in C#/Unity, and it worked really well... It makes the graphical side really easy. One of these days I'll go back to that... But once I started planning out the AI, I realized I had designed it so complicated that it'd make Black and White look like Tetris by comparison.

                                    Proud to have finally moved to the A-Ark. Which one are you in?
                                    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                    1 Reply Last reply
                                    0
                                    • M Mycroft Holmes

                                      I think VBA is where you can lay the most blame, power users who work up through the VBA/Access route and keep going. No real discipline and no training. I started out that way and can understand the mind set, I do miss the formal training and grounding most really good devs must have. I started with macros in the late 80s then went down the path of Superbase till it got completely marginalised, spent a couple of years doing Turbo Pascal and then moved to VB. I would not willingly go back to VB.net but only for comfort and familiarity not because I dislike the language.

                                      Never underestimate the power of human stupidity RAH

                                      J Offline
                                      J Offline
                                      Jeremy Falcon
                                      wrote on last edited by
                                      #65

                                      Mycroft Holmes wrote:

                                      I think VBA is where you can lay the most blame, power users who work up through the VBA/Access route and keep going. No real discipline and no training. I started out that way and can understand the mind set, I do miss the formal training and grounding most really good devs must have.

                                      Oh man don't get me started on people using VBA inside Access to make a "real program". Totally get your point. But like you said, a good dev never stops learning and undergoes a lot of training about how things really work.

                                      Jeremy Falcon

                                      1 Reply Last reply
                                      0
                                      • D den2k88

                                        Aye. I'm strange, I know, but it is easier (and faster) to make communications between two native environments than managed-native. Also the easy access to COM, OCX and WinAPI provided with VB is somewhat lacking in C#. For projects that are no more than a boxed set of switches, VB6 is faster and easier. For project a little more complicated, .NET is bloated (to make I-don't-remember-which operation on a bitmap created in memory I would have to pin, extrapolate and use a ton of image converters between Windows.Media.Something.SomethingElse and Windows.Forms.Image forth and back. I solved wrapping GDI calls). Of course this is my opinion, and I'm far from being guru or expert. I just hope that M$ changes its mind and releases a VB7. Native, updated VB6.

                                        F Offline
                                        F Offline
                                        Forogar
                                        wrote on last edited by
                                        #66

                                        Quote:

                                        I just hope that M$ changes its mind and releases a VB7. Native, updated VB6.

                                        Bad news - it's not going to happen. Have you tried C++? I use that when I want the down to the metal, tiny, high-performance stuff (or native C if really pushed).

                                        - I would love to change the world, but they won’t give me the source code.

                                        1 Reply Last reply
                                        0
                                        • M Marc Clifton

                                          Not to start a flame war, I am simply relating my recent personal experience... So, over the last couple of years, I've forayed into Ruby, PHP, very recently Java, and this coming from a background of C, C++, Pascal, Fortran, even some COBOL, and of course assembly language and some things I don't or don't want to remember (BASIC, LISP and Forth come to mind.) In terms of "modern" programming languages, and especially after my recent foray in Java (granted, version 7, so I'm not able to take advantage of lambdas) I have come to the conclusion that, frankly, C# is the most elegant and well crafted language I've ever worked with. Yeah, I remember the C# 1.0 days when I was cursing the lack of templates/generics and the idiocy of single inheritance, but no more. I find that code that I write in C# can be elegant, well crafted, expressive, and just a pleasure to write. I don't have that experience with other languages, except perhaps for F#, once I get into the rhythm of FP. Marc

                                          Imperative to Functional Programming Succinctly Higher Order Programming

                                          D Offline
                                          D Offline
                                          dandy72
                                          wrote on last edited by
                                          #67

                                          (Old thread, but I'm just catching up now) I've earned a living as a C++ developer for a dozen years or so before moving on to C# over 7 years ago. I haven't looked back. Well, I have looked at some of my old C++ code a couple of times, and the thought I have every single time is that I don't miss it at all.

                                          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