Language Roots

Where does C# get its roots?

Most C# developers would say it’s a descendant of C++, but is that the case?  Did we really get our heritage from C and C++?

Here’s a comparison for you:

  C++ C# Modula-3
Single Inheritance   X X
Multiple Inheritance X    
Interfaces   X X
Safe/Unsafe Code   X X
Generics   X X
Templates X    
Garbage Collection   X X
Exceptions   X X

While some of the features above are more runtime features than language features (say, garbage collection), I think they are valid for the comparison.  The choice to exclude memory management features from the language dictates (to an extent) the runtime environment.  I’ll save that for another post sometime I suppose.

Oh, and Modula-3 also shipped with an AST (Abstract Syntax Tree) implementation.  CodeDOM anyone?

For the interested, you can take a quick glance at the following language families:

  • BCPL (Basic Combined Programming Language)- The family to which C and C++ belong
  • ALGOL – The family to which Modula-3 and C# belong (along with its .NET siblings)
  • The mathematics based languages, such as Lisp

It seems that a large portion of what we think of as Microsoft’s .NET was really designed by Digital (later to become Compaq, later to become HP).

An interesting side note of Modula-3 is that simplicity was a major goal of the language.  The designers gave themselves a mandate to produce a language which could adequately be described in 50 pages or less.

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

6 Responses to Language Roots

  1. I think I took a Modula-2 elective in college (back in the 80′s). who knew that I’d be coding in a derivative of that language today.

  2. John says:

    *hmpf* java *hmpf*

  3. JC says:

    *cough* delphi *cough* :-)

  4. I always thought that .NET in general, and C# in particular, had it’s roots in Sun’s lawsuit against Microsoft in the late 90′s over Java.

    Of course, this is pure speculation on my part, with nothing to back it up.

  5. jlockwood says:

    First off, to JC: Delphi? What are you thinking!?! C# is so not Pascal (lol).

    I think it may be a bit of a stretch to assert that C# is a descendant of Algol. It’s easier to see Algol in the pedigree of languages such as Modula-3 and Pascal. Basic descended from Fortran, but later took on many Algol-like features.

    C# (as Java), on the other hand, seems clearly to be derived from C. Garbage collection, (religious) use of interfaces, single inheritance and ‘safe code’ were all inspired by Java. Bell labs also added exception handling when defining the C++ language (a correction to the table above). Also, one could argue that templates and generics are quite similar syntactically (although quite different in execution)…and generics are new to the language in any case, so can’t be used to define direct ancestry.

    When I first read the C# white papers in the late 90s C# looked very much like Java to me (even parts of the API), while adding features that I missed from C++ (such as operator overloading). I also found, as a Java developer at the time, that the move to C# was quite easy. I also believe Tom is correct that the advent of C# was born out of the Microsoft/Sun battle over J++. More info can be found in this 2001 article comparing Java to C#:

    And then there’s the name…C#…which seems to be using the syntax for a half-step in music. This communicated to me that the language promised the elegance of Java while maintaining much of the power of C++.

    That being said, it’s impossible to deny the influence of Algol-based languages (as well as others such as LISP) on the continued development of the C# language. Although C# does not support multiple inheritance, it does seem to implement it (figuratively).

  6. Evan says:

    Well, considering that both pascal and java were both influenced by Modula-3 (if you believe wikipedia), and that Modula-3 predates Java by a number of years, I think the argument is more of direct decendency. Ultimately, whether it’s the father or the father’s father doesn’t matter to me.

    As for the comment on Delphi, given that Delphi is Object Pascal, and pascal was also influenced by Modula-3, there’s no surprise there for me (also given Anders background).