Getting a Handle on Computer Languages, C#, and .NET - dummies

Getting a Handle on Computer Languages, C#, and .NET

By Stephen R. Davis, Chuck Sphar

Unfortunately, computers don’t understand human language, they have their own languages. But programmers can create programs in a “middle ground” language that is not nearly as free as human speech but a lot more flexible and easy to use than machine language. The languages occupying this middle ground — C#, for example — are called high-level computer languages.

What’s C#?

The C# programming language is one of those intermediate languages that programmers use to create executable programs. C# combines the range of the powerful-but-complicated C++ with the ease of use of the friendly but more verbose Visual Basic. (Visual Basic’s newer .NET incarnation is almost on par with C# in most respects. As the flagship language of .NET, C# tends to introduce most new features first.) A C# program file carries the extension .CS.

C# is

  • Flexible: C# programs can execute on the current machine, or they can be transmitted over the Web and executed on some distant computer.
  • Powerful: C# has essentially the same command set as C++, but with the rough edges filed smooth.
  • Easier to use: C# error-proofs the commands responsible for most C++ errors, so you spend far less time chasing down those errors.
  • Visually oriented: The .NET code library that C# uses for many of its capabilities provides the help needed to readily create complicated display frames with drop-down lists, tabbed windows, and background images, to name just a few.
  • Internet-friendly: C# plays a pivotal role in the .NET Framework, Microsoft’s current approach to programming for Windows, the Internet, and beyond.
  • Secure: Any language intended for use on the Internet must include serious security to protect against malevolent hackers.

What’s .NET?

.NET began as Microsoft’s strategy to open up the Web to mere mortals. Today it’s bigger than that, encompassing everything Microsoft does. In particular, it’s the new way to program for Windows. It also gives a C-based language, C#, the simple, visual tools that made Visual Basic so popular. A little background will help you see the roots of C# and .NET.

Internet programming was traditionally very difficult in older languages like C and C++. Sun Microsystems responded to that problem by creating the Java programming language. To create Java, Sun took the grammar of C++, made it a lot more user-friendly, and centered it around distributed development.

When Microsoft licensed Java some years ago, it ran into legal difficulties with Sun over changes it wanted to make to the language. As a result, Microsoft more or less gave up on Java and started looking for ways to compete with it.

Being forced out of Java was just as well because Java has a serious problem: Although Java is a capable language, you pretty much have to write your entire program in Java to get the full benefit. Microsoft had too many developers and too many millions of lines of existing source code, so Microsoft had to come up with some way to support multiple languages. Enter .NET.

Microsoft would claim that .NET is much superior to Sun’s suite of Web tools based on Java, but that’s not the point. Unlike Java, .NET does not require you to rewrite existing programs. A Visual Basic programmer can add just a few lines to make an existing program “Web-knowledgeable” (meaning that it knows how to get data off the Internet). .NET supports all the common Microsoft languages — and more than 40 other languages written by third-party vendors. However, C# is the flagship language of the .NET fleet. C# is always the first language to access every new feature of .NET.