learn C++ or C#

D

Daniel

If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?

Daniel
 
P

Pavel A.

Daniel said:
If I haven't made substantial investment in either C++ or C#, which
language would the experts recommend I become well acquainted with?

Java, Ruby, Python

--PA
 
A

Arne Vajhøj

Daniel said:
If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?

First I will make a prediction: the .vc guys will suggest C++ and
the .csharp guys will suggest C#.

:)

If you want to write general business apps, then I will suggest C#.

If you have special requirements for real time, embedded, device
driver programming and similar then go for C++.

Arne
 
F

Fernando Gómez

Daniel said:
If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?

Daniel

Both. I'd choose C++ first because once you learn it C# will be really
easy in comparison. If you want to see immediate results, I'd go for C#
though.

Regards.
 
D

Daniel

I meant which of the two languages C++ or C# should I pursue, if I don't
already have projects I have to support in either one. If I I have to give
support for an application I created in one of those two languages, then
that is the language I have to be most familiar with. Once I use the
language in a substantial project I have to support, I am committed to that
language.

Daniel
 
L

Larry Smith

I meant which of the two languages C++ or C# should I pursue, if I don't
already have projects I have to support in either one. If I I have to
give support for an application I created in one of those two languages,
then that is the language I have to be most familiar with. Once I use the
language in a substantial project I have to support, I am committed to
that language.

This is a religious issue and it really depends on what you plan on doing.
That said, for "general-purpose" programming in the Windows world, C# is
usually the way to go these days IMO. I believe the trend has been strongly
moving in that direction for a period of years now. Note (FWIW) that I spent
many years in the C++ trenches.
 
J

Jon Skeet [C# MVP]

MC said:
Java. :)

C++ is well past its heyday. C# is (in my opinion) the best-designed of the
3 languages but is very similar to Java, which is more widely used; you
should at least be acquainted with it.

Java 1.4 and C# 1.0 were very similar, but the languages have diverged
significantly since then. Almost all the new features in C# 2.0 and 3.0
either have no real equivalent in Java (e.g. iterator blocks, nullable
types) or have very significant differences (e.g. generics).
 
P

Pavel Minaev

If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?

It's well worth knowing both, but knowing C++ well is going to take
much more time and energy. I'd suggest learning C# first, still -
moving from C++ to C# is often more of a pain than it seems.
 
G

Giovanni Dicanio

First I will make a prediction: the .vc guys will suggest C++ and
the .csharp guys will suggest C#.

:)

I'm a .vc guy :)

If you want to write general business apps, then I will suggest C#.

I agree with that.

If you have special requirements for real time, embedded, device
driver programming and similar then go for C++.

Moreover, if you want to build Windows shell extensions, you should use C++.

If you want crossplatform code, you should use C++ (with proper libraries
like wxWidgets for the GUI).

If you want to build small .exe's easy to deploy (no need of huge runtime to
distribute), you should use C++ (with CRT/MFC/ATL statically linked).

If you learn C++ first, then moving to C# is a very easy path, as others
wisely wrote.
Instead, the opposite is not true.

Both languages have pro's and con's: choose the better tool for your
particular job.

Giovanni
 
P

Pavel Minaev

If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?

By the way, one reason why a .NET developer might want to learn C++ or
at least C is to be able to write MSI custom actions for installers
(while it's possible to create managed actions, there is a number of
issues and technical difficulties associated with them).
 
G

Giovanni Dicanio

"Daniel James"
C# targets a virtual machine
architecture, so C# programs can run only on computers for which such a
runtime (a JIT compiler or an interpreter) is available -- that means
Windows, certainly, and platforms that support Mono (an Open Source
NET-compatible runtime);

I've heard about Mono before. But I wonder: what is the level of
implementation of Mono?
Is Mono as robust as the Microsoft .NET framework implementation?
Does Mono fully support C# 3?
Does Mono fully support .NET Framework 3.5 ?

Thanks,
Giovanni
 
K

Ken Foskey

I've heard about Mono before. But I wonder: what is the level of
implementation of Mono?
Is Mono as robust as the Microsoft .NET framework implementation?

A lot of the .net framework is directly from Microsoft. A lot is
implemented a totally different way. I expect that it will be very
compliant as time progresses just not now.
Does Mono fully support C# 3?

I cannot compile anymore:

