C++/Java/C#

This is a discussion on C++/Java/C# within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Originally Posted by C_ntua But I would like to know one language for everything. Why on earth would you want ...

  1. #61
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by C_ntua View Post
    But I would like to know one language for everything.
    Why on earth would you want that? If you only know how to use a hammer, as they say, everything begins to look like a nail. Pick the right tool for the job.

  2. #62
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,029
    Quote Originally Posted by medievalelks View Post
    "Real" design?
    You know, all those little C++ stuff that allows you to do generic programming. Advanced stuff.
    Using vectors is easy stuff.
    Things as such are in Modern C++ Design. Complex code that's perfect for generics.
    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.

  3. #63
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,304
    But I would like to know one language for everything. So, considering that I don't know what my feature job will require, do you think I should go for C++ or something newer, like C# or Java?
    If you will be in an English speaking environment, then English would be a good choice, since being able to express yourself clearly in a discussion is very useful, regardless of what programming language your future job will require.

    Honestly, what's stopping you from learning C++, C# and Java? And Common Lisp? And Haskell? And Prolog? Why must your choice be limited to exactly one of them? You can always start with one, then when you are reasonably proficient in your first choice, go on to your second choice. You will develop general programming skills along the way, and that will serve you better in the long run than any one language.

    And yes, I mean it when I say that English is a good choice. Likewise, having some understanding of say, UML, design patterns, software development methodology, etc, will all come in handy at some point. Oh, and of course, algorithms and data structures, which you may already have some grounding in. Programming is not all about programming languages, after all.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #64
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Despite my obvious bias towards C++ and my obvious preference for wxWidgets, anyone will have an hard time convincing me some C++/Qt/wxWidgets/MFC combination can match the development speeds and the features of C# or VB.Net under Windows Forms.
    I'm sorry I have to completely disagree on this one having used both at work and home. I have not use wxWidgets but the continual mentions of it is making me a bit curious. Personally my development time with C# and with MFC are about equal. In the end the most time is spent on getting the controls to do what you want. The actual placement of controls and addition of the controls into code takes about the exact amount of time in both.

    MFC is extremely easy and gets a bad rep for the MDI horrors and document/view architecture. Usually this is the fault of the programmer because MFC forces you to use OOP concepts when using doc/view and quite honestly most programmers try to break that at every turn in an MFC app. I will not say that MFC is easier than C# because MFC, in my opinion, is a bit lacking in controls. This is more the fault of the Win32 API than MFC but it is true that .NET offers far more when it comes to complete controls. .NET concentrated on making their controls complete and workable while Win32 concentrated on ...well...I dunno what they concentrated on but it was not the controls.

    C# is also extremely easy. There is one thing about C# that bugs me to death. The fact that everything is a message which means that calling certain functions for the control may lead to some very unexpected results. This means I had to make use of the user defined data quite often in a control to ensure my control acted as it should. MFC does not suffer from this problem.
    C# now has some very nice generics (in later version of .NET) but the early container types were a bit ugly.

    I'm a fan of both of these but they both have their downfalls. However a blanket statement saying that GUI in C++ with MFC is much harder than C# is simply not true. Most people who say that rarely use MFC and the less you use something the more you forget which inevitably makes it harder to use. MFC is not hard and is extremely easy to use for dialog-based apps which most GUI apps fall into. C# is not hard and is extremely easy to use for dialog-based apps. However, both get a little more involved if you want to create something robust like an SDI or MDI application.

    As always development time is proportional to the programmer's experience in that language or API. If you have a programmer who is familiar with both MFC and C# choosing which one to use usually comes down to what the company has been using thus far in their tools. The only route I would never take is to use pure Win32 since it is just ugly.

    If we are going to compare languages, as we so often do here, let's compare them on how well they do what they were designed to do. C++ was not designed to create GUIs so using that as a measuring stick of it's usefulness is unfair.

    Moved to GD board.
    Last edited by VirtualAce; 06-28-2008 at 12:53 PM.

  5. #65
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Quote Originally Posted by medievalelks View Post
    If you're pushing objects, you have to worry about copy semantics. Maybe that's not memory management per se, but it's a language feature that you always have to be concerned about.
    And in java for example you have not to care about semantics? how is that possible?

  6. #66
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    I didn't mean to put MFC in there, really. Only reason I did was because I reasoned since .Net Framework is meant to replace MFC, new more improved features would be present. But on second thought, that alone still doesn't make it; I must remember at all times when discussing anything to do with MFC, my experience with it was entirely with a different programming language.

    I will however stick to my arguments on the issue of 3rd party GUI libraries the likes of Qt and wxWidgets that despite being excellent alternatives to MFC, by no means their own tools can match MFC based RAD tools, and necessarily Windows Forms (or WPF, the one technology that could bring back my interest in post-Vista windows development). Libraries like Qt or wxWidgets are simply not RAD friendly... so far.
    Last edited by Mario F.; 06-28-2008 at 01:48 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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. #67
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Quote Originally Posted by Mario F. View Post
    Libraries like Qt or wxWidgets are simply not RAD friendly... so far.
    Could you elaborate a bit more what you mean?
    For example I run the gui designer, place all windows, dialogs and controls I need and save. Then I run the code editor and connect my backend functionality to signals/events and controls.

    How exactly can this be improved by C# (in which I've no experience)?

  8. #68
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Forms are a hideous way to design a GUI. Fair enough it may be a little faster if youre doing something simple, but you cant dynamically change the content and they generally tend to lock you out of the code. Blegh. Once you know the API laying out content is not going to be much harder than laying out a webpage, unless the API sucks.

  9. #69
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    Quote Originally Posted by pheres View Post
    Could you elaborate a bit more what you mean?
    Certainly. Although I though I already did.

    These tools have several problems, mainly to do with the fact they run by basically applying generic code to your design choices.

    I run a GUI layout and place my controls for either resizeable or fixed windows. Then I'm forced to alter the generated code. Because of several reasons:

    - It doesn't conform to my code practices.
    - Those variable names that are automatically generated are never acceptable names.
    - Many times, after adding, deleting, and moving controls on the designer, you are left with code artifacts that need to be removed.
    - Code is generic. Consequently is often not acceptable in the presence of performance requirements or in the interest of code maintenance. You need to trim and rearrange the code.
    - Control indexing system is offered in several forms. wxWidgets, of the top of my head, offers 4 different ways to index your controls. However, the best option is usually a combination of 2 of them or your own personal and entirely customized system. As you know, this is an essential feature since you are going to address those controls often in your code. Either you adapt to what the GUI designer offers you, or you are forced to also here alter the code.
    - Code is tied to the designer one way. This is essentially a code generator and parser with little to no heuristics coded in. If you alter the code, the designer can no longer understand it.

    If you wish I can further that list, but it will probably become a boring read.

    Quote Originally Posted by pheres
    For example I run the gui designer, place all windows, dialogs and controls I need and save. Then I run the code editor and connect my backend functionality to signals/events and controls.
    I don't know exactly what kind of applications you have been developing on Qt (I believe that's the one you use, right? I use wxWidgets. But have already studied Qt - which I must say also liked). But pheres, that is simply not true for anything other than simple applications. Heck! Even on most cases adding your application functionality to the generated code is enough to break the designer.

    I quickly learned, when I started learning GUI development with these libraries, that their GUI designers are excellent choices for quick window layout. This is after all, a boring and error prone task to be done in code only. But that's that. While I fully support these libraries for their unquestionable worth (free, powerful, portable), I cannot defend their RAD capabilities.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

  10. #70
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by pheres View Post
    And in java for example you have not to care about semantics? how is that possible?
    How is it possible that I've never written a copy constructor in Java (or Python or C#)?

  11. #71
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    i think I see there our differences in usage experiences come from, so your extended elaborations was not useless
    it seems you expect some form of round trip engineering capability from your gui design tools (work on gui->work on code->continue to work on gui).
    Do you really need that? Can't you just completely seperate the gui from the logic, I think the wxw XRC system should be able to do what, doesn't it? Then you should be able to edit the gui continuousely. And I'm pretty shure most of the editors allow to edit the names of the controls.

    Quote Originally Posted by medievalelks View Post
    How is it possible that I've never written a copy constructor in Java (or Python or C#)?
    I've no idea. Somehow must the semantics be selected. if not by the programmer, than by the language?

  12. #72
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    Quote Originally Posted by pheres View Post
    it seems you expect some form of round trip engineering capability from your gui design tools (work on gui->work on code->continue to work on gui).
    Do you really need that?
    Absolutely. Especially because being a one man's job (and a poor man's job at that) I cannot afford for extensive analysis that would allow me to develop in one go without having to go back (not that I even think that is possible). On the other hand, application maintenance, by definition, forces you to go back and often need to change the screen layout either to introduce new features or to answer user requests.

    Quote Originally Posted by pheres
    Can't you just completely seperate the gui from the logic, I think the wxw XRC system should be able to do what, doesn't it?
    Well, we are talking of GUI logic here. Not application logic. I work by separating application logic from presentation, certainly. What I cannot do however is separate presentation logic from err,... presentation.

    If the tool ties its functionality to the code and can't parse outside it's limited set of rules, that tool cannot help me past the initial stages of development.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

  13. #73
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by pheres View Post

    I've no idea. Somehow must the semantics be selected. if not by the programmer, than by the language?
    Well, that's the whole point, isn't it? If I don't need the speed and flexibility of C++, I'd largely prefer to use a language that makes those decisions for me.

  14. #74
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,029
    But you don't need to define a copy constructor in C++ unless you do something different.
    Smart pointers gets rid of the whole copy problem with classes.
    In Java you wouldn't need to worry about memory at all due to the GC, but with smart pointers in C++, it's the same.
    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.

  15. #75
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Elysia View Post
    But you don't need to define a copy constructor in C++ unless you do something different.
    Smart pointers gets rid of the whole copy problem with classes.
    In Java you wouldn't need to worry about memory at all due to the GC, but with smart pointers in C++, it's the same.
    You've defined my C++ M.O. almost to a T, Elysia :-). In fact, I usually deny copy and assignment through boost::noncopyable by default, and use smart pointers or if raw, RAII. Like I said, it's not really hard, it's just more verbose that I like to be anymore.

    Hey, I'm getting old. I cherish time that would otherwise be spent in traffic, in line at the supermarket, or managing memory. :-)

    Maybe I should use a C++ GC and stop complaining so much.

Page 5 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21