Just your opinion about MFC and C++.NET

T

Tony Johansson

Hello!

Some information to be able to have a change to answer the question.
Assume I have a large system developed in MFC.
In this system we have only C++ code so no other language exist.
This system is 10 year old.

I just want your opinion about porting this system.
Assume it should be ported should it be to C++.net or C#.net.

I just want to know the advantage or dissadvantage between C++ and C# if you
have any idea.
I know the syntax is vary similar between C++, C# and Java.

//Tony
 
D

David Wilkinson

Tony said:
Hello!

Some information to be able to have a change to answer the question.
Assume I have a large system developed in MFC.
In this system we have only C++ code so no other language exist.
This system is 10 year old.

I just want your opinion about porting this system.
Assume it should be ported should it be to C++.net or C#.net.

I just want to know the advantage or dissadvantage between C++ and C# if you
have any idea.
I know the syntax is vary similar between C++, C# and Java.

//Tony

Tony:

Not sure what you mean.

If you mean converting your MFC app from VC6 to VC7 or VC7.1 or VC8,
then you just need to recompile. This does not involve .NET at all.

If you mean completely porting the application to the .NET framework,
then this is a lot of work. I would certainly recommend that you wait
for Visual Studio 2005 (not much longer!). If you do that, and stay with
C++, there is a new language C++/CLI which is much nicer than the
managed C++ in VS 2002/2003. But, personally, I am avoiding anything to
do with .NET for now, so I have no real opinion on C++ vs C#.

David Wilkinson
 
P

ProfitMaxTrading.com

This is getting confusing.

VB6,7,8 ?

..NET Framework?

Here I thought .NET enveloped all these.

Oooh my head hurts.

:-(
 
P

Peter van der Goes

ProfitMaxTrading.com said:
This is getting confusing.

VB6,7,8 ?

.NET Framework?

Here I thought .NET enveloped all these.

Oooh my head hurts.

:-(
I'll attempt a clarification. Lets start by assuming you meant to type VC
instead of VB.
VC 6, 7, 7.1, 8 are referring to versions of the C++ compiler, which come
with Visual Studio 7, Visual Studio .NET 2002, Visual Studio .NET 2003 and
Visual Studio 2005, respectively.
All these versions of the C++ compiler support Windows application
development using MFC.
With Visual Studio .NET 2003, we got an additional technology for developing
Windows applications with C++, .NET Windows Forms which uses the .NET
Framework classes in place of the MFC classes.
 
C

Carl Daniel [VC++ MVP]

Peter said:
VC 6, 7, 7.1, 8 are referring to versions of the C++ compiler, which
come with Visual Studio 7, Visual Studio .NET 2002, Visual Studio

VC6 (aka VC '98) is from Visual Studio 6, not 7.

-cd
 
C

Carl Daniel [VC++ MVP]

Tony said:
Hello!

Some information to be able to have a change to answer the question.
Assume I have a large system developed in MFC.
In this system we have only C++ code so no other language exist.
This system is 10 year old.

I just want your opinion about porting this system.
Assume it should be ported should it be to C++.net or C#.net.

I just want to know the advantage or dissadvantage between C++ and C#
if you have any idea.
I know the syntax is vary similar between C++, C# and Java.

Syntax is the least or your worries - almost a non-consideration IMO.

Get VC8 and compile your app. You'll have somewhere between zero and
several thousand errors to fix due to language changes since VC6. While the
numbers may be daunting, these errors are usually easy to fix once you've
tackled the first few.

I wouldn't even consider "porting" a large MFC app to C# unless it's ready
to be completely retired. You'd have to re-write virtual every line of
code, and you'd have to do major re-architecting to fit into the Windows
forms paradigms instead of MFC. Many MFC concepts simply have no equivalent
in windows forms (e.g. documents, views), so you'd have to build
replacements for those features yourself. Finally, windows forms (even in
VS 2005) doesn't have the UI richness that's attasinable through MFC.

Having updated your app (I wouldn't call it porting) to VC8, you can now
consider whether you want to use .NET for new features going forward. The
version of MFC included in VC8 allows you to host .NET forms and controls
inside MFC views, so it makes it easy to use .NET to add new features to an
existing MFC application without re-writing the base application in another
language or framework.

-cd
 
T

Tony Johansson

Hello!

You say this and it sounds good.

Having updated your app (I wouldn't call it porting) to VC8, you can now
consider whether you want to use .NET for new features going forward. The
version of MFC included in VC8 allows you to host .NET forms and controls
inside MFC views, so it makes it easy to use .NET to add new features to an
existing MFC application without re-writing the base application in another
language or framework.

Now to my question. Assume we compile the MFC application in VC8. When we
want to add new feature to the application using .NET is it then possible to
use C# insted of C++. I just think that using C# instead of C++ will cause
less error beacuse it's an easier language. Compare this you create an
application quicker when using Java then C++ beacuse it's an easier language
and the possibility of strange errors in the future is much less with Java.

C# is quite similar to java.

//Tony
 
M

Marcus Heege

Now to my question. Assume we compile the MFC application in VC8. When we
want to add new feature to the application using .NET is it then possible
to use C# insted of C++. I just think that using C# instead of C++ will
cause less error beacuse it's an easier language. Compare this you create
an application quicker when using Java then C++ beacuse it's an easier
language and the possibility of strange errors in the future is much less
with Java.

When you are using the Visual C++ "It just works" feature, you can compile
C++ code to .NET code. This .NET code can use any .NET component created by
any .NET language.

If you really want to use C# for the most part, you would compile your
existing code via IJW (at least the one that should be extended with managed
features) and write some C++/CLI code that calls your C# code. However, you
would end up in a situation where you use 3 different languages: C++,
C++/CLI, and C#. I am not sure if this is really what you want.

Re: IJW, I am probably doing a webcast about how IJW works. If it is
interesting for you, I will post you a link when it is done.

Marcus
 
T

Tom Serface

If the program you're describing uses MFC to do document/view and makes
heavy use of other MFC classes I would try to stay with it going forward
unless you have a compelling reason to switch to C#. You can move parts of
your program to managed code that are not necessarily performance restricted
and/or where you want to use .NET functionality. My feeling is that C# will
develop as time goes on to have more things that MFC currently has, but that
doesn't seem to be the case at this time.

IOW, a lot depends on what your program is doing. If you've written a
web-service using MFC, for example, I would hurry up and switch it to .NET
using C#. If you use MFC ISAPI, um, my opinion, is that you shouldn't these
days.

Tom
 

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