Programming: WTH does "C" stand for?

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Noriaki

Lifer
Jun 3, 2000
13,640
1
71


<<

<< on what grounds could you argue that C++ is not OO? >>


I was never quite sure myself, but I've spoken with several java zealots who claim that C++ isn't true OO, but more like a bastardisation. I'll have to ask them next time I speak to them
>>

C++ isn't true OO. But niether is Java. Java is closer than C++, but it still has primitives.

You want *true* OO look at Smalltalk.

12.add(34); is a perfectly valid smalltalk statement. The integer literal 12, is an object.

I don't sugesst you learn to use smalltalk it's not exactly the best language ever. But there are degrees of everything.

Java has it good points, the fact that it is "closer to OO than C++" is not one of them. Pure Blind java zealots like to claim it is, but it's not.


As to C#, well that comes from microsoft, and there is just no accounting for that band of Yahoos.
 

jpsj82

Senior member
Oct 30, 2000
958
0
0


<< C# is language that borrows heavily from java, but still has pointer like c++. It also have the ability to make gui apps with the ease of vb. >>

Ok, I have only done some programming with c++ (i am a freshamn cs major), I was wondering what is the difference bwtn C# and VC++?
 
Feb 14, 2002
175
0
0
ALGOL comes from this:

Client: I need a program that can do xyz!

Jelly stained shirt wearing programmer: ok, Al GOL program right now.
 

charrison

Lifer
Oct 13, 1999
17,033
1
81
BigFatCow,

your prof is an dumb zealot. Maybe you should ask him why c++ has multiple inheritance and java does not?

And is it just a big deal that c++ have more primitive datatypes that are wrapped up in a silly cycle consuming class?
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0


<< C++ isn't true OO >>



OO purism is best left in academia. If we didn't mind incurring the overhead of objects allocated on the heap for simple arithmetic, then every language would be "pure OO." Java wraps their value types (primitives) with classes for the OO purist who just can't get over the idea of primitives. C# does the same, and integral literals are also classes. e.g.:

Console.WriteLine(12.ToString())

Obviously I wouldn't need to ToString() it as there are overloads for Console.WriteLine(), but you get the idea. They are simply value types (primitives), and are allocated on the stack vs. on the heap (reference types).



<< Ok, I have only done some programming with c++ (i am a freshamn cs major), I was wondering what is the difference bwtn C# and VC++? >>



C# is a language, VC++ is an IDE. The differences between C# and C++ are far too many to list here. Among a few...

- C++ allows for multiple inheritance, C# does not.
- .NET's base class library is based on a singly-rooted class hierarchy, you always inherit from System.Object. No such default inheritance exists in C++.
- C# always has at least one class, C++ does not.
- C++ allows for default values for arguments, C# does not.
- C# has direct support for interfaces, C++ does not (only through abstract base classes).
- C# is part of .NET, and is considered "managed code." Going into what this means would be a long discussion, check msdn.microsoft.com/net.
- C# doesn't have header files. The declaration is the definition.
- C# has direct support for external documentation generation from comments w/i the code.

Those are just a few. There are many more...
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0


<< Maybe you should ask him why c++ has multiple inheritance and java does not? >>



You're going to have a hard time arguing that languages with multiple inheritance are more OO than languages w/o. I've seen very few class hierarchies appropriately taking advance of multiple inheritance. Out of these, it would have much more feasible to inherit from a single class and implement the rest as interfaces (a la Java and C#).

Of course it's largely opinion, and if you feel that your design is more appropriate with multiple inheritance, then so be it.
 

charrison

Lifer
Oct 13, 1999
17,033
1
81
Descartes,

That is my point. It is like saying c++ is not OO because it has more primitives that are not wrapped in a class.
 

Sestar

Senior member
Dec 26, 2001
316
0
0
C# is VB.NET for C++. I wouldnt consider myself a java zealot, however I like java, VB.NET(C# with a nicer syntax) soooo much better then C++. It's so much less of a headache.
 

freebsddude

Senior member
Jan 31, 2002
298
0
0
Wow! AT is full of C/C++/Java/developer type geeks!

Q. How many developers does it take to answer why is it called C (or to fix a light bulb for that matter!) ?

:)
 

Passions

Diamond Member
Feb 17, 2000
6,855
3
0
I was told that, they chose C++ instead of D because D is a very dull and non-marketable letter. People don't really like hearing D, it has a negativity attached to it. So, naturally C++ was chosen.
 

manly

Lifer
Jan 25, 2000
13,067
3,825
136
To expand on the history of C++, yes it started as C with classes. In fact, the original C++ compiler implementations were a preprocessor to C compilers of the time.

Which is why C++ originally gained a notoriety for poor performance. The compiler technology would take years to improve. This is the same kind of myth and FUD applied to the Java vs. C++ argument today. In reality, Java can approach C/C++ performance in many areas (but not all). It's a mature platform, with some weaknesses (most notably Swing runtime look/feel/performance).

Also, if you're not a geek, you may not recognize that C++ is an attempt at geek humor.


From a skim of the replies, Descartes has probably the most honest and thoughtful information to share (not to say that some others didn't contribute as well).

One note about Java's allocation of objects on the heap. The way it's implemented in VMs is quite efficient, and has both the semantics and performance of stack-based allocation. If I were a hard-core geek, I'd have technical details or a link. ;) Go research JVMs yourself. :p

And one comment about C++ and OO. While standard C++ today can be programmed very much in an OO-style, the problem is that C++'s hybrid nature allowed it to be used in a functional programming style by many coders (even to this day). Note this was a design goal by Stroustrup. So in practical terms, it could be considered a less pure OO language based on real-world usage. To program in a non-OO style in Java, you would have to program everything in a C-like syntax with only static functions, and not call any library routines (which are largely OO code). Definitely an extremely rare occurrence.

C++'s hybrid nature actually reminds me of the managed vs. unmanaged code issue in .Net. Since M$DN docs say it's safe to write unmanaged code, people will get the poor idea that they shouldn't write only managed code if they had a choice. Same thing with pointers; if they're there, they will be misused. In Java, there was a big campaign to promote "100% Pure Java", which arguably turned out to promote best practices for writing Java code. Also, it was recently reported that the VS.Net C# compiler has a bug allowing buffer overflows in managed code. If this is corroborated as true, then .Net's much-touted security is totally suspect.

In fact, you could even program C in an OO style, but since the language doesn't provide real support, it's much more difficult. Generally speaking, if the language provides meaningful support (classes, inheritance, polymorphism, dynamic dispatch, yada yada) to write code in an OO style, then it's considered an OO language.