Introduction to C# Programming

C# Programming for existing C and C++ programmers.

© Guy Lecky-Thompson

CSharp Code, Guy W. Lecky-Thompson

For those who are mystified by C# programming, and what it seems to stand for, here is a rapid introductionary article to help evaluate this evolving technology.

Introduction

C#, or C Sharp, is a reasoanbly recent invention. Many programmers have only just come to accept that Java is reasoanbly stable and can be used for industrial banking applications, and here is Microsoft foisting another C++ look-alike on us. Is that all C# is, though?

There is more to C# programming than that, however, and it does play a fundamental part of the .NET strategy that Microsoft is following. Notice that we have mentioned Microsoft twice in as many paragraphs, which gives us the first clue : C# is a Windows thing.

What does C# Programming involve?

C# programming looks hauntingly familiar to anyone programming in C++, Java, or even Visual Basic, although that last one is a stretch. The point is that C# is an entirely object oriented, pointer-less self-contained (self-managed) programming language.

In other words, nothing exists in C# programming outside of namespaces, classes, members and methods. So, those familiar with 'pure' object orientation should embrace C# programming. For those moving from procedural programming in the C, BASIC, Modula-2 (or Pascal) vein - be prepared for some new concepts alongside familiar ones.

Before the use of the dreaded namespace keyword scares any would-be C# programmers off, it is used purely as a way to ensure that multipart projects created by teams of programmers can separate out similarly named classes. For example, if we have a class named stream, we might find a use for it as a socket stream, file stream, or console strem.

Using namespaces, and three teams of programmers, we would then be able to come up with Socket.Stream, File.Stream and Console.Stream without ever re-using the (now key) word Stream.

Why is C# Programming better than C++ (Java, C etc.)

Mainly because there are no pointers, or fiddly resource (i.e. memory) management and garbage collection. Also, C# programming relies so much on the use of distinct classes, that it puts the programmer clearly in the obejct oriented frame of mind, which is usually accepted as a good thing.

It is also something of a reworking of C++ and Java, taking the best bits of each and delivering a language that is familiar, but different. The code ends up slightly cleaner, and using it feels rather like the Modula-2 MODULE system, but with an even more object oriented bent.

What do I need for C# Programming

Luckily, Microsoft provide a free compiler. Unluckily for many people it compiles down to .NET bytecode, rather than native binary. However, Borland also have a free C# compiler, which comes complete with an IDE and builds native binaries.

The following link contains a list of currently available C# compilers:

www.thefreecountry.com/compilers/csharp.shtml

Just bear in mind that if the Microsoft compiler is used, the end user has to ve .NET installed, and needs to frolick around in the registry somewhat in order to get it working. However, for those just getting started, it provides a low-barrier-to-entry solution for C# programming.

Why would I bother with C# Programming

So, what would the casual programmer get out of C# programming? In reality, it will prove easiest to learn of all the 'modern' languages. It would make a great teaching language if not for the heavy influences of C making it a little hard to read at first glance. However, it promotes better organisation of code, coupled with reuse, and as such is a great place to start.

For seasoned programmers, it provdes a glimpse of the future. Rather like asking, 10 years ago, why anyone would bother with Java, asking why C# programming is worth the time investment probably isn't the right question. Given Microsoft's influance in the marketplace, the question is probably - can anyone really avoid C# programming?


The copyright of the article Introduction to C# Programming in Computer Programming is owned by Guy Lecky-Thompson. Permission to republish Introduction to C# Programming must be granted by the author in writing.



Comments
Apr 5, 2007 12:27 PM
Mark Stock :
Rollback to the 1980's, and your statement might sound like this...

Given IBM's influence in the marketplace, the question is probably - can anyone really avoid COBOL programming?

Sure, IBM and Microsoft are still somewhat influential in the marketplace. However, I think it is very important not to get locked into any particular language, platform, or technology because things change, and they change quickly. That old Gartner Group survey that said Microsoft had 90% of the marketshare is outdated, skewed, and for the most part just a lie cooked up by Microsoft (who were invested in Gartner Group.) Lots of software developers are currently buying the new MacBooks, or installing Linux/BSD on their PCs. There are many more platforms in the form of cel phones, game consoles, and MP3 players -- all of these are programmable, and all of these are outselling PCs and Microsoft. The dominant web server is Linux running Apache.

Concerning computer programming languages, there are lots of new and exciting changes appearing. I would say that C# is not a dominant language at the moment and probably won't be. At the moment, Java is probably the most used language, but that doesn't mean that Java is any good. For the appropriate task, I would look at using Ruby, Python, Squeak, ML, and functional languages.
Apr 12, 2007 12:30 AM
Guy Lecky-Thompson :
Some great points : and I'm all for using appropriate languages rather than trying to shoehorn a solution into an ill-fitting environment.

However, I'm afraid that the days where programmers knowledge was like a Swiss army knife of available languages and solutions are past us. It's all specialize, specialize and specialize some more, these days!

However, people might like to turn to my 'Just Enough ...' series of books to combat this, and get enough useful knowledge to actually use a technology without becoming an expert. That way, we can leverage our experience without being tied to a platform.

The first in the series can be found at http://JustEnoughC.50webs.com - have fun!
Page:
2 Comments

Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo