Source files and build scripts for my personal website
git clone
Download | Log | Files | Refs | README (4667B)

      1 # Why C?
      3 Love it or hate it,
      4 [C]( has
      5 consistently been one of the most popular languages for the last
      6 50 years or so. How did it become so popular? And why are people
      7 (like me!) still using it?
      9 ## Quirky, flawed, and an enormous success
     11 I have recently read
     12 [this article](
     13 by Dennis Ritchie. Besides summarizing the history of the language,
     14 in this paper Ritchie also tries to answer our first question. He
     15 gives four reasons for C's success:
     17 ### UNIX
     19 C was the system language of UNIX, and the popularity of UNIX in
     20 the 70's and 80's made C popular too. In other words, UNIX was the
     21 [killer app]( of C.
     23 ### Simplicity
     25 Ritchie phrases the simplicity of C in terms of how close it was to
     26 machine instructions while still being sufficiently abstract. This
     27 means that C compilers are easy to write, and the language could be
     28 ported easily to different systems.
     30 ### Pragmatism
     32 C was designed with a concrete goal in mind, not as some kind of
     33 abstract, ideal programming language. It was always in touch with
     34 the "real world" and the needs of programmers.
     36 ### Stability
     38 Despite some changes throughout the years, C has always remained
     39 remarkably stable and free of proprietary extensions.
     41 ## Why did I choose C?
     43 In 2019 I began working on a
     44 [Rubik's cube solver](
     45 At the time I had basic or intermediate level knowledge of multiple
     46 programming languages, but I was not an expert of any of them. I
     47 considered many languages for this project, including C, C++, Java,
     48 Python and Rust - this last one I did not know at the time, but I
     49 have wanted to learn it since 2013 or so.
     51 In the end I picked C, and these were the main reasons:
     53 ### Ubiquity
     55 Since my program was going to be relevant to a small nice of people
     56 who are not necessarily programmers, I wanted it to be as accessible
     57 as possible in terms of required infrastructure (compiler, libraries).
     58 Sure, I could provide *some* compiled executables, but not for all
     59 systems. It would be much easier if people could just type `make`
     60 or `./`, and then run my program.
     62 C compilers are everywhere, while the same cannot be said of e.g. Rust.
     64 ### Simplicity
     66 Since C is a simple language, knowing a bit of C means knowing quite
     67 a big portion of it, in contrast to, say, C++. For this reason C
     68 was the language I was more confident picking up to start a big
     69 project, despite having more experience with Java or C++ at the
     70 time.
     72 ### Stability
     74 I don't like to re-learn my language every couple of years for a
     75 project that I am working on in my spare time.  Backward-compatibility
     76 is a thing, but, as languages introduce more features, the preferred
     77 idiomatic way to do certain things changes, and old code starts to
     78 "smell" without any good reason.
     80 [RANT]
     82 *Python2 was killed and now a bunch of tiny programs (mostly
     83 [Project Euler]( solutions that I have
     84 no reason to "port" do not run anymore :( I want my print statements
     85 back!*
     87 *It seems Java has a new way of doing GUIs every time I look at it.
     88 When I read my first Java book,
     89 [AWT]( was the
     90 standard. When I read a second book,
     91 [Swing]( was all the rage.
     92 Then I went to university and they taught me
     93 [JavaFX](*
     95 [/RANT]
     97 ### Performance
     99 I knew from the start that performance was going to be important
    100 for this project, not only from the algorithmic point of view but
    101 also from the low-level side of things. I needed manual memory
    102 management and little overhead. This ruled out Java and Python.
    104 ## Conclusion (and memes)
    106 I think there are some interesting similarities between the reasons
    107 of C's success acoording to Ritchie and the reasons I picked it for
    108 my personal project. I don't consider myself a C expert, and I know
    109 even less about the other languages I talked about in this post,
    110 so take my opinion as it is.
    112 Instead of pretending to be more knowledgeable than I am and writing
    113 some clever and insightful conclusion for this post, here is a short
    114 list of memes and folklore about the C programming language.
    115 If you know more of them send me an email and I'll update the list!
    117 * [[YouTube, song] Program in C](
    118 * [[YouTube, song] Write in C](
    119 * [[Text] Linus Torvalds on C vs C++](
    120 * [[Wikipedia] Duff's device](