Thread: Some basic Q's about C#

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    .Net C# is not more portable than C++. Let's not try to go around this issue making it more look more complicated or in a more favorable light than it is. C# serves well Microsoft based operating systems (server, desktop and mobile) and is barely bearable under Linux. And that's just it. It's a good language, it's a good framework. But it is not portable until someone builds a complete framework for the target system.

    Macs don't have it, Linux only barely has it, many mobile devices don't have it, Solaris doesn't have it, etc etc etc. And yet, with C++ you can even program a PIC or a an old Z80 processor.

    Let's please be more objective.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    So, would you say that it makes more sense to learn Qt if the only thing I'm after is a steady GUI backend....?...rather than try mangled runtime environments in the different places..

  3. #18
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Qt is a good option, yes, if you are concerned about portablity. However, depending in exactly what type of GUI applications we are talking about here, you can also adopt a branch-like development strategy in which you use a different GUI framework for each platform and the baseline code is what's portable. It's a bit more work but there's two advantages:

    1. You are learning more than one framework. That can only be good.
    2. For each platform you can use a fully featured GUI platform, giving your users a quality finish to your projects

    There's a third, also meaningful, advantage. You'll discipline yourself to separate function from form (business rules from presentation) and this is one important method in GUI programming that will help you maintain your code, derive from it and even reuse.
    Last edited by Mario F.; 04-16-2011 at 08:32 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #19
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    I am concerned about learning(with absolutely no experience in gui programming) it now...not any sort of deployment. So I'm looking for a framework which would be ..both easy to learn and somewhat portable.. In that light would C# be an option better than QT or the opposite ?

  5. #20
    Registered User
    Join Date
    Mar 2011
    Posts
    41
    Quote Originally Posted by Mario F. View Post
    But it is not portable until someone builds a complete framework for the target system.
    And C++ isn't portable until someone builds a compiler for the target system. There a point here?

    Macs don't have it, Linux only barely has it, many mobile devices don't have it, Solaris doesn't have it, etc etc etc. And yet, with C++ you can even program a PIC or a an old Z80 processor.
    C++ doesn't run on Windows Phones, Android, iPhone, iPad, XBox (without hacking), etc. We can all find exceptions. C/C++ has been around a lot longer than C# so has a wider adoption base. Also claiming Linux 'barely' has it is not being objective. Mono is about one version behind the current Microsoft version. I hardly consider that 'barely'.

    C/C++ and C# were not designed to solve the same problem. They can be used to solve the same problems, but so can a hammer and screwdriver. If you want a Form or webpage, I'd go with C#. If you want a device driver or need super high performance, C/C++.

  6. #21
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Momerath View Post
    And C++ isn't portable until someone builds a compiler for the target system. There a point here?
    I don't know. What's your point?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #22
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Quote Originally Posted by Momerath View Post
    And C++ isn't portable until someone builds a compiler for the target system. There a point here?
    True. And if one day they support C# for all those platforms then you will be right. But that is not the case here. C# can be portable, even more portable than C++. But it is not. It is less portable than Java, not because of its technology, but simply because they haven't done it yet.
    Is Microsoft trying to make it portable? I think not. The idea is to have windows-only applications, then you need Windows.

    Quote Originally Posted by Momerath View Post
    C++ doesn't run on Windows Phones, Android, iPhone, iPad, XBox (without hacking), etc. We can all find exceptions. C/C++ has been around a lot longer than C# so has a wider adoption base. Also claiming Linux 'barely' has it is not being objective. Mono is about one version behind the current Microsoft version. I hardly consider that 'barely'.
    You can use C++ for Android . In Mobile Phones, C# is competing with Java, not C++. I would imagine Microsoft would love if Mobile Phone manufacturers were to support C#. You see in this case it is not that simple for Microsoft to create a .NET Runtime library for all operating systems for all the Mobile Phones. Even if they do, the OS are not that open to actually allow you to install any kind of application. So they Mobile Manufactures would have to agree first.
    In desktops things are easier. You have rights to install a low-level application, like a VM. If you can do it for java, you can do it for .NET. So it is completely up to Microsoft.

    Is Mono reliable though? People have claimed to have problems. Haven't tried it myself. But for a big $$ project I wouldn't really trust a third party. I would just go with C++ if I wanted to target Linux. And build to versions if I wanted to use C# for windows. When you are in a team and you have to put some deadlines and justify your choices, coordinate with less experienced developers etc etc relying on a third party project might just not be a really good option.

    Quote Originally Posted by Momerath View Post
    C/C++ and C# were not designed to solve the same problem. They can be used to solve the same problems, but so can a hammer and screwdriver. If you want a Form or webpage, I'd go with C#. If you want a device driver or need super high performance, C/C++.
    C++ offers the same functionality as C#. The comparison is on the library and the tools. It is "QT and QT Creator" vs ".NET and Visual Studio". Yes, those are different tools. Then you have "VM" vs "native code". Yes those are different tools.

    If we are talking about GUIs then of course using C++ to make a driver or program a micro-processor is irrelevant here. If we are talking about GUIs in mobile devices, then probably you should have gone with Java.
    So the discussion should focus on desktops mainly. In which case .NET is not fully supported for Linux and Mac. Where libraries that use C++ are.
    Consider though that Windows users are more dominant. And the interface is not usually the biggest part of a program. Consider also that .NET is not only for GUIs.

    Concluding, learn C++ first. Don't start with C#. That is my advise. You can use QT to play with GUIs. Then think if you want to focus on QT or learn .NET and C#. If you try looking for .NET developer you will see that it is much more in demand than a QT developer. The transition between C++ and C# is not that big.

  8. #23
    Registered User
    Join Date
    Mar 2011
    Posts
    41
    Quote Originally Posted by C_ntua View Post
    If we are talking about GUIs then of course using C++ to make a driver or program a micro-processor is irrelevant here. If we are talking about GUIs in mobile devices, then probably you should have gone with Java.
    I believe we are actually agreeing here. C, C++, C#, Java are all tools with their own strengths and weaknesses. Which you use should depend on what you are trying to accomplish, not on a 'my language is better than yours' basis that I see too often.

    Concluding, learn C++ first. Don't start with C#. That is my advise. ... The transition between C++ and C# is not that big.
    Which is why I say start with C, C++, Java or C#. They aren't all that different and once you learn one, transitioning to another is not a major task.

    Just FYI, I make a living programming in all four of those languages, I'm just focused on C# right now because that's where the money is where I'm at

  9. #24
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Oh, I have focused on C# as well. I just loved Visual Studio and stuck with it
    But in the end, yes, you need all tools. When I was freelancing, if I saw an opportunity to do the GUI to support linux as well, QT it was. Would frowned on "this is not like Visual Studio" but still, the job was done.

    This is a fact I actually hate (going off topic). One I would love is:
    -Common syntax
    -Basic common library, so use STL
    The rest of course would have to be different. But at least you could more easily re-use code, separate logic from interface etc etc. If you have have a function that manipulates an array of controls, then I would love to be able to re-use it. If C++, C# and Java have a different class for something basic as a dynamic array and small differences in syntax, this is just an unnecessary headache for the programmer.

  10. #25
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Okay so no specific C# code related question here. Moved to tech board.

  11. #26
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    if you want to talk about portable C++ GUI, WxWidgets is my choice. it's open source, at least as portable as Qt, and you don't EVER have to pay for it under any conditions. it's also much easier to learn in my experience. the event handling system is much more straightforward, and it supports an XML based system (wxrc) for separating GUI design from code, kind of like WPF.

  12. #27
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by Elkvis View Post
    the biggest drawback I see in .Net/Mono is that the compiling of code at run time reduces the opportunity to optimize the generated code.
    I'm pretty sure you mean increases the opportunity... the JIT compiler and optimizer can take the details of the host into account. But sure, expensive optimizations may not be possible at run-time, but these are usually done at compile-time anyway.

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Re separating GUI from code, Qt has it too. See Qt Quick.
    Qt is on quick track for becoming the GUI framework for a lot of platforms. Quickly gearing up for Symbian, and adding lots of power to desktops, as well. Qt is definitely nothing to sneer at.
    Last edited by Elysia; 04-23-2011 at 02:40 PM. Reason: Negative feedback
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    Quote Originally Posted by Elysia
    Lots of stuff that I've made up
    Why do you continually embarrass yourself like this?

  15. #30
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Elysia View Post
    Prove me wrong.
    You may extraordinary false claims and put on everyone else the burden of proof? Just shut up!
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. very basic c
    By jayparrillo in forum C Programming
    Replies: 26
    Last Post: 01-19-2011, 12:40 PM
  2. Need help with some basic C++
    By 3321thec in forum C++ Programming
    Replies: 6
    Last Post: 09-06-2007, 08:15 PM
  3. need some help with basic C++
    By ramonnie in forum C++ Programming
    Replies: 6
    Last Post: 06-28-2007, 11:15 AM
  4. basic
    By srinu in forum C Programming
    Replies: 3
    Last Post: 02-13-2003, 08:21 AM
  5. This is basic C++
    By incognito in forum C++ Programming
    Replies: 10
    Last Post: 12-12-2001, 08:51 AM