PDA

View Full Version : What's the future ?


Galo
01-06-2004, 01:14 AM
Guys,

i've been browsing around here for a while now and im asking myself, what's up with the C++ and C# war ?

It seems like people who are into C++ don't like C# cause it is captured in a framework called dot net and people think you can only make webapplications with it and portable applications, or am i wrong.

well give me a awnser to this then.
If i was a young developer, just starting out, shoud i pick C++ or C# to learn graphic programming ?
And please look @ the future, is C# gonna be a replacement for C++ ?

Do they both have directX and OGL ?
Are they Both OOP ?
Do they support pointers both ?
Are you just as free (as an programmer) in C# then in C++ ?

I mean isn't c++ the base language of all computers, how can C# replace that, was C# written in C++ cause C# was not there yet so it has to be.....

And i read that C# is much less complicated and th code seems to be verry clean.

just currious ,
Galo :wavey:

playmesumch00ns
01-06-2004, 08:47 AM
No No No NO NO. I absolutely refuse to learn a new programming language as a "replacement" for my beloved c++.

Especially one designed and pushed by Microsoft. Eeuugh. You have to actually know how to use Java and C++ properly before you can start redesigning them (not that that's ever stopped them).

[ zealot mode off ]

On a serious note, yes things like C# could well be the future. You can guarantee that whatever is the future, it won't be designed by microsoft.

Point is for the forseeable future, for graphics programming C++ is king.

Once you've learnt C++, migrating to whatever its replacement might be in the distant future will be a piece of piss.

As to all your supplementary questions, I think they might be better answered by looking at one of the myriad sites that deals with c# specifically, but as far as I'm aware, the answer to all of them is yes.

StefanDidak
01-06-2004, 11:57 AM
Originally posted by Galo

It seems like people who are into C++ don't like C# cause it is captured in a framework called dot net and people think you can only make webapplications with it and portable applications, or am i wrong.


C# as part of the M$ .NET developments relies upon the CLR and the .NET class libs, yes. Then again, C# as part of relies upon an open-source flavor of a CLR and similar class libs and can't really be attributed to M$ even though they have set the pace while offering C# and the CLR as an open standard.


well give me a awnser to this then.
If i was a young developer, just starting out, shoud i pick C++ or C# to learn graphic programming ?
And please look @ the future, is C# gonna be a replacement for C++ ?


You didn't specify how far into the future to speculate. Depending on the length of the time answer to the question will differ. In the next few years it is unlikely that C# will replace C++ as THE dominant language yet will gain a very strong position in application development (especially Windows based development seeing as how the future of the OS is tied in with the .NET class libs and the CLR). In a longer distant future (let's round it at 5 to 10 years) it is without question that managed code will be more prevalent than unmanaged code but the language used to write managed code will become less relevant (managed C++, managed C#, etc.). As complexity of software design and demand on effort increases the importance of managed code will increase at an equal rate.

If you are looking specifically at graphics related development then it depends largely on the kind of development. Complex realtime state-of-the-art games will always rely on pushing the most out of the system and will not adopt managed code for most of their work. Games that are not considered graphically at the top of what's possible will adopt managed code earlier and quicker because they can afford to sacrifice a few percent of performance in order to have a cleaner and more maintainable project. If you're doing in-house tools then the choice between the two languages will depend largely on whether something is a one-shot application that will not be under any expansion or maintenance track or whether it's part of a growing and consistent toolbox and how much time and effort can be saved vs. the small sacrifice in performance. A mix of managed and unmanaged code already is taking shape as the basis of in-house developments and I suspect that will continue to grow. It also depends on whether software is aimed at a commercial market and requires a higher level of maintainability and as such managed code will be considered more interesting for companies that aim at volume markets. And of course there's the platform issue that should be taken into account seeing as how Windows will remain an early bird when it comes to managed code while the others will continue to trail behind it for the forseeable future.

What I predict is that managed and unmanaged code will blend together as part of smaller and larger projects whereby performance optimized portions will remain done in C++ while additional portions will be done in managed code where possible. The current paradigm shift isn't too different from the one that took place going from assembly to C++. While optimized portions were still written in ASM the remainder was done with C++.

My advice would be to learn C++ and keep your eyes on C#. The step from unmanaged code and C++ to managed code and C# (or managed C++ for that matter) is an easier one to make if you have gained sufficient C++ experience. The catch here is that C# is probably easier to learn than C++ because as a language C# is cleaner, younger, and carries a lot less of the confusing baggage that C++ has built up for itself over the many years. I haven't encountered anyone yet who's gone from C# to C++ but it seems that going that route will be more confusing since the first thing you'd run into are all those particularities regarding C++.


Do they both have directX and OGL ?


Both are provided through libraries, regardless of platform and tend to be language agnostic since you can use the libs through many other languages. C# and managed DirectX support looks very interesting, yet is a Windows-only stronghold. OGL and C# is a bit of a achilles heel since the support is lacking and various open-source developments are in an early stage and offer only sufficient wrappers around the original libraries.


Are they Both OOP ?


Yes, though many will argue that C++ has the worst OOP concept. I consider OOP/OOD to be part of the design while the language offers a degree of support for it. A language that is said to offer OOP can still easily be construed to create a complete sequential mess that decends into chaos. No amount of OOP/OOD support from a language will help you there. The OO model provided by C# is definitely cleaner and easier to handle and maintain but in the end it's the design of the code that defines how much the OO model assists (or frustrates) the developer.


Do they support pointers both ?


Yes. Though pointers in C# are rarely used and would require the use of unsafe code blocks. There's nothing to stop you from using them in C# but the longevity of pointers seems to be heading for a slow death in the realm of managed code.


Are you just as free (as an programmer) in C# then in C++ ?


Define freedom. :)

