Impressive Source Codes That Every Developer Should See

Sometimes, developers write codes that impress the entire world and the hardware both

Shalitha Suranga
Oct 21 · 5 min read
Image for post
Image for post
Photo by History in HD on Unsplash

I usually browse Github repositories when I get free time. Also, when I start using new computer software, tools, or utilities, I like to see how the particular software works. Most of the time, I take a look at its codebase to understand how things are exactly working with internal modules and external dependencies.

A few years ago, I was checking about Python language implementation’s source code. Thereafter, I noticed several C source files and suddenly checked the GNU C compiler collection’s implementation. I found that this modern C compiler was written in C itself. Learning the internals of something and going back further in-depth give amazing feeling and great knowledge for us. Past developers have done great work to give a peaceful world for modern developers. However, as modern developers, we should appreciate their impressive work.

I noticed the following impressive works that have been done by developers around the world while I was browsing Github repositories.

Apollo 11 Guidance Program

Apollo 11 was the first successful mission that sent humans to the moon. Apollo Guidance Computer (AGC) which had only 4 kilobytes of physical memory provided support for controlling the spacecraft. Software for the AGC was written in AGC assembly language and was stored into a special read-only memory called rope memory. There were scanned copies of the source code uploaded to the internet some time ago. Thereafter, someone converted several modules into text files and uploaded them into a Github repository.

Image for post
Image for post
Piece of code from the Lunar module of AGC, screenshot by the author

The Apollo engineering team put a huge effort to reach such an amazing achievement by writing a lot of code lines in assembly language. In 1960s programming was harder than nowadays. Because, at that time, programming languages had a lesser level of abstraction. Besides, programmers had to write super-optimized codes to efficiently use hardware.

Quake III Arena

Quake III Arena is a first-person shooter game developed by id Software. It was developed in the 90s when the 3D gaming industry just started its journey using the id Tech 3 game engine. At that time the hardware resources were very limited unlike nowadays. Therefore, game developers had to write carefully optimized code for rendering graphical elements. Many game programming calculations require the vector normalization concept that brings up the requirement of inverse square root calculation. As mentioned, developers had to choose the most efficient algorithms for these computer graphics related works. Therefore, the Quake III Arena team used a very clever approach for fast inverse square root calculation like below using bit-level computations.

Image for post
Image for post
Fast inverse square root function in Quake III Arena, screenshot by the author

The level of optimization used in this piece of code and the entire code written to achieve such a nice computer game in the 90s is obviously amazing. Nowadays, game development usually doesn’t deal with this level of calculations because the physics functions are already implemented by game engines.

GNU Compiler Collection

The C programming language is like the father of modern computing because it resides very closer to the hardware also by offering a good human-readable abstraction level. Indeed, the GNU C compiler is bootstrapped. In other words, It is written in the C programming language itself by using the compiler bootstrapping concept. I noticed the longest C source file I ever saw (There can be longer C source files than this one out there, but this is the one I saw) from the codebase of GNU Compiler Collection on Github.

Image for post
Image for post
GNU C Compiler’s C parser source file has more than 20k lines, screenshot by the author

Chromium

Popular web browsers such as Google Chrome, Microsoft Edge, and Opera are based on Chromium open source project which has two major dependencies: Blink rendering engine which is a fork of the WebCore library which was developed by the Webkit team from a fork of KHTML/KJS, and v8 JavaScript engine which is developed by the Chromium project team. Undoubtedly, Chromium codebase is very large and it is having a lot of third-party modules as well such as gRPC and Skia. However, the Chromium team structured all the components in a great manner. They have separated user interface related logic and internal functions logic wisely to achieve very good maintainability factors throughout the entire project.

Image for post
Image for post
Well-organized abstract UI controls of Chromium, screenshot by the author

Moreover, this codebase consists of source codes of Chromium Android and iOS apps as well. Structuring a large-scale cross-platform application can be a bit complex. However, Chromium has an impressive separation of platform-specific code for Linux, Windows, and Mac.

Gitk

Nowadays, Git helps almost every software development team to manage the coding history and versions. Git was initially made by the founder of the Linux kernel, Linus Torvalds. Indeed, Git's codebase consists of a magical piece of work which is Gitk’s source file. Gitk is a GUI application that helps us to visually navigate through commits. We can use the following CLI command to check the difference between two commits.

$ git diff <commit hash> <commit hash>

But, Gitk allows us to see modifications so fast because it is a visual tool. Gitk’s whole source code is just one file. It is written in Tcl scripting language using Tk UI-toolkit which is an extension of Tcl. They have done great work by implementing an entire GUI app with just a single source file also by selecting a dynamic programming language for quicker GUI application development.

Image for post
Image for post
Gitk was implemented as a single source file with around 12k lines, screenshot by the author

The Startup

Medium's largest active publication, followed by +732K people. Follow to join our community.

Shalitha Suranga

Written by

Software Engineer at 99x | Apache PMC member | Open Source Contributor (Author of Neutralinojs) | Technical Writer

The Startup

Medium's largest active publication, followed by +732K people. Follow to join our community.

Shalitha Suranga

Written by

Software Engineer at 99x | Apache PMC member | Open Source Contributor (Author of Neutralinojs) | Technical Writer

The Startup

Medium's largest active publication, followed by +732K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store