Java vs. C#
Up Introduction Java vs. C# Grading Course Material Software Syllabus Problem Sets

 

You might have heard of the programming language called Java, since it has gotten a lot of press in recent years, perhaps more than any language ever.  Much of this attention is unfortunately hype, but nevertheless, Java is a good programming language, and has many pedagogical advantages over other languages.

Sun was the company that introduced Java, and understandably it wanted to control its design and evolution.  Unfortunately, Microsoft also wanted a piece of the action, and in particular wanted to change Java in certain ways that suited its needs.  This situation became a legal nightmare, and eventually Microsoft decided that instead of trying to influence Java, it would simply design its own language, which is called C# (pronounced "C sharp").  This is the language that we will be using in CS-112.  It is better than Java in certain ways, but is so similar in most ways that once you have learned how to program in C#, it will be trivial to transfer your knowledge to Java.

You may have also heard of other programming languages, such as BASIC, Visual Basic, C, C++, Ada, Lisp, COBOL, FORTRAN, Haskell, ML, Python, Pearl, JavaScript (which is very different from Java), and others.  Although all of these languages are billed as "general purpose," some are better at certain things than others, and thus one's application often dictates one's choice of a language.  For example, in the Computer Science Department at Yale, FORTRAN is taught in CS-130 (for scientific computing), C in CS-323 (systems programming), Lisp in CS-470 (artificial intelligence), Haskell and ML in CS-429 (functional programming), etc.  Java and C# are usually billed as being good at programming the World Wide Web (WWW), i.e. the Internet.

But it so happens that Java and C# are good general-purpose programming languages suitable for much more than just the Internet.  They use many recent innovations in programming language design, yet are also simple enough to use in a course such as CS-112.  Furthermore, once you know one programming language, it is much easier to learn another.  Java and C# have many attractive characteristics, including:

bulletSimplicity.  Their relative simplicity is their prime attraction as an introductory programming language.
bulletSafety.  Java and C# were designed to be robust.  Their type systems are a major source of this robustness, and the absence of pointers removes one common source of problems.  They also provide exception handling and other methods for creating programs that are less likely to crash.
bulletCost.  Free implementations of both Java and C# are available.
bulletCross-platform.  A Java program written for one platform, such as a PC or Mac, will run on any other Java platform automatically.  Java programs are compiled into platform-independent byte-codes.  C# is not quite as platform-independent, but should at least run under Windows and Mac OS-X (but not Linux).
bulletObject-oriented.  In Java and C#, (almost) everything is an object.   In fact, there are no functions or procedures -- just class methods.  C#'s treatment of objects is a bit more uniform than that of Java.
bulletClient-Server and Network support.  Java and C# applets are client-server programs that run on the Internet.
bulletMultimedia support.  The standard Java and C# libraries have support for graphic images, animation, and sound.
bulletUbiquitous.  Java and C# applications are spreading throughout the Internet.  Students learning these languages can find numerous examples, as well as employment opportunities.
bulletRelated to C/C++.  Java and C# are perhaps 75% of C++, and vice versa.  Students who already know C or C++ will have little difficulty learning Java or C#.   Students who learn Java or C# first will have little difficulty picking up C or C++.