Semi-newbie question on C++ vs. C#

S

Steven O.

Short version: I will be creating stand-alone applications for
Windows. Which environment will make it quicker and easier for me to
create the necessary GUI's -- Visual C++ or Visual C#?

Longer version: I took a bunch of programming classes some years
back, including two semesters of C++, but I've been away from it for a
while. One thing I found with C++ was that trying to create even a
basic GUI using Visual Studio 6 with MFC was an absolute bear.

I now plan to develop some simple scientific and mathematical
applications, mostly for self-study purposes, but some of them may
turn commercial at some point. I've downloaded both Visual C++
Express and Visual C# Express, but haven't explore them yet, and I'm
trying to decide which one to pursue.

In terms of underlying code for program logic, I'd prefer to work in
C++, both because I know it already, and because it is more universal
than C#. On the other hand, I don't want to waste time learning GUI
programming. I want to be able to slap together a basic GUI using
drag-and-drop style development for GUI components. A very quick peek
at Visual C++ Express does not immediately reveal a drag-and-drop
development tool, but I may have missed something. (Have not even
installed Visual C# Express yet.)

So, in the end, I'll go with whichever language makes its easier to
put the GUI together, and if that means learning C#, I'll do that.
Any and all input is much appreciated. Please point me in the right
direction....

Steve O.
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Steven said:
Longer version: I took a bunch of programming classes some years
back, including two semesters of C++, but I've been away from it for a
while. One thing I found with C++ was that trying to create even a
basic GUI using Visual Studio 6 with MFC was an absolute bear.

The good news is that creating a GUI in VS.NET is significant easier
than in VS6.
I now plan to develop some simple scientific and mathematical
applications, mostly for self-study purposes, but some of them may
turn commercial at some point. I've downloaded both Visual C++
Express and Visual C# Express, but haven't explore them yet, and I'm
trying to decide which one to pursue.

In terms of underlying code for program logic, I'd prefer to work in
C++, both because I know it already, and because it is more universal
than C#. On the other hand, I don't want to waste time learning GUI
programming. I want to be able to slap together a basic GUI using
drag-and-drop style development for GUI components. A very quick peek
at Visual C++ Express does not immediately reveal a drag-and-drop
development tool, but I may have missed something. (Have not even
installed Visual C# Express yet.)

You can create the same GUI using managed C++ and C#.

But even though you have C++ experience I will recommend C#.

Managed C++ is not that widely used. You will be able to find
100 times more tutorials and online help for C# than for
managed C++.

And C++ with MFC and managed C++ with Win Forms is not that
similar anyway.

Arne
 
B

Bruce Wood

Short version: I will be creating stand-alone applications for
Windows. Which environment will make it quicker and easier for me to
create the necessary GUI's -- Visual C++ or Visual C#?

Longer version: I took a bunch of programming classes some years
back, including two semesters of C++, but I've been away from it for a
while. One thing I found with C++ was that trying to create even a
basic GUI using Visual Studio 6 with MFC was an absolute bear.

I now plan to develop some simple scientific and mathematical
applications, mostly for self-study purposes, but some of them may
turn commercial at some point. I've downloaded both Visual C++
Express and Visual C# Express, but haven't explore them yet, and I'm
trying to decide which one to pursue.

In terms of underlying code for program logic, I'd prefer to work in
C++, both because I know it already, and because it is more universal
than C#. On the other hand, I don't want to waste time learning GUI
programming. I want to be able to slap together a basic GUI using
drag-and-drop style development for GUI components. A very quick peek
at Visual C++ Express does not immediately reveal a drag-and-drop
development tool, but I may have missed something. (Have not even
installed Visual C# Express yet.)

So, in the end, I'll go with whichever language makes its easier to
put the GUI together, and if that means learning C#, I'll do that.
Any and all input is much appreciated. Please point me in the right
direction....

I too would recommend C# for what you want to do.

Since Java and C# came along I see C++ more as a specialized tool for
specific applications. I would use C++ for problems that require
intimate knowledge of exactly what is going on in the machine, and
little or no tolerance for loss of efficiency in the name of
convenience.

C# is almost as fast as C++, and it is much easier to work with, IMHO.
I would employ C++ only when "almost as fast" isn't good enough, which
is not often.
 
A

Aggro

Steven said:
Short version: I will be creating stand-alone applications for
Windows. Which environment will make it quicker and easier for me to
create the necessary GUI's -- Visual C++ or Visual C#?

I've never tried C#, but I tell my opinion anyway.

I used the Visual C++ for a long time and only a few years ago I tried
C++ with wxWidgets to make the GUI. I didn't have any drag&drop tools,
but learning how to create basic Window-elements tool only a week or
two. So to sum it up shortly, with wxWidgets you:
- It is much easier to create much, much better looking GUIs
- It is cross platform, so in case you some day happen to need a
Linux-version or a version for some other OS the wxWidgets supports,
only minor adjustments are usually needed, if any.
- Even it is cross platform, it still has a native look in every OS,
because unlike most cross platform libraries, it uses the native
components, which means that on Windows the application looks like a
Windows application and on Linux, it looks like a Linux application.
This was the major reason I tried this library, because the applications
really look professional and tailored for the particular OS it is used on.
- It is free (to be used in closed source, open source, commercial, etc. )
- The library itself it open source. If it for reason doesn't do
something you would like it to do, you have the possibility of modifying
it and compiling a new version for you.
- You can compile the library files in the binary, so no additional
libraries are required to be installed by user.
- You can stick with C++, which you seem to prefer. Just separate the
GUI part well and for example finding people to work with your program
is easier, because I think there are a lot more C++ programmers than
there are C# programmers.
- When new versions of Linux or Windows appear, you don't have to worry
about that, because the wxWidgets library itself uses native OS
components, they just upgrade the library to support new OS and it
special features and you don't usually need to do anything to get your
application to support it also.
- Creating GUI elements dynamically (like a dialog with 100 buttons) is
really easy, basicly you just create a normal loop with C++ and have a
single line command to add a new button.
- ( There are some drag&drop tools also, but never tried those, because
I think that writing the code is so easy and gives you better control. )

Here is an example of how the library is used to create a simple dialog
with two buttons and a drop down menu with two options. The dialog is
also dynamic, meaning that when you resize it, some components will
automatically resize and some will keep their original size and some
will move. This makes the dialog look much more professional than normal
drag&drop dialogs which either can't be resized, or which can be
resized, but only the background of dialog is resized and all the
components stick where they were placed.
-----------------------------------------------------------
wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
wxButton *okButton = new wxButton( this, wxID_OK, _T( "OK" ) );
wxButton *cancelButton = new wxButton(this,wxID_CANCEL,_T( "Cancel" ));
buttonSizer->Add( okButton, 0, wxEXPAND | wxALL, 10 );
buttonSizer->Add( cancelButton, 0, wxEXPAND | wxALL, 10 );

wxBoxSizer *mainSizer = new wxBoxSizer( wxVERTICAL );
m_list = new wxListBox( this, -1 );
m_list->Append( _T( "Release" ) );
m_list->Append( _T( "Debug" ) );
mainSizer->Add( m_list, 1, wxEXPAND | wxALL, 10 );
mainSizer->Add( buttonSizer, 0, wxEXPAND | wxALL, 10 );

SetSizer( mainSizer );
mainSizer->SetSizeHints( this );
 
R

rossum

Short version: I will be creating stand-alone applications for
Windows. Which environment will make it quicker and easier for me to
create the necessary GUI's -- Visual C++ or Visual C#?
If you are using the Microsoft VS tools then creating the GUI will be
the same for either, both use .NET and have the same drag'n'drop
interface for building forms on screen.

In .NET the choice of language is not very significant as all
languages work to the same underlying classes, which include the
graphical interface.

Use whatever language you feel happier using. Having said that I get
the impression that more .NET examples use C# than C++ but that for
mathematical and scientific algorithms most examples are C or C++.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top