Home > Articles > Programming > C#

Why C#?

Discover what C# can do for you. Learn how this Web-friendly, object-oriented language came to be and why it is considered to be the language of choice for systems software design by today's industry experts.
This chapter is from the book

This chapter is from the book

Introduction

On your mark, get set, GO! That pretty much describes how quickly and easily you are about to begin understanding and writing C# (pronounced C-sharp) code. Whether you are new to programming, or an old-salt at it, Microsoft's new, refreshing, powerful, and fun programming language, C#, will make a believer out of you!

Fun? Yes! C# provides the ease of GUI (Graphical User Interface) design and layout that has been available to Visual Basic programmers for years. This component of C# allows you to visually create an application or applet user interface by simply clicking on a control toolbar, dragging a control onto a design page, and setting the control's properties from intuitive drop-down lists.

With more of today's programs demanding a financially profitable and educationally informative Web presence, C# stands poised as the pinnacle of development languages. Incorporating the best of Java or J++, CGI, PERL, C/C++, and Visual Basic with the architecture independence of Java's bytecode, or native code format, code solutions have the potential to endure and evolve without total rewrites.

No longer will a Web-enabled solution require a Visual Basic programmer for interface design, a C++ programmer for pure, raw, data-crunching horsepower, and a Java, CGI, or PERL expert to make an entire package available worldwide.

To see just how familiar C# syntax is to today's state-of-the-art programming languages take a quick tour of Chapter 2, "Unique C+," then come right back to this chapter. What follows is a very brief but interesting history of programming languages leading up to the development of C#.

It All Began with Algol

Algol, CPL, BCPL, B, Basic, PL/I, Assembly Language, COBOL, Fortran, PL/I, Pascal, Modula-2, Ada, SmallTalk, Lisp, Java, J++, CGI, PERL, Visual Basic, C, C++, and now C#—the list is quite impressive. Why are there so many languages? Why can't someone invent one language to do it all? Which programming language or languages should I learn? Where will this all end?

C# is an easy-to-learn, easy-to-use, all encompassing problem solver. Before delving into this new language, let's take an historical look at how C# evolved. This journey will answer all of the questions posed in the previous paragraph.

As we look back, you will discover the roots and building blocks of many of today's languages. This information allows us to properly use these new development tools by explaining where each fits into the big picture. You will explore many individual language features that are included in C#. Reading between the lines of the travelogue you will also uncover secrets to predicting how programming languages will advance in future evolutions and/or revolutions!

Why I See C in C#!

A study of C's history is worthwhile because it reveals the language's successful design philosophy and helps you understand why C# may be the language of choice for years to come. Our archaeological dig for the origins of the C# language begins with Algol 60.

Algol 60 appeared in 1960 only a few years after FORTRAN was introduced. This European-based language was more sophisticated and had a strong influence on the design of future programming languages. Its authors paid a great deal of attention to the regularity of syntax, modular structure, and other features usually associated with high-level structured languages. Unfortunately, Algol 60 never really caught on in the United States. Many say this was due to the language's abstractness and generality.

The inventors of CPL (Combined Programming Language) set out to bring Algol 60's lofty intent down to the realities of an actual computer. However, just as Algol 60 was hard to learn and difficult to implement, so was CPL, which led to its eventual downfall. Still clinging to the best of what CPL had to offer, the creators of BCPL (Basic Combined Programming Language) wanted to boil CPL down to its basic good features.

When Ken Thompson, of Bell Labs, designed the B language for an early implementation of UNIX, he was trying to further simplify CPL. He succeeded in creating a very sparse language that was well suited for use on the hardware available to him (namely the DEC PDP-7, with an impressive 8-bit register size [small grin]!). However, both BCPL and B may have carried their streamlining attempts a bit too far; they became limited languages, useful only for dealing with certain kinds of problems.

As an example, no sooner had Ken Thompson implemented the B language on the Dec PDP-7 than a new machine, called the PDP-11 (a 16-bit word-size), was introduced. While the PDP-11 was a larger machine than its PDP-7 predecessor, it was still quite small by today's standards. It had only 24 K of memory, of which the system used 16 K, and one 512 K fixed disk. Some thought it was given to rewriting UNIX in B, but the B language was slow because of its interpretive design. There was another problem as well: B was byte-oriented, but the PDP-11 was word-oriented. For these reasons, work began in 1971 on a successor to B (just the Basics), appropriately named C (the Combined best of its predecessors).

At this point we need to discuss the UNIX operating system, since both the system and most of the programs that run on it are written in C. The UNIX OS was originally developed at Bell Laboratories in Murray Hill, New Jersey. By design, this operating system was intended to be "programmer friendly," providing useful development tools, lean commands, and a relatively open environment. However, this does not mean that C is tied to UNIX or any other operating system or machine. The UNIX/C co-development environment has given C a reputation for being a system programming language because it is useful for writing compilers and operating systems. C is also very useful for writing major programs in many different domains.

Dennis Ritchie is credited with creating C, which restored some of the generality lost in BCPL and B. He accomplished this through a shrewd use of data types, while maintaining the simplicity and direct access to the hardware that were the original design goals of CPL.

Many languages developed by a single individual (C, Pascal, Lisp, and APL) contain a cohesiveness that is missing from those created by large programming teams (Ada, PL/I, and Algol 60). It is also typical for a language written by one person to reflect the author's field of expertise. Dennis Ritchie was noted for his work in systems software—computer languages, operating systems, and program generators.

Given Ritchie's areas of expertise, it is easy to understand why C is a language of choice for systems software design. C is a relatively low-level language that allows you to specify every detail in an algorithm's logic to achieve maximum computer efficiency. But C is also a high-level language that can hide the details of the computer's architecture, thereby increasing programming efficiency.

C versus Older High-Level Languages

At this point you may be asking, "How does C compare to other programming languages?" A possible continuum is shown in Figure 1–1. If you start at the bottom of the continuum and move upward, you go from the tangible and empirical to the elusive and theoretical. The dots represent major advancements, with many steps left out.

Figure 1-1Figure 1–1 Theoretical evolution of programming languages.

Early ancestors of the computer, like the Jacquard loom (1805) and Charles Babbage's "analytical engine" (1834), were programmed in hardware. The day may well come when we will program a machine by plugging a neural path communicator into a socket implanted into the temporal lobe (language memory) or Broca's area (language motor area) of the brain's cortex.

The first assembly languages, which go back to the original introduction of electronic computers, provided a way of working directly with a computer's built-in instruction set, and were fairly easy to learn. Because assembly languages force you to think in terms of hardware, you had to specify every operation in the machine's terms. Therefore, you were always moving bits into or out of registers—adding them, shifting register contents from one register to another, and finally storing the results in memory. This was a tedious and error-prone endeavor.

The first high-level languages, including FORTRAN, were created as alternatives to assembly languages. High-level languages were much more general and abstract, and they allowed you to think in terms of the problem at hand rather than in terms of the computer's hardware.

Unfortunately, the creators of high-level languages made the fallacious assumption that everyone who had been driving a standard, so to speak, would prefer driving an automatic. Excited about providing ease in programming, they left out some necessary options. FORTRAN and Algol 60 were too abstract for systems-level work; they were problem-oriented languages, the kind used for solving problems in engineering, science, or business. Programmers who wanted to write systems software still had to rely on their machine's assembler.

In reaction to this situation, a few systems software developers took a step backward—or lower, in terms of the continuum—and created the category of machine-oriented languages. As you saw in C's geneology, BCPL and B fit into this class of very low-level software tools. These languages were excellent for a specific machine but not much use for anything else; they were too closely related to a particular architecture. The C language is one step above machine-oriented languages but still a step below most problem-solving languages. C is close enough to the computer to give you great control over the details of an application's implementation, yet far enough away to ignore the details of the hardware. This is why the C language is considered at once a high- and low-level language.

Advantages of C

Every computer language you use has a definite look to its source code: APL has its hieroglyphic appearance, assembly language its columns of mnemonics, and Pascal its easily read syntax. And then there's C. Many programmers encountering C for the first time will find its syntax cryptic and perhaps intimidating. C contains very few of the friendly English-like syntax structures found in many other programming languages. Instead, C presents the software engineer with unusual-looking operators and a plethora of pointers. New C programmers will soon discover a variety of language characteristics whose roots go back to C's original hardware/software progenitor.

If you are already familiar with C/C++'s set of operators, you will be happy to know that C# uses the same definitions. Or, if you are learning C# for the first time, you will summarily learn C/C++'s operator set. And, since there will still be ample opportunity for your C# application/applet to interface with C or C++ code, you'll reap a double benefit.

At this point it is helpful to review the origins and history behind Ken Thompson's B language, a direct predecessor to C. Following is a comprehensive C lineage:

Language

Origins/Inventor

Algol 60

Designed by an international committee in early 1960

CPL

Combined Programming Language; developed at both Cambridge and the University of London in 1963

BCPL

Basic Combined Programming Language; developed at Cambridge by Martin Richards in 1967

B

Developed by Ken Thompson, Bell Labs, in 1970

C

Developed by Dennis Ritchie, Bell Labs, in 1972


Then, in 1983, the American National Standards Institute (ANSI) committee was formed for the purpose of creating ANSI C—a standardization of the C language.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020