Depends... you're free in C++ to create a mess while C# will provide you a battle if you really want to create a mess. I guess in that sense C++ offers more freedom. However, that's at the syntax level that defines the language. When it comes to actual development activities, getting into subclassing, inheritance, polymorphism, events, delegates, exceptions, etc. it looks like C# offers more freedom to implement the design without putting too many boundaries on how you wish to get the job done.


I mean isn't c++ the base language of all computers, how can C# replace that, was C# written in C++ cause C# was not there yet so it has to be.....


Over at M$ they have managed to write the C# compiler in C#. Always a good test for a language and its compiler seeing as how quite a few C++ compilers were written in C++. C++ isn't a 'base' language per-se seeing as how C++ kicked ASM off its throne many years ago and is now starting to be kicked around itself a bit. The nice thing with compilers and languages is that you can, in practice, build a compiler for a language in that very same language. C++ has gained the status as the standard for most development, that's all. And standards undergo a paradigm shift every number of years in relation to the shifts computer technology itself makes. C# is aiming (and starting to) replace C++ in the areas where the most benefits can be gained from it (areas where complexity and maintainability under budget constraints are the predominant factors that influence the development efforts). But it'll be another 5-10 years before managed code will be the new standard for application development. And even then there'll still be folks doing parts in C++ when needed just like there were folks still using ASM a few years ago where it mattered to their performance requirements.


And i read that C# is much less complicated and th code seems to be verry clean.


I would agree on that. The code is cleaner due to the cleaner syntax, therefor easier to read and thus offers more effective maintenance. It's still possible to write C# code that appears manually obfuscated but it takes more effort to do that while C++ offers many more ways to design something unreadable. It depends a lot on the programmer and the design, though.

ngrava
01-06-2004, 07:38 PM
I love this description:
Java And C# :The Gremlin And Pacer Of 21st Century Computing (http://io.kicks-ass.net/JavaAndCTheCodeGremlinAndPacerCodeOf21stCenturyComputing.html)

-=GB=-

ngrava
01-06-2004, 08:55 PM
Ok, sorry about that. I couldn't get that url to work so I'll just post what the guy said:

"A digital computer consists of two major sub-systems, a physical machine and a virtual machine. The purpose of the physical machine is to shuffle electrons. The purpose of a virtual machine is to make it easier to manipulate the physical machine, i.e., it's an abstraction of the physical machine.

The typical virtual machine constains several sub-systems among them a kernel, which abstracts physical sub-systems and languages, which abstract machine instructions. High-level languages, e.g., C, C++, Pascal, are macro-assembler languages, i.e., they abstract assembly language. HIGHER-level languages, e.g., Io, Python, Ruby, are macro-high-level languages, i.e., they abstract high level languages. Typically, these languages provide a virtual machine upon which to execute system-neutral byte-code programs known as scripts. This virtual machine is an abstraction of the entire virtual machine, i.e., its part of a Russian Doll scheme.

Java tries to have a foot in both worlds, i.e., not only does it try to provide the same semantics as C++ but also provides a virtual machine. Because of this dichotomy, Java programs are as complicated (NOTE: not complex) to write as C++, which diminishes, significantly, the reason d'etre of a HIGHER-level language.

C# is essentially the same thing as Java. It has its fingers in both pies and it exists to support the business lines of a particular company. Java and C# are lateral technologies, which hinder the growth of computers as products. They're like the bad cars Detroit produced in the late 70s in response to the second OPEC oil embargo. Do you remember the Ford Mustang II, the AMC Pacer, the Chrysler K-Car and the GM Chevy Citation?

I do. They were junk!"


I just thought it was kind of funny and reflects some of my personal beliefs
-=GB=-

StefanDidak
01-06-2004, 09:29 PM
Originally posted by ngrava
I just thought it was kind of funny and reflects some of my personal beliefs.

What's your belief on other superior technologies that didn't become or remained the standard, like say, 8-track tapes and Betamax when compared in relation to C#, though. That'd really be interesting. In the meantime I'd like to order two bottles of whatever the guy was having while crafting the masterful combination of words to describe something essentially simple. :)

My belief is that crappy cars dominate the roads... sad but true.

Galo
01-07-2004, 10:00 AM
StefanDidak, Ngrava

Thanks man to take the time for you're awnsers i appreciate that.
Anyway, im gonna stick to C/C++ and wil keep my eye on C#, although i don't think that there are a lot of people who trust this whole dot net concept, cause it's M$.

Galo.

elam
01-08-2004, 03:38 PM
Hey Stefan,

Can you explain what you mean by managed code?

StefanDidak
01-08-2004, 03:57 PM
Originally posted by elam
Can you explain what you mean by managed code?

Sure. :)

In a nutshell...

Managed Code is the code that is executed through the CLR (Common Language Runtime), which is the case with code generated by .NET enabled langauges (or any other language that compiles to IL-code instead of machine code). C# generates managed code, C++ has the ability to generate managed or unmanaged code, etc.

Managed Code has a a form of "meta-data" associated with it that allows the CLR to locate the entry points for methods, properties, etc. (as opposed to the old style mangling where entry points were managed by v-tables and would cause incompatibility issues when updating DLL's, would cause breakage of SDK's that have their client-code depend on the v-table entries). Basically it's a way out of the typical M$ DLL Hell that belongs in the past.

Managed Code can access managed or unmanaged data (and unmanaged code through Interop) and allows managed data to be managed by the CLR's memory management and garbage collection (which essentially frees the developer from the tedious tasks of memory management and reduces the overall source overhead and bugs that are tricky to catch).

The IL (Intermediate Language) is a form of assembler code that has a higher level of abstraction and is not at the same low(est) level as assembly instructions. Instead the IL instructions are handled by the CLR which will execute them. This process also includes a lot of interesting benefits such as optimizing the instructions on the fly during execution and run-time (JIT, just-in-time compilation which takes place based on predicting the code execution path).

Managed Code also allows for applications, especially large complex ones, to be language agnostic whereby it doesn't matter how potions of managed code are accessed through other languages that compile to managed code). You could, for example, write libraries using C#, then use them in Phyton.NET as if they were native libs. None of that COM 'crap' that M$ made developers endure for far too long.

Another thing managed code helps abstract for the developer are target platforms and optimization. Normally you compile for a specific target architecture and in the past we've been in situations where we would end up with a few specific builds that were optimized for Intel, AMD, P4-specifically, etc. Using managed code the CLR takes care of that so it also helps relieve the overall target builds.

CGTalk Moderation
01-17-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.