a pre-beginner's question: what is the pros and cons of .net, compared to ++

L

lester

a pre-beginner's question:
what is the pros and cons of .net, compared to ++

I am wondering what can I get if I continue to learn C# after I have learned
C --> C++ --> C# ??

I think there must be many know the answer here.

thanks

BR
 
C

Cor Ligthert

Lester

Simply answer, it is a next step in the evolution of that language, and than
you ask "yes and than?

It is more logical to write, however as with all evolutions are there staid
some legacy, where the users are used too however could have been as well
changed however that is not done direct.

I give no examples because that goes always to endless discussions.

Cor
 
L

lester

thank you Cor,
maybe I have to study some abc about .NET before I know for whom .NET is
designed.

about C++, we should say"C++ really makes program very natural, simple, easy
to understand, easy to maintain..., than C."
about C# we should say"????"

Anyone can tell your understanding of .NET(esp, C#) to me?

------------
Lester

Cor Ligthert said:
Lester

Simply answer, it is a next step in the evolution of that language, and than
you ask "yes and than?

It is more logical to write, however as with all evolutions are there staid
some legacy, where the users are used too however could have been as well
changed however that is not done direct.

I give no examples because that goes always to endless discussions.

Cor
 
N

Niki Estner

lester said:
a pre-beginner's question:
what is the pros and cons of .net, compared to ++

(I assume "++" means "C++"?)
You can write perfect .NET programs using C++: Types marked as "managed"
(using some cryptic new keywords) will benefit of .NET's advantages: Garbage
Collection, Reflection, language interoperability to name just a few. Plus,
you can use any managed type (e.g. types from the .NET framework library) in
your "ordinary" C++ code.
On the other hand, this also means you have another String class, another
Array class, another memory management pattern (...) to choose from - as if
C++ didn't have enough already.
That's the point where C# comes in: It sacrifices backwards compatiblity for
clarity - one string type, one array type...
I am wondering what can I get if I continue to learn C# after I have
learned
C --> C++ --> C# ??

You'd learn a modern, clean, purely-object-oriented language. If you ever
thought "why do I need all those different string types like char*,
wchar_t*, string, CString, BSTR...", then should really give C# a try.

Niki
 
S

Sean Hederman

Lester,

..NET is a platform on which programs run. You then use a programming
language (like C#, or VB.NET, or C++/CLI) to write programs for that
platform. The .NET platform is a bit different from the standard
Windows/Linux platforms, and very similar to the JVM in that there is a
unified type system, and garbage collection. Now, C++ doesn't port to this
kind of world very easily, so they created C#. C# is built with the .NET
platform in mind. It's a bit simpler than C++, and waaay easier to program
in. For that you sacrifice a little speed and a few fairly esoteric features
(goodbye MI, we hardly knew you). In many ways C# is very similar to the
Java programming language, since they both come from the C-style of families
and are both targeted at garbage-collected (or managed) environments.

As for that quote of yours about C++, that really cracked me up. I suppose
you were comparing it to C, and in that context C++ is more natural, simpler
and easier to use. I think you'll find that C# is quite a bit more natural,
simple, and easy to use than C++.

Regards

Sean

lester said:
thank you Cor,
maybe I have to study some abc about .NET before I know for whom .NET is
designed.

about C++, we should say"C++ really makes program very natural, simple,
easy
to understand, easy to maintain..., than C."
about C# we should say"????"

Anyone can tell your understanding of .NET(esp, C#) to me?
 
R

Ron Ruble

Comments inline

Sean said:
Lester,

.NET is a platform on which programs run. You then use a programming
language (like C#, or VB.NET, or C++/CLI) to write programs for that
platform. The .NET platform is a bit different from the standard
Windows/Linux platforms, and very similar to the JVM in that there is a
unified type system, and garbage collection.

Also, Lester, note that a key difference in the design of
the DotNet platform and the JVM is that the JVM was built
to support Sun's idea of the one right language, Java.
DotNet was designed to be language agnostic.

Java: any platform, one virtual machine, one language.
Tools were left to the users to work out.

DotNet: any language, one primary virtual machine, one
primary platform, but open enough to support multiple
platforms. Google for the Mono project for details.
Tools were designed by MS, largely unified tool set
for any language *


* imperfectly done, but that was the goal. getting better.
 
C

Cor Ligthert

Ron,

Java is full of English.

The real one right programming tool would have at least Chinese words
instead of that.

For me that is not necessary by the way however when you state something do
it than at least right, while have overthought what that right programming
tools would be.

Cor
 
N

Nick Malik [Microsoft]

Good point, Cor.

Why not create a simple parser/translator that can be used to preprocess the
C#. That way, a developer in China could use a localized name instead of
the english words (like 'if' and 'while'). The preprocessor can change the
names of the keywords back to english before compiling.

With a little imagination, this could work for many natural languages.
Arabic and Hebrew may be a challenging because of the right-to-left word
order, but I'm sure that could be worked out. Such a tool could make it
more natural for non-english-speaking people to write code.

Hmmmmm....

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
C

Cor Ligthert

Nick,

I write this, however don't think it is right, so forget please the idea.

When you want to know why tell that, than I will write it to you. I am a
little bit ill the last days so is it not good to answer those things when
it has to be serious as the mind is not as it should be.

(you have my email)

Cor
 
C

Cor Ligthert

I should have sent you this too your email address, however as I said a
little bit ill. I stop answering for today.

Cor
 
G

Gerry Hickman

Hi Lester,
a pre-beginner's question:
what is the pros and cons of .net, compared to C++

The first thing to understand, is that C++ is much more powerful than .NET

With C++ you can program any hardware/platform/os from the most
low-level device drivers right through to the most complex user
interface (UI) such as a professional grade drawing package, a video
editor, or a high performance game. There are also libraries available
that work cross-platform; windows/linux/solaris/mac.

..NET (other than MONO - another story) will only work on windows, is
slower, and can only be used for high-level programming. It's also
fallen into the old Java trap of having multiple vulnerable frameworks
that are incompatible with each other, meaning you can't just deploy
your project world-wide without dozens of issues related to "what
framework are your 500,000 users running?"

..NET is good for beginners, in the same way Visual Basic allowed you to
drag and drop "controls" onto "forms", you can also do this in .NET but
it's become a mess with WebForms being incompatiible with WinForms and
now they're dropping WinForms alltogether. Like any framework, the price
of being tied to the framework is often too high and can cause more
problems than it's worth - look into Longhorn and .NET 2.0 if you don't
believe me.

Even Microsoft's own technology is incompatible with .NET - for example,
see if you can write a video capture application, or a tool to
manipulate the LSA of a remote machine in .NET

If you live in the teddy-bear land of "Macromedia XP" then you'll LOVE
..NET, but if you live in the real world of Enterprise Computing, you'll
have to think twice...
 
L

lester

thank you! for your kindness and expertise.

I think I really got much knowledge of .NET before I decide to use it.

thank u very much.
 
N

Nick Malik [Microsoft]

In my opinion, you are not correct in your assertion.

In my opinion, C++ is much _less_ powerful that C# with the .Net framework.

C++ is more portable (for now), but also more expensive to use. The code is
considerably more difficult to read and understand, making maintenance costs
much higher. Libraries are needed to perform fairly basic things, and the
libraries are not available cross-platform in many cases. This effectively
defeats any advantage you have with a cross-platform language. Your comment
about asking 500,000 users what framework they have, is magnified if you
have to ask them if their platform will support 12 different libraries from
four vendors.

The code runs fast in C++, but the adding support for web services or third
party controls is expensive... and adoption is slow. C# code is very fast
as well, since it is compiled to the machine level by the framework. C++ is
faster, and isn't tied to the Garbage Collector, but it is far more prone to
memory leaks and security holes that can't be fixed easily.

C++ hasn't gone away, and it shouldn't (just yet). So many interfaces were
design for C++ that many new bits of code that have to talk to those
interfaces still should be written in C++. Those interfaces include device
drivers. However, if the OS has fundamental support for interfaces in .Net,
there is no reason that a device driver cannot be written in C#. C# is fast
enough to write device drivers.
Even Microsoft's own technology is incompatible with .NET - for example,
see if you can write a video capture application, or a tool to
manipulate the LSA of a remote machine in .NET

I've heard this argument before... in 1992, when I was working at IBM on
OS/2. IBM wanted the new OS to have all the newest technology and a better
API. Microsoft insisted that backward compatibility was important for
adoption. The partnership between the two, that had originally launched MS
into its dominant position, ended on this disagreement. IBM went the way
that you are recommending: trash the old stuff and start over with the new
technology. Microsoft produced two lines of Operating systems that allowed
better management on the server, and fast applications on the client.

Microsoft won that battle in the marketplace. OS/2 was a huge failure for
IBM, as was the PS/2 (the same argument, only in hardware instead of
software).

I was there. Microsoft made the right choice then, and they made it again
with .Net. New stuff should filter in, but old stuff has to keep running.

Oh, and to your own point, the Local Security Authority (LSA) is managed by
the LSASS service. This model is a left over from NT4. Windows server 2003
leverages the Active Directory, as does XP. If you are still using the LSA,
you are about seven years behind the times. There is no need for Microsoft
to write new APIs in .Net to support an antiquated model. Anyone who wants
to use the old API can still do so (as you know), but new users will use a
new object model that leverages new technology... a model that is secure
from hacking. Perhaps the problem is really that your enterprise has
decided not to keep up with best practices in security, and you are taking
that out on Microsoft's technology.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
C

Cor Ligthert

Nick,

Although there is not one millimeter difference between our idea's we should
stay proffesionals.

Everything you write in this is as my idea.

However
I was there. Microsoft made the right choice then, and they made it again
with .Net. New stuff should filter in, but old stuff has to keep running.

You never know if there comes somebody with something better about what you
and I did never thought about.

:)

Cor
 
C

C.E.O. Gargantua

lester said:
a pre-beginner's question:
what is the pros and cons of .net, compared to ++

I am wondering what can I get if I continue to learn C# after I have

They all have the letter *c* in them, but IMHO, they are all completely
different animals!

c: a powerful, near assembly type language, used for everything from the
hardware up through the OS ( Linux is written in Gnu c ).

c++: a hybrid language, somewhere between a procedural and an OO. It's /c/
with OO ideas that extend existing syntax like struct into classes, and so
on. In many ways, c already had the capability to do OO, but c++ exposes
it and makes it clearer. c++ is popular because it is the bedrock of the
Windows API and COM/COM++ programming. If you want to manipulate Windows
natively, Visual c++ was usually the only answer.

c#: We can't talk about c# in a vacuum, because c# is part and parcel
of .Net and all that it implies: managed code. Managed code is a machine
within a machine...it virtualizes the computer like java did, but far more
tightly ( the IL ) which allows it to support such amazing features as
Reflection.Emit and the ILGenerator.

Each of these languages requires a higher level of commitment to the
machinery that supports it...but to say that /c/ is more *advanced*
or /powerful/ than c# is silly. c# gives you the ability to manipulate
the entire computer, whether OSX, Linux or Windows, using an OO model.
That is /very/ powerful. It's so powerful, that people, again IMHO, have
not yet begun to understand it, or use it beyond what they know already.
 
J

Jeff Louie

Lester.. I would learn enough C++ to be dangerous and then go on to C#.
By
learning C++ I mean using streams and the Standard Template Library. I
would try to learn OOP and multi-threaded programming in C#. IMHO, it is
harder to reverse engineer C++ than C#, but there is nothing stopping
you
from putting your algorithm into a C++ ATL COM dll and calling it from
C#,
JScript or VB.

Regards,
Jeff
 
U

UAError

Jeff Louie said:
Lester.. I would learn enough C++ to be dangerous and then go on to C#.

In C++ you are dangerous by not learning ENOUGH of it!

If you have some programming background

"Accelerated C++: Practical Programming by Example"
by Andrew Koenig, Barbara E. Moo.
Addison Wesley Professional
ISBN: 020170353X
http://www.amazon.com/exec/obidos/ASIN/020170353X
http://www.awprofessional.com/title/020170353X

is an excellent place to start.

You'll still need this though:

C++ Standard Library, The: A Tutorial and Reference
By Nicolai M. Josuttis.
Addison Wesley Professional.
ISBN: 0201379260
http://www.amazon.com/exec/obidos/ASIN/0201379260
http://www.awprofessional.com/title/0201379260

You're probably better off learning C++ "in isolation" first
- i.e. don't immediately head for material that uses C++ in
the context of manipulating MS technologies as it tends to
be used with a "C" slant. And C++.NET is simply a "flavour"
in a managed environment, again not ideally suited to learn
standard "C++/STL" per se.

I recall that using VS6 VC++ was kind of a pain with
"Accelerated C++" as the STL shipping with VS6 was severely
outdated. With VS 2003 (VC++ 7.1) that should not be a
problem though.


'Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.'
Martin Fowler,
'Refactoring: improving the design of existing code', p.15
 
G

Gerry Hickman

Hi Nick,
In my opinion, you are not correct in your assertion.

In my opinion, C++ is much _less_ powerful that C# with the .Net framework.

I'm not sure I follow.

C++ can do everything .NET can do and a lot more besides. Maybe
"powerful" is the wrong thing to argue about? You can't really say "C#"
in the above line, because it basically means "managed code" and that
limits it just as much as VB.NET or any other "plug-in" language. (as
pointed out by "C.E.O Gargantua" below).

There's probably plenty "plus" points of .NET you could cite, but I
don't think "powerful" is one of them...
C++ is more portable (for now), but also more expensive to use. The code is
considerably more difficult to read and understand, making maintenance costs
much higher. Libraries are needed to perform fairly basic things, and the
libraries are not available cross-platform in many cases.

I hear what you're saying here, but personally I'm not convinced. The
current reality is that C++ is far more portable and has fewer
dependencies, not only across platforms, but even across Windows itself!
In terms of being difficult to read, I agree, but outside the realm of
students and beginners, the maintenance factor is a small price to pay
for not being tied to an ever-changing series of incompatible
frameworks. I'm glad I didn't invest in WinForms or Microsoft's "web
controls" for example.
The code runs fast in C++, but the adding support for web services or third
party controls is expensive... and adoption is slow.

But people are fed up with all these silly "controls"! That's why
so-called "ActiveX" was such as disaster in Internet Explorer and
Outlook Express. The idea was that people would want pop-up UI elements
bouncing out of every email, but all it did was cause a slew of security
headaches and gradually they had to be turned off, and now everyone is
grabbing Mozilla and FireFox so they can can SAFE plain-text email and
pop-up free browsing.

Regarding the "web" and "web services", it's very simple. You have HTTP,
HTML, XML and various CGI/ISAPI interfaces. Everything else is just
marketing hype from people trying to make it sound complicated. You
certainly don't need .NET to run web services.

I do agree that ASP and ASP.NET are good for web applications and web
scripting, but Microsoft's direction is now moving away from open web
standards and that means .NET will become less attractive. It's already
much more difficult than it should be to leverage x-browser DHTML in
Microsoft's .NET products, whereas it's very easy in ASP, PHP or PERL.
This is where you end up fighting with the framework; in ASP you can add
a few lines of JavaScript/css and it's done in five minutes; with .NET
you have to learn the ins and outs of an oddball "web server control"
and are tied to what it can (and can't) do. We also see Microsoft's HTA
technology (which supports open standards) moving towards XAML which
does not - another step backwards in the realm of Enterprise computing,
but pretty cool if you want to view your sales figures in a spinning 3d
cube.
C# code is very fast
as well, since it is compiled to the machine level by the framework.

Yes, but what about the FrameWork objects themselves? How many of them
are just wrappers around COM objects?
C++ hasn't gone away, and it shouldn't (just yet). So many interfaces were
design for C++ that many new bits of code that have to talk to those
interfaces still should be written in C++.
OK.

Those interfaces include device
drivers. However, if the OS has fundamental support for interfaces in .Net,
there is no reason that a device driver cannot be written in C#.

I think the word "if" is the important one here! Is this going to be
ready for Longhorn?
I've heard this argument before... in 1992, when I was working at IBM on
OS/2.

I've read all that, but this is way of the topic we were talking about.
I agree about OS/2 in the realm of desktop computers, but I don't see
what this has to do with C++ vs .NET?
I was there. Microsoft made the right choice then,

I agree.
and they made it again
with .Net. New stuff should filter in, but old stuff has to keep running.

Well I'm not so sure. Why does so much of the MSDN documentation now say
that it's "archived content"?
Oh, and to your own point, the Local Security Authority (LSA) is managed by
the LSASS service. This model is a left over from NT4. Windows server 2003
leverages the Active Directory, as does XP.

We're currently running Win2000, but as far as I know XP still uses the
LSA in the context of "Local Security Policy"? I can check this next
week. But let's assume it does NOT use the LSA for a moment.

Let's say you want to add a new Anti-Virus service account to all
workstations in the OFFICE4 OU - "User Rights Assignment". You can't use
AD and GPO, because doing so would delete all rights of the local
WSxx\ASPNET service accounts, so you have to add the account to the list
of user-rights on the actual machines. Can this be done with .NET, or
can you even list the existing ones with .NET?

I notice you avoided the question about writing a video capture (or
video editing) application with .NET - will this be ready for Longhorn?
from hacking. Perhaps the problem is really that your enterprise has
decided not to keep up with best practices in security, and you are taking
that out on Microsoft's technology.

To date we have an excellent record on security and I'm not taking
anything out on Microsoft's technology - just discussing pros/cons of
C++ and .NET (as per the subject line).
 
C

Cor Ligthert

Gerry/Nick,

What I miss in both of your articles is the background.

To explain a little bit what I mean with that can I do by telling that what
is good policy for China has not to be good policy for Monaco.

I can explain that more, however I think you both understand what I want to
tell. When not, than tell me and I explain it more.

Cor
 
D

Daniel O'Connell [C# MVP]

C# code is very fast
Yes, but what about the FrameWork objects themselves? How many of them are
just wrappers around COM objects?

Less then one might expect. I would wager that in the average window app the
amount of COM interfaces being called would be roughly equal between
framework wrappers and C++ templates, with the C++ code potentially
producing more COM interfaces(for example if you write an ActiveDocumentHost
or the like, pretty sure one of the standard windows templates does...just
forget if its MFC or WTL).

Also, out of curiosity, how does wrapping a COM object change cause code to
not be machine code?

I notice you avoided the question about writing a video capture (or video
editing) application with .NET - will this be ready for Longhorn?

Actually, you can do both now, although video editing is more complicated as
there are no clean, predefined interfaces to access DirectShow or any of the
rest of the windows codec framework. That doesn't mean tehy cannot be, it
just means you would have to do some work to do it(similarly, if the C++
headers from DirectX didn't expose any DirectShow types you'd have to
manually define the interfaces and provide classes to call them, not really
fun stuff eh?). Don't mistake the functionality not being there in the
standard package as an impliciation the function cannot be achieved. If so
C++ is pretty weak in and of itself as well.

Simple capture is maybe 200 lines of code(plus some generated interface
definitions), but only works with WIAs video acquisition mode, and thus only
with WIA capable input devices. The more complicated, DirectX capture
mechanisms would require considerably more...probably somewhere along the
lines of what you'd have to write in C++ without templates for COM support.

Now, video encoding and decoding is not something that is appropriate in
managed code as it stands now. The current JITs don't deal with SIMD
instructions well, if at all, and the runtime currently has no way to
express the concepts SIMD uses(note that C++ really doesn't nativly either,
the compiler adds extensions). Without this type of support in the runtime,
the JIT has to guess when its appropriate to attempt such work...its just
not fesible.

However, the only thing this shows, and the only thing much of your
arguments have shown, is that it is maturity, not inherent capability at
question here. C++ and x86(or any other existing CPU architecture, excluding
IA64) are quite mature, C# and the .NET VM is not(although the .NET VM was
based off java's VM, java's VM seems to have gone to great lengths to avoid
maturing its instruction set, lest incompatibilities come about).

The VM needs certain features, like a more controllable garbage collecter
and a better way to express paralelled or paralellable code. The languages
need certain features as well, including better ways to manage resources.
However the need for those features will be solved.

Anyway, as for video tools, I know of only one app written in managed code
and that only provides its UI and some other bits(I can't say I understand
exactly whats managed and whats not, most of the unmanaged stuff looks like
codecs), but that would be CleanerXL, by Discreet:
http://www4.discreet.com/cleanerxl/cleaner.php?id=124
 

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