A Brief History of Programming Languages and C#

The problem with programming is that computers think exclusively in numbers (the numbers 0 and 1, to be precise), known as machine code, while humans communicate using words. In the early days, programmers entered machine code directly into computers to program them. This, as you can imagine, was a laborious and error-prone process. The next evolution was associating brief human-readable commands with the corresponding machine code. For example, a programmer could enter the command MOV to transfer a value from one microprocessor register to another. These commands would then be translated into machine code by a piece of software called an assembler, thereby giving this command syntax the name Assembly Language.

Next came a series of high-level languages designed to make it easier for humans to write programs. These programs are written using a human-readable syntax and then either compiled to machine code by a compiler or interpreted by an interpreter on the processor’s behalf. Such languages include BASIC, COBOL, Pascal, and Fortran. Another language is C, which was created at AT&T Bell Labs in the late 1960s and early 1970s. In the late 1970s and early 1980s, work started on an object-oriented approach to C programming culminating in a new, object-oriented variant of C known as C++.

The story, however, does not end there. The problem with C++ was that it was an incredibly easy language in which to make programming mistakes. C++ would quite happily allow a programmer to make coding mistakes that would cause buffers to overflow, memory locations to be arbitrarily overwritten, and introduce memory leaks that would cause applications to bloat to the point of using up the entire physical memory and swap space on a system. Another problem encountered with C, C++, and all other compiled languages is that the source code must be re-compiled for each different processor type, making it difficult to port an application from one hardware platform to another.

To address the shortcomings of C and C++, Sun Microsystems started work on a new programming language and execution environment in the 1990s. The end result was called Java. Java consists of a programming language with many of the pitfalls of C++ removed, a portable intermediate byte code format, a runtime environment (called the virtual machine) that executes the byte code and handle issues such as memory management, and a vast suite of libraries providing all the functionality required to develop enterprise-class applications (such as networking, file handling, database access, graphics, etc).

Java gained rapid acceptance, and for a time, Microsoft began its Java “embrace and extend” campaign. Sun was happy for Microsoft to embrace Java but reached for their lawyers when they realized that the “extend” part was a plan for Microsoft to introduce their own proprietary version of the language. Politics ensued, and Microsoft eventually walked away from Java. Soon after, Microsoft started talking about something called .Net, followed by a programming language called C#.

What exactly is C#?

“What does all this history have to do with C#?” I hear you ask. The origins of the C# programming syntax can be traced back to C and C++. If you are already familiar with C or C++ (or even Kotlin or Swift, for that matter), then you have a big head start in terms of learning C#. In fact, the same can be said of syntax similarities between Java, C, C++, and C# syntax. In addition, C# also inherits many of the benefits of Java in terms of memory handling (better known as garbage collection) and an intermediate byte code that negates the need to recompile an application for each target hardware platform. C# is also accompanied by a vast framework of libraries designed to provide the programmer with readymade solutions to almost every imaginable scenario.

Despite these similarities, there are differences between the Java and C# infrastructures. The next chapter will provide an overview of the C# infrastructure.

Who is using C#?

Although some major new programming languages have been released since the introduction of C# (such as Swift and Kotlin), C# is still evolving as a language and has a vast and growing base of users.

For example, C# was ranked on the TIOBE Index in 5th place among the top 50 most widely used programming languages (eclipsed only by C, Java, Python, and C++).

C# is used to develop desktop and server applications, web-based applications, and services. It is the programming language of choice on all Microsoft platforms and is used to develop games within the Unity Real-Time Development Platform.