[Task:File=/home/ken/projects/Capture/Capture/inMatch.cs, Line=266,
Column=32, Type=Error, Priority=Normal, Description=Feature `query
expressions' cannot be used because it is not part of the C# 2.0 language
specification(CS1644)]
Does Mono fully support .NET Framework 3.5 ?

definitely not.

Mono is about portability you have to build with that in mind and you can
be fully portable. I write my test classes on Console and run them on
Linux as well. I have socket based tests and I need two machine to make
it work.

Ken
 
D

David Wilkinson

Daniel said:
If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?

Daniel:

As you are posting in dotnet groups, you should know that there are actually
three languages

C++
C#
C++/CLI

Up to now you have been using C++/CLI, which is the wrong choice if you want to
write GUI Windows applications, because Microsoft no longer recommends C++/CLi
for writing GUI .NET applications.

Assuming that you want to write GUI applications for Windows, you need a library.

If you use native C++, you will probably want to use the MFC library (which does
not come with VC Express. by the way). MFC is old, and not very elegant, and has
quite a learning curve. But there is a huge base of available code samples for
it, and Microsoft is once again working on improving it (after many years of
neglect). MFC is not portable to other platforms, but if you separate the
back-end of your application from the GUI, you can port the back-end to other
platforms such as MAC/linux. For me, one of the advantages of going the MFC
route is that you can use static linking, which means that you can deploy
without installing any components on the target machine.

[Note that the main newsgroups for standard C++ are microsoft.public.vc.language
and microsoft.public.vc.mfc]

If you use C#, you will use the .NET library, which is more elegant, and
probably easier to learn than MFC. If you go this route, you need to make sure
that the appropriate version of the .NET framework is installed on the target
system.

There are also hybrid methods, where you write your back-end in standard C++,
the GUI in C#, and build an interface layer using C++/CLI. This may be
appropriate if you have a large amount of legacy C++ code, but it means you have
to learn and understand three languages.

Feel free to ask more questions. This is an important decision, and you should
be sure you make the one that is correct for you.
 
L

Larry Smith

Does C# have as much meticulous control over the micro matters as C++

From a language perspective yes. There's really not much you can do in one
that you can't do in the other. C++ has more elegant constructs
IMO and also supports multiple inheritance but that's highly overrated.
It's also much more difficult to learn and much less forgiving if you make a
mistake (i.e., easier for your program to blow up). For all intents and
purposes however (to answer your question), the real difference under
Windows is that C# relies exclusively on .NET while C++ doesn't. C++
therefore provides a complete and natural gateway to the entire OS so you
have that power at your disposal if you need it. It's much easier to call
the WinAPI that is since its interface was designed for C/C++ programmers.
By contrast, in C# you have to call into the "P/Invoke" services if you need
to do something that .NET doesn't support. That simply means you have to
call routines outside of .NET to get your work done (usually a C++ library).
In practice however you can write most mainstream .NET programs without
relying on the WinAPI whatsoever (or very minimal support anyway). C# is
also a more natural fit for .NET than C++ since it was designed from the
ground-up for this platform. Of course you can now also choose C++/CLI which
makes .NET programming much easier than in the past (for C++ developers). I
stronlgy recommend against it however. C# is really the de facto platform
for .NET and most shops will choose it over C++. Your support issues will
also be much easier since there will be fewer bugs (since C++ is far easier
to screw up) and it's easier to find qualfied C# programmers compared to
C++. .NET is also much easier than the WinAPI in general (including any of
the available C++ platforms for programming the WinAPI) so the real decision
boils down to whether you're choosing .NET or the WinAPI. Most programs can
now rely on .NET so you're probably safe choosing it. Unless performance is
a major factor (you need blazing speed for some reason), or you do in fact
have to rely on the WinAPI a lot (for things that .NET doesn't support),
..NET and C# will give you most of the "meticulous" control you're seeking.
You'll also find it *much* easier than C++ and the WinAPI. Note however that
if you want to become a Windows programming master then C++ is the clear
winner (in the long run you'll also command more money from employers).
 
B

Ben Voigt [C++ MVP]

Ken said:
I've heard about Mono before. But I wonder: what is the level of
implementation of Mono?
Is Mono as robust as the Microsoft .NET framework implementation?

A lot of the .net framework is directly from Microsoft. A lot is
implemented a totally different way. I expect that it will be very
compliant as time progresses just not now.
Does Mono fully support C# 3?

I cannot compile anymore:

[Task:File=/home/ken/projects/Capture/Capture/inMatch.cs, Line=266,
Column=32, Type=Error, Priority=Normal, Description=Feature `query
expressions' cannot be used because it is not part of the C# 2.0
language specification(CS1644)]

Sounds like a command line option, or lack thereof, put you in C# 2
compatibility mode. Certainly the compiler wouldn't be describing a feature
such as LINQ query expressions if it didn't understand it.
 
B

Ben Voigt [C++ MVP]

Assuming that you want to write GUI applications for Windows, you
need a library.
If you use native C++, you will probably want to use the MFC library
(which does not come with VC Express. by the way). MFC is old, and
not very elegant, and has quite a learning curve. But there is a huge


ATL/WTL follow modern C++ principles much better than MFC, and should
probably be the library of choice for C++ Windows-only GUI.
base of available code samples for it, and Microsoft is once again
working on improving it (after many years of neglect). MFC is not
portable to other platforms, but if you separate the back-end of your
application from the GUI, you can port the back-end to other
platforms such as MAC/linux. For me, one of the advantages of going
the MFC route is that you can use static linking, which means that
you can deploy without installing any components on the target
machine.
[Note that the main newsgroups for standard C++ are
microsoft.public.vc.language and microsoft.public.vc.mfc]

If you use C#, you will use the .NET library, which is more elegant,
and probably easier to learn than MFC. If you go this route, you need
to make sure that the appropriate version of the .NET framework is
installed on the target system.

There are also hybrid methods, where you write your back-end in
standard C++, the GUI in C#, and build an interface layer using
C++/CLI. This may be appropriate if you have a large amount of legacy
C++ code, but it means you have to learn and understand three
languages.
Feel free to ask more questions. This is an important decision, and
you should be sure you make the one that is correct for you.
 
J

Jon Skeet [C# MVP]

[Task:File=/home/ken/projects/Capture/Capture/inMatch.cs, Line=266,
Column=32, Type=Error, Priority=Normal, Description=Feature `query
expressions' cannot be used because it is not part of the C# 2.0
language specification(CS1644)]

Sounds like a command line option, or lack thereof, put you in C# 2
compatibility mode.  Certainly the compiler wouldn't be describing a feature
such as LINQ query expressions if it didn't understand it.

Indeed, you need the command line option -langversion:linq but to
quote the documentation:

<quote>
This enables the C# 3.0 support. Only a few features of C# 3.0 have
been implemented in the Mono C# compiler, so not everything is
available.
</quote>

:(

Jon
 

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