Where does C# stand

sjn78

Junior Contributor
Joined
May 4, 2003
Messages
255
Location
Australia
Ok, I am partly through my software engineering course and done the c and c++ subjects. But what makes C# unique to the others.

C++ is hydrid (call it what you like) of C, so where does C# fit in to the picture? I guess it is based on C, but what does it do, or won't do, as in C++ is OO whereas C is not.
 
- Elegant.
- Easy to use.
- Easy to debug.
- Forces better OO design.
- Strongly typed.
- More productive.
- Reflection > *.

EDIT:
Heck, just go read this 14 page thread on people arguing about which is better, C# or C++;

http://www.gamedev.net/community/forums/topic.asp?topic_id=200089

DOUBLE EDIT:
To be more precise with the topic; C# is its own beast, and can't be fit into any C or C++ categoy, unless you look at it from a pure syntax perspective.
 
C# was created by Anders Hejlsberg. He has a background in C/C++ as well as J++. A combination of those two languages' influence probably best represents the environment from which the language evolved.
 
Ok, then what is the majority of mainstream programs written in?

Isn't it C++? If so why, where C# would seem to be the more common sense approach going by Wryd's comments.
 
Some flavour of C is the majority. C, C++, VC++ and then there are other variations that I don't know the names off off hand.

Why doesn't everyone use C#?

It has many advantages, but some major disadvantages.

1. Currently, its platform specific. To be even more specific, windows with the .Net framework installed on it.

Now, in the future we should see .Net frameworks ported over to other platforms. There is a java based .Net framework for OS X either out or comming soon. There is also at least one version for Linux being developed. Also there is a very stripped down version of the framework on a linux distrobution for aspx (ASP.Net) support.

Now, this disadvantage quickly becomes an advantage. Once the framework spreads, your app will work on all platforms universally. Now, I think there are going to be some down n dirty OS specific incompatabilities... IE, if you make a program to do disk management for PC, many options may not have Mac equivilants.

Currently (that I'm aware of), you have to write C for a specific platform, then port over any system specific changes. Not a huge deal if done properly using OOP principles.

2. C# is a higher level programming language. You can write your own OS in C (or C++). It can do that. It can get into memory and start playing with really fine stuff. Not as fine as Assember (::shudders::) I'd assume, but much lower than .Net

You can make your own bootable programs in C. Unless they come up with a .Net framework for a computers Bios, I wouldn't bet on that sort of benefit for C#.

3. Speed.

All optimizations and competent programming granted, .Net runs, on average, just a little faster or a little slower than vb6. vb6 can be routinely trounced by the various flavours of C.

So, if you NEED more speed than .Net can give, C or C++ might be a better fit.

There is also speed of programming. From what I gather, C's lower levelness comes at a huge price. You have to start at a lower level and work your way up. Apparently C++ helped in that aspect a bit and I'm sure there are classes and packages out there to help you get some rapid development in.

I have negligable experience programming in C, so I can't rightly compare. But since VB6's advantage over C was its speed of development - especially database, and .Net is more comparable to vb6 in its application development, I'd say C# would be faster to develop in than C or C++.

I don't think C or C++ really has .Net's componant drag n drop features. I know VC++ had a flavour of it and it was clunky compared to VB6.

4. .Net is a single language.

.Net is basically a single language with VB, C#, J#, etc being more like dialects within the language.

I don't know much C# at all, but I can look at a code example in C# and know immedietly whats going on. I gather that C# has a few more options that VB doesn't have directly, but not too many.

Thats not all. ASP used to be an internet scripting language. Now its a .Net language. Better yet, you can code ASPX (or ASP.Net) in VB, C#, J#, etc.

Once you know C#, you all you have to do is learn the internet specific functions, procedures and componants and you can program in your C#.

****

Whats going to happen when Microsoft releases its' .Net native Operating System?

Right now the .Net framework itself is like an inbetween laying ontop of the OS. This is a gobetween.

I'm imagining the speed once its native...
 
You'd be correct in guessing C/C++. The C language has been around since 1972, and C++ was invented by Bjarne Sroustrup between the years 1982 and 1985 at Bell Laboratories. Given their extensive history these two languages have permeated into just about every commercial OS on the market today. As such, they maintain a huge market share.

C# in contrast, is a fairly new language, and it's based primarily on the Microsoft Windows platform (I won't speculate as to the various other projects being undertaken to port .NET to other operating systems).
 
Denaes, Just a couple of points.

1. - agree very windows based at the moment but there are steps to remedy this Project mono being one.

2. - agree again, C# is more abstracted from the physical hardware than C / C++ / ASM:eek: but this abstaraction can save a lot of pain and misery. The fact you don't need to mange memory yourself means development time can be a lot quicker and a very large source of errors has been removed (or reduced anyway)

3. here I begin to differ, have a look this thread and you will see performance actually approaches that of C++, this would put it potentially a lot faster than VB6 while still keeping a RAD model and reducing development times in comparison to a tradition C / C++ model.

As Derek says though C# is a new language, like all developments it takes time for people to properly evaluate things, finish existing projects before starting new ones, cost justifing risks in moving to new tools / languages and the associated re-skilling costs - hence the reason it's still not a common language for large projects. (Imagine the effort in moving any sizable C/C++ based project i.e. office to C#....)
 
Thats interesting... VC++.Net outperformed everything, including C!? I thought C was supposed to be faster.

C# outperformed C also. Everything but VC++.Net. Strange.

That was interesting.

So even though .Net is supposed to compile all the same way at the same speed, C# ran faster than J# and VB.Net

Far from a thurough benchmark, but it does show some math and IO comparisons.
 
So, with a different compiler, C++ and C might be in totally different places?

I've heard that the .Net languages don't compile the same, are they technically using the same compiler or does each language have its own compiler, but each modeled on a single outline?
 
Each language compiles to an intermediate language, MSIL, that
is language-independent. You can actually view this language
by using the .NET Framework SDK tool ILDASM. This is the code
that the framework executes when an app runs.

Often there will be slight differences in how code is converted to
MSIL, but it is not significant in terms of speed.
 
I know this sounds like a blowoff answer, but I wouldn't worry about speeds of ANY language at this point (maybe OOP COBOL) unless you're doing a game. For anything but pure looping and number crunching, pretty much all the major languages and compilers offer blazing fast speed. Now if you're writing a game I'd recommend C++ simply because it's the most "accepted" and would give you best chance of landing a job. While other languages might be just as fast or close (and maybe easier to use), they just haven't been as accepted yet. Maybe not the best reason to choose a language, but there are worse reasons.

As for C# becoming more "standard", .NET in general (including C#, VB.NET, etc.) is going to be the new language used by SQL Server, if MS keeps to its plan. Meaning, you'll be writing stored procs in C# or VB.NET. Once that goes live and IF it becomes accepted, that would pretty much assure the future of C# since data access code sticks around for a long time.

-Nerseus
 
Back
Top