none
discussion, opinions on when C#'s the right tool for the job Versus not

    Diskusi Umum

  • Hello all,

    I have to say that I've been following .NET for years now.  I love it, and I'm planning  to base an open-source project over at CodePlex on it (written in C# hence why this discussion is going in here.)  I have been told by a few people that the .NET Framework's not the solution for everything.  Based on your personal experiences, what does the community believe are the best and worst places to apply C# and the .NET Framework?  Like for instance, I have a bunch of networking ideas up my sleeve, and I think that .NET would be a good place to implement them.  And another thing, I have also been told by some people that being a pure .NET will-be hobbiest developer means that I care not about cross platform compatibility.  This is not true, so while we are at it, would anyone mind touching on their experiences with the Mono Framework, WCF being connected to from OSs like Mac, Linux, and iOS devices?  I was told by one of my contacts that WCF is all bad news.   He said that it's just going to bring trouble for me later.  I look forward to your input very much, for I'd like to clear my reputation as an anti-cross-platform will-be developer.  (remember, to me, Microsoft will always be superior, and I will always put your technologies first in my projects, career choices, and times for tinkering and fooling around when I get bored.) 

    28 Januari 2012 6:01

Semua Balasan

  • I have been using VB4 till C# today. Microsoft Technology can almost done everything for me.

    chanmm


    chanmm
    30 Januari 2012 1:04
  • That is very interesting and also very good.  I do wonder though, have you had problems with porting from the .net framework to Mono and stuff like that?  Or like my contact said, is WCF bad news when it comes to other operating systems trying to connect to web services written for it? 
    30 Januari 2012 2:09
  • Hi,

    just some points: A WCF solution, build correctly, brings no problems regarding connectivity. In fact it is much easier to create and consume services than I saw in any other language. The great advantage is, that you can configure a lot through config files!

    But of course: You need to understand what you are doing!

    So I am interesting in knowing why "WCF is bad news"?

    I do not have any experience with Mono because I never needed it so far. Of course: My applications are targeting Windows. But that is not a disadvantage in my eyes, because I am targeting windows and I am using windows specific stuff. It is simply: If you application should be able to run anywhere, then you cannot use specific things (And this is often required!)

    With kind regards,

    Konrad

     

    30 Januari 2012 12:50
  • Well again, all of this input has helped, and I would not be surprised if this discussion branches off in so many ways.  I will try to explain my contacts twisted thoughts of WCF if I can even make sense of it.  He abandoned Windows since Windows 7, insulting Microsoft on so many levels, calling the operating system memory intensive (even going so far as to say of Windows server: "I hate Windows server because it is a GUI-based, and memory intensive operating system".)  Then when I told him about what I code-name the Jenks Project, (a series of applications for Contact management, and other server-based WCF service oriented networking functionality for the community specifically to be in first use by the community I run), he tells me that I'm going to have bad luck with cross-platformability and connecting my clients who are running via mono to the WCF services running on the server.  That's why I was curious about Mono experience.  and that's not all either.  And what is even more impressive is the fact that people are actually trying to make operating system frameworks out of C# (think COSMOS.)  Personally, I believe that .net should have a higher place in the spectrum of programming languages, and that it should be able to go as low in the OS as C++ and those languages.  That's why it surprises me that Microsoft hasn't latched onto the COSMOS project. 
    30 Januari 2012 16:25
  • Hi,

    it is normal, that people have their likes and dislikes. If someone does not like Windows: Ok. That is nothing that botheres me.

    But you could tell your friend, that he should simply shut up if he has no clue what he is talking about. It is possible to install windows server without all the GUI stuff.

    And you can of course build service oriented application using the standards defined by w3c. The client does not care what technology you use behind. WCF is just a library. Of course you can write some clients in mono. But you build a service. Anyone can get the description and use it, too. So maybe someone wants to build a java client or so?

    But of course - you could take Linux instead of Windows. And Java instead of C#/.Net. But then you also have to use an application server e.g. JBoss. Linux + JBoss should use more memory than windows server does.

    But all this discussion is not really on topic in my eyes. One important point might be quick development. WCF helps to write code for soa much easier.

    With kind regards,

    Konrad

    30 Januari 2012 17:00
  • Yeah, that's what I thought.  It seems that with C# in general, you write less code to get big things done.  And C# is the most awesome language in the world, and that's why I personally think that it should have the same powers as C++ and that it should be able to be used in places where normally the OS forces you to write in C++.  I wonder if Microsoft themselves will one day see the power of their invention and make .net be the leader in the world of Windows instead of just something that runs on top of the operating system.  (again, think COSMOS.)  But back to what you were saying about WCF, not only is it good, but doesn't it help with bandwidth reduction usage in that it is just more agile than the rest of the service methods of connecting out there?  Have you noticed a particular reduction in bandwidth consumed on your servers that have WCF services running on them versus those in say, Java or something like that?  And speaking of performance benefits, how about ASP.net Versus PHP?  I mention ASP.net because I have been asked many times to name benefits why the .net framework and C# are better than languages like C/C++.  What would you say in answer to that question? 
    30 Januari 2012 18:23
  • Hi,

    my opinion is, that the language does not matter. C++, C#, Java, Objective-C, ... They are not really different from a language perspective.

    The big difference are the Frameworks. So you can compare the possibilities these languages offer with their frameworks.

    C++ is the tool, where I think that you can get the most out. You get the managed world and unmanaged world. You can get libraries for everything. But that comes with a great complexity and you should think twice if you need/want that. (I decided that I do not want jt ... And I came from C/C++ starting with turbo c 2.0 when no c++ was available from borland.)

    So lets have a look at Java. The SE comes with a limited framework. But for enterprise applications you can get the EE which comes with the full might of the application servers. I personaly find that oversized. But everything has pros and cons.

    .Net with c#/vb has a big framework and you can access wondows interfaces through pinvoke if required. Great thing! My decision was easy but that was just a personal opinion.

    ASP.net is just a part of the .net framework. I like that much more than php but maybe i have a wrong view on php. For me it is just some scripting language where people mix html with their scripts. So i will stop that talk directly, because i have no idea if my view i got when php was published first is still correct.

    One advantage I see with ASP.net is: it is just a small part. So we have one solution with one or more libraries (data layer, business layer) and other required projects e.g. A windows service or some windows applications. And of course the Asp.net project. So we do not have to create things twice.

    With kind regards,

    Konrad

    31 Januari 2012 8:58
  • You have very good input.  Now you do not seem to regret leaving the world of C++ for that of C#.  have you ever run across something that was impossible to write in C# where you had to use C++ due to lack of .NET support?  (think MAPI, for instance.) 
    31 Januari 2012 16:15
  • I never came across something where I had to use C++ so far. But there are some points where you can get into such a situation.

    But these situations are always deep inside windows e.g. drivers or hooking up inside the system (global hooks). All I had to do so far was all possible with pinvoke so I had no real trouble until now.

    (I am an application developer so it is uncommon to go deep into the system. But if you want to write drivers or something like that, then you might need c++.)

    With kind regards,

    Konrad

    31 Januari 2012 16:31
  • That is most interesting.  And that's what makes me wonder where the future for .NET developers will be in the next generation of Windows.  Do you think it will be as easy as microsoft says it will be for .NET to be in both the metro and non-metro world?  I hope so, since I'm just learning C#, and I really don't want to have to give up what I've got so far and am still going on.  I would hate to see .NET get a lower status, you know? 
    31 Januari 2012 17:04
  • Now you got to an interesting point. I am not sure, what to expect of the future.

    In my eyes the switch to a managed environment brought a big advantage to developers. A large list of "common errors" are gone, e.g. buffer overflows, memory leaks, ... This is a big advantage and I doubt that this will go away in application development. (So all major development platforms have this now: .Net, Java, Objective-C)

    My personal view regarding windows 8 is, that Microsoft found out, that it is not that good to use .Net in areas where you have to go into the system. But this is a complete guess now!

    So I do not see any problem in this point.

    I think it is much harder regarding SIlverlight. That is THE platform for Windows Phone and now Microsoft commits to HTML5. So it might be possible that the development for windows phones might change a lot soon. And the hard part is, that it already changed from Windows Mobile 6 to Windows Phone 7!

    But these changes will always happen. But once you are a developer, you will be able to switch quite fast. But I would always recommend to concentrate on one technology and do not panic! Markets are slow! Even if there will be a replacement of .Net - It will take ages till .Net is gone!

    With kind regards,

    Konrad

    31 Januari 2012 17:23
  • Interesting viewpoints there.  I somehow though don't think that it would be practical, neither monitarily nor legistically, for Microsoft to kill .NET off in the next generation of Windows since so many developers rely on it for both the open source and comercial markets.  And speaking of Windows Mobile 6, my friend used to use that, and everyone in the blind community are pretty furious with microsoft right now considering they don't have any accessibility in the new version of their mobile OS.  But anyway, that's neither here nor there.  So as a developer, do you think that you will be touting the HTML 5 thingo, or do you think that you will use the .NET framework for metro development? 
    31 Januari 2012 17:55
  • .NET for Metro Apps.

    http://msdn.microsoft.com/en-us/library/windows/apps/br230302(v=VS.85).aspx

    I seriously doubt that .NET is going out of style anytime soon.

    Rudy   =8^D


    Mark the best replies as answers. "Fooling computers since 1971."

    http://thesharpercoder.blogspot.com/

    01 Februari 2012 0:30
    Moderator
  • I guess you're right.  Like I said, it would be stupid for them to change it at this point. 
    26 Februari 2012 6:03
  • Hello,

    In my mind a developer should learn few languages and platforms but not because Microsoft may abandon it but because I think that a developer's life is all about learning and it's part of our job;  sometimes it's just a requirement or demanded by your clients.

    In my opinion it isn't probable for Microsoft to abandon the .NET framework in the next decade and why ?

    1. It provides a convenient wrapper over the Win32 APIs, it facilitate and make it easy for developers around the world to create Windows applications.
    2. Metro style apps are just another way for developing applications and the .NET is fully supported.
    3. There are so many .NET languages right now that are available and so many devices that supports it, you don't abandon a success.
    4. It is more then just a framework for developers, it is a framework that Microsoft uses to create and support their own products.
    5. There's a very active development around it and there are few versions for the .NET framework, languages and technologies such as WCF, WPF, ASP.NET, ADO.NET and in my opinion it's not something they will want to stop that early.

    I think that the experience of every developer regardless to language and platform he was working on in the past is a treasure gold for the next project, it's all about perspectives. ;)

    I find it really silly to compare languages and platforms, you are payed to get the job done in minimum time and do that to the best of your ability using whatever language or platform, let the marketing analysts compare things while you, you get the job done.


    Eyal (http://shilony.net), Regards.


    26 Februari 2012 17:47
    Moderator
  • I agree that it is, but I have to admit that I have been falling for that kind of silliness because like I said, my contact over here had me very confused and since he said that frankly, in his opinion, .net sucks, I was just curious why anyone could say such an awful thing!  Now you mention development as a professional career.  But what about for open source projects?  Is .net the way to go for that? 
    26 Februari 2012 18:17
  • Open Source has nothing to do with the platform and language you use to develop software as long as the company does not restrict you to do so and in this case Microsoft changed a lot to put up with the Open Source community.

    Here are few things.

    1. Having C#, the BCL and the CLI specifications registered by the ECMA and ISO.
    2. Having a Microsoft Community Promise.
    3. Having two open source licenses that are approved by OSI.
    4. Creating CodePlex and the Visual Studio Gallery. ;)

    You can read more about it in the Mono project here and you can use Mono. ;)

    People that are either narrow-minded, don't know the technology or just hate Microsoft will most likely say things that they don't understand themselves. :)


    Eyal (http://shilony.net), Regards.


    26 Februari 2012 19:19
    Moderator
  • I would be happier if .NET could be faster than it currently is

    I'm all for it to be faster but where and what exactly ? under what terms and conditions ? comparing to what technology, platform or language ?

    It's like saying that you want a car to be faster yet keeping the lengthy and important explanation to yourself.


    Eyal (http://shilony.net), Regards.

    26 Februari 2012 22:31
    Moderator
  • Did you think that app was slow or something? 
    03 April 2012 5:10
  • I'm a big C# fan too, but sometimes get a bit discouraged when I run into COM issues.  Yes C++ is bigger, faster, et. al. and it's more confusing to me and requires a bit too much of a learning curve and God forbid it's antiquated pointer char.  => instead of a . 

    I guess you get used to what you use, but C# is just about everything I've ever needed.  Of course we know the ubiquitous Javascript is everywhere so it pays to learn that for web based stuff. 

    With the advent of multicore CPUs and the new TASK and Asynchronous classes in C# it could be argued that speed isn't that much of an issue any more unless of course you're doing real time capture of data (very fast or a lot of it)...  I'm sticking with C# personally...


    JP Cowboy Coders Unite!

    03 April 2012 5:18
  • Well, I disagree simply because there are things that C# can do better due to the ability of the JIT to optimize on the fly and there are thing that C++ can do better or worst which in both cases it depends a lot on the experience of the programmer with the language and platform.

    I see how real time computing or micro optimization can be a problem but I really can't see how one can claim that outside to web envrionment C# is not as performanent as C++ without any real facts, I respect your experience but I don't think it's objective enough to make a conclusion.

    I claim you to say otherwise.. haha ;)


    Eyal (http://shilony.net), Regards.


    05 April 2012 2:57
    Moderator
  • Did you think that app was slow or something? 

    my tool is much faster and more comprehensive than the add/remove panel

    i estimate it to be at least 100x faster if not more

    So you wrote it in C++ and C# and it performs x100 faster by what kind of estimation ?

    EDIT: Let's assume it is indeed x100 times faster how much time it takes to perform the operation for say a million of records ? is the time that meaningful to even say that there's a real difference ?

    I'm just trying to understand the numbers. ;)


    Eyal (http://shilony.net), Regards.

    05 April 2012 4:44
    Moderator
  • Hello all,

    I have been told by a few people that the .NET Framework's not the solution for everything. 

    That is true, you cannot make for instance babies with it, for that are better ways.

    Maybe you are laughing but that is not only for that. C# is a general tool, you can use it for many things, but mostly there are for everything better tools. The case is then what is the most productive tool and then C# (and its sibling VB) will often win the course. 

    Productivity means more than speed, also how reliable is it, how much chance there is it will be continua and then an endless quantity of sentences like that, in that part C# scores high.  


    Success
    Cor

    05 April 2012 6:44
  • Hi Cor,

    I agree to your view, but I have to disagree in one point:

    public class Baby
    {
      public DateTime BirthDate { get; private set; }
      public string Name { get; private set; }
      public Baby (string name)
      {
        Thread.Sleep(9 * 30 * 24 * 60 * 60 * 1000); // Wait 9 month!
        Name = name;
        BirthDate = DateTime.Now;
      }
    }

    I think with that solution you can make babies in C# - but it might not be as much fun as other ways .. but these c# babies make much less work :)

    With kind regards,

    Konrad

    05 April 2012 7:14
  • Really Konrad, that's just absurd!!

    ...

    ...

    People don't name their babies when they're conceived; they name them shortly before or shortly after they're born.

    05 April 2012 15:15
  • But the constructor is called only after the object is created. ;p


    Eyal (http://shilony.net), Regards.

    05 April 2012 15:21
    Moderator
  • Oh wow, guys.  I find that really funny, actually.  it illustrates the point that you were trying to make very well. 
    05 April 2012 15:22
  • But the constructor is called only after the object is created. ;p

    So things brings us to the question of is a Baby "created" at conception or birth.

    C#, addressing the most potent sociological and political issues of the day.

    05 April 2012 15:26
  • I agree fully to that. I should have choosen a better implementation regarding the name. And the Thread.Sleep is also not exact enough ....

    But at least I hope that I was able to put a smile on your faces with my code example :)

    I wish you happy eastern (in case you celebrate that, too) - in germany we have a long weekend now with 2 days public holiday (friday and monday).

    With kind regards,

    Konrad

    05 April 2012 15:55
  • But the constructor is called only after the object is created. ;p

    So things brings us to the question of is a Baby "created" at conception or birth.

    C#, addressing the most potent sociological and political issues of the day.

    Haha ...

    Konrad, you sure did. :)


    Eyal (http://shilony.net), Regards.

    05 April 2012 17:00
    Moderator
  • So which one is it?  Baby created at instanciation or birth.  C# seems to tell us baby with no name is created at instanciation.

    JP Cowboy Coders Unite!

    05 April 2012 17:11
  • So which one is it?  Baby created at instanciation or birth.  C# seems to tell us baby with no name is created at instanciation.

    JP Cowboy Coders Unite!

    C# isn't telling us anything.  The code that Konrad wrote would indicate such, but one could easily write code that indicated otherwise.  It's a language, for which a great many things can be expressed through it.

    It was also a rhetorical question written as a joke, pretending to spark an intense political debate.  This is not the appropriate place to actually have an intense political debate.

    05 April 2012 18:06
  • Servy, I fogot only you can join in the fun.  Sorry.

    JP Cowboy Coders Unite!

    05 April 2012 18:21
  • Really Konrad, that's just absurd!!

    ...

    ...

    People don't name their babies when they're conceived; they name them shortly before or shortly after they're born.


    Konrad did not inherit his baby from humans and therefore he did not make any relation to human babies. 

    So the latter sentence is very bad in the context of C# programming. I don't tell what I further think about it beside that in the culture from Konrad and me (EU) nobody thinks about this in the way it is handled here.


    Success
    Cor

    05 April 2012 18:38
  • Yet another person not able to take a joke.  Just laugh (or don't) and move on.
    05 April 2012 19:13
  • haha ... >.<

    Eyal (http://shilony.net), Regards.

    06 April 2012 4:21
    Moderator
  • Okay, all that don't know how to take a joke should learn, because the world is full of them.  Konrad, you're really funny.  I get your metaphor.  But then if people are saying that the .net framework handles most everything, then why am I having issues finding open source libraries for the server sides of FTP and XMPP? (More importantly is FTP for my purposes.)  It seems easier to find client libraries for .NET than server libraries.  Why is that?  Am I missing something?   
    07 April 2012 3:52
  • Did you try CodePlex/Google Code ? 

    If I'm reading you currently you want to build a server but I'm not quite sure; can you tell us exactly what kind of application you want to build/write ?

    Here are few implementations.

    C# FTP Server Library

    FTP Server in C#

    P.s. Statistically speaking, it's reasonable to find more clients than servers because there are more consumers than providers, also, let's not forget an important fact that other platforms are more mature than the .NET and so it's obvious that you will find more resources for them.

    Additionally, just because you love the .NET framework or C# for that matter doesn't mean you can't write applications in C++, it's not a crime against humanity, you know. ;)


    Eyal (http://shilony.net), Regards.


    07 April 2012 5:47
    Moderator
  • Okay, all that don't know how to take a joke should learn, because the world is full of them.  Konrad, you're really funny.  I get your metaphor.  But then if people are saying that the .net framework handles most everything, then why am I having issues finding open source libraries for the server sides of FTP and XMPP? (More importantly is FTP for my purposes.)  It seems easier to find client libraries for .NET than server libraries.  Why is that?  Am I missing something?   
    That sounds like a wonderful topic for a new question thread.  If you start a question looking for resources for C# code that runs an FTP server you'll get more help than when you ask in a discussion thread that's discussing C# fairly generally.
    09 April 2012 2:08
  • If you understood my point for mentioning that, then you'd not be feeling the same way.  I mentioned that particular example for a very specific purpose.  What I meant by it is that if there are few server libraries on .NET, then does that not mean that .NET is weaker on the server-side of things when it comes to non-ASP.net?  So, one reason for which the .NET Framework should not be used? 
    10 April 2012 1:12
  • If you understood my point for mentioning that, then you'd not be feeling the same way.  I mentioned that particular example for a very specific purpose.  What I meant by it is that if there are few server libraries on .NET, then does that not mean that .NET is weaker on the server-side of things when it comes to non-ASP.net?  So, one reason for which the .NET Framework should not be used? 

    Is .NET platform is capable of handling a server ? definitely.

    Can the .NET platform put up the performance of C++ ? the question is irrelevant because in most cases you're speaking about micro-benchmarking at the CPU level that in all honesty if you aren't a C++ programmer by heart the JIT will either produce far better output or come close.

    In my experience, the bottleneck will not come from the language and CLR itself but from the BCL (Base Class Library), sometimes writing your own things can performs better in a certain context.

    Benchmarking is never a real world estimation it's an extreme indication and too flat to be real.


    Eyal (http://shilony.net), Regards.

    10 April 2012 7:59
    Moderator
  • Hi,

    when comparing the speed of a c++ and a .Net application, we have to look into the details. What are the differences?

    So the core differences that I see are:
    a) JIT compiler. Whenever a method is called the first time, the JIT compiler has to compile the IL code to executable byte code. This has the disadvantage, that it takes a little time (which could be taken away through the use of ngen) and has the advantage, that the generated code can be optimized for the cpu. (So a c++ compiled application is normaly not optimized for a single cpu. You do not want to limit your application to run only on I7 cpus. But the JIT Compiler could even do CPU specific optimisations! So what is left in the end is a simple lookup for method calls where C++ applications might have more direct function calls.

    b) Garbage Collector - it can be a handycap to have a garbage collector in a seperat thread. This thread takes away power which could be important esp. in areas where you do not have much CPU power! (But most systems are multi core now. So even on mobile devices this will become less important with the time. But it is a fact that .Net has this and regarding speed it is a burden. (I do not talk about the positive aspects because that is out of scope. But the fact that more and more development areas introduced this (So even objective-c got this in the last years!) should be a proove that there are good arguments to have something like this!

    c) Runtime checks - I think this is a very important thing. Runtime checks take some speed away of course. Imagine going through an array:
    for (int i=0; i<100000; i++) a[i] = b[i];
    .Net will be very carefull - in each step it will check, that the element a[i] is valid and that b[i] is valid. A c or c++ program might run without these checks. Also important: The types are checked! In C++ you can do whatever you want. You have a pointer and you want to write an integer 100 bytes after that pointer? No problem! So all these checks will cost time, too! (And there are also a lot of good reasons for these checks! But I do not want to discuss advantages in here - let us concentrate on the speed!) Some parts can be done through unsafe code in .Net code.

    So in the end: is c++ code faster? It really depends on the code. You should never ever have big differences. If one performs much better, you made something wrong! (So if the JIT compiler was able to optimize something, then that might have been something that the c++ developer should think of, too. And also vice versa: If your code needs a lot of memory allocation and deallocation then you might think about possible optimisations ...)

    Regarding Server-based applications in .Net: Of course that is possible and I do not see any reason to use c++ in that area - and esp. beginners and intermediate developers should use a runtime that offers them a little protection. It is hard enough for them to not implement SQL Injection doors and such things so that they should not be burdend with more topics that the simply HAVE TO do.

    Just my personal view on this topic. Hopefully I was able to contribute a little bit.

    With kind regards,

    Konrad

    10 April 2012 8:49
  • Let's conclude.

    C++ is like an old man, he knows everything but can barely hold himself; C# is younger but has a future. 

    So give the old man a lift. lol :)


    Eyal (http://shilony.net), Regards.

    10 April 2012 13:28
    Moderator