3

I often wondered why C Language is taught as the basis of programming languages everywhere. There are a lot of modern languages like Java, Python etc. which makes the syntax and programming easier. Why are we still holding the C Language up in the front as the basics of programming languages?

2

4 Answers 4

10

It's not taught as the basis of Programming Languages. It's taught as the basis of how the machine works.

A programming language displays some facade to the programmer. Some abstraction. In functional languages it is functions. In logic languages it is logic. In OOP languages it is objects. In C it is the machine.

C, while hiding away the implementation details of the hardware on which it runs (register names, memory management, etc), gives the user the impression it deals with a machine. A computer. This gives students better appreciation of how the computer works. Some universities don't see "how the computer works" a necessary knowledge (it isn't), so they don't teach C.

4
  • 3
    Those universities should teach C. They should also teach more about databases and transaction processing principles. Dec 28, 2014 at 9:52
  • 1
    @Craig As a placement student who started work 7 months ago for a year, there's a lot they should teach. I've learned more in the past 7 months than I've learned in the past two years at Uni so far. Dec 28, 2014 at 16:37
  • @Niccolo All very valid points you put up. But isn't it very generally true for all programming languages? I think you can add why C is better at abstracting... than other modern mid level to high level languages. Jan 17, 2015 at 10:26
  • @Gaurav Ramanan: No, it's not generally true to say that programing languages in general want to present the user with some abstraction of a machine. For example, when you use Haskell you "forget" about the machine. Prolog too is an example. But you do have valid points in that (1) many mainstream languages nowadays aren't very original and inherit the "there's a machine underneath" model, and (2) programmers often need to think of efficiency and can't quite escape the "there's a machine underneath" fact.
    – Niccolo M.
    Jan 18, 2015 at 22:58
9

Basically C is Every Programming Language minus the Frills.

For someone new to the world of Programming concepts like Polymorphism, Event Driven programming, Object Oriented Programming just don't make any sense.

Remember that for a long time Computer Science existed inside Mathematics until the hardware technology was brought to the world. So now, you need a way for people to instruct the computer to achieve a certain objective. Most introductory level courses start by teaching how to implement a simple algorithm (like a Fibonacci Sequence or Factorial or whatever) as a computer program. You start with things like loops, conditions, functions, arguments etc. Instead of Interfaces, Classes, Singletons etc.

Things like Object oriented programming, Closures etc are a way to manage your code and architect your software application. Its the loops, conditions and arithemetic that actually do the real work! C is really good at teaching these things helped by the fact that There is a small, fixed number of keywords.

Less Language Learning, more Language Using.

When you learn C you automatically learn other languages.

C has been the inspiration for many many programming languages that have similar syntax. Personally I came from C to JavaScript and I felt right at home. According to Wikipedia

C influenced AMPL, AWK, csh, C++, C--, C#, Objective-C, BitC, D, Go, Rust, Java, JavaScript, Limbo, LPC, Perl, PHP, Pike, Processing, Python, Seed7, Verilog (HDL)!

When one tries Java / PHP / JavaScript / C++ after C, they just learn some new concepts like OOPS, Closures (or forget some like static typing) and don't re learn loops, conditionals etc.

C is still in rampant use today.

C is used for System Programming, Developing OSes, Developing Servers, Databases, even Browsers and Virtual Machines.

C is blazzzingly fast!

The world's most performant Servers are written in C. Statistical, Mathematical and other Computationally intensive environments are written in C. The GNU Multi-Precision Library, the GNU Scientific Library, Mathematica, R language and MATLAB are completely or partially written in C

C has been used to actually make (not just influence) more languages.

You can find parsers for almost any language in C. The primary implementations of Python (CPython), Perl 5, R and PHP are all written in C!

C is almost exclusive for writing Device Drivers.

Whether Linux, Windows or Mac there is a great demand for C Engineers in Hardware companies and Software Companies making OSes for development of device drivers.

C is almost exclusive for writing code in Embedded Environments.

All your Micro Controllers, System on a Chip, and other Embedded hardware is written either in Assembly or in C. Infact this is a reason why many Electronics majors are also taught C.

The next great language will be again based off of C.

That doesn't sound too unreasonable. C was appeared in 1972. C++ appeared 11 years later. JavaScript appeared 23 years later and C# arose 28 years later! All of them very strongly linked to C. C has withstood the test of time and there is still many more C like languages to come.

C will teach you theory and application.

Most importantly, the responsibility of an academic setup is not just just to teach you skills the industry needs, or you would need for a job but also equip you with enough theoretical and analytic skills so you can still stay relevant navigating the changes of the future.

2
  • 1
    C is a family of dialects which feature different trade-offs between the cost of providing different features or guarantees and the value to programmers of those features or guarantees. The Standard specifies a rather anemic common core, but historically 99% of compilers have supported certain behavioral guarantees beyond those required by the Standard, and until 2009 I don't think there was any reason to believe that such guarantees would not continue to be treated as normative. If too many students are taught that respectable compilers require (x<<y) | (x >> (31-y) >> 1) rather than...
    – supercat
    Aug 6, 2015 at 19:21
  • 1
    ...(x<<y) | (x >> (32-y)), the days of C as a usable language will be numbered. If students are taught that there are different dialects of C, code using features common to 99% of dialects prior to 2009 can often yield better performance than not using such features, but that writing code in clunky and hard-to-read fashion will make it compatible with hyper-modern compilers that promise to make it faster but in some cases might not be able to achieve even 2009-level performance, then the language might be able to recover from such insanity.
    – supercat
    Aug 6, 2015 at 19:29
4

I wouldn't say that c is taught as "the basis of programming languages" very much, to be honest. Most introductory programming courses are in Java, with a handful in more esoteric languages (I know of universities that teach their intro to programming courses in ocaml and scheme, for example). Even before the shift to java, C wasn't a popular choice for a first language; my course taught Pascal, for example, and I believe this was reasonably common.

What C is popular for is courses on low level programing, where hardware interaction is required, and there's a good reason for that: few other languages are capable of handling that kind of job well, and C is ubiquitous in the embedded development industry.

1
  • 1
    By "esoteric" you mean "non-mainstream"?
    – Giorgio
    Dec 28, 2014 at 11:29
0

C is often taught as the first language and often together with some other computer science course. It makes the understanding of the compsci easier and you also are closer to the hardware then Java and other languages.

3
  • 3
    This answer does not add anything beyond what has been said already. Dec 28, 2014 at 11:07
  • Who exactly teaches C as a first language? I haven't come across such a course for years, now.
    – Jules
    Dec 28, 2014 at 22:25
  • C is not taught as the first language rather as a introduction to programming languages
    – CodeIt
    Dec 29, 2014 at 11:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.