avatarShalitha Suranga

Summary

This article highlights several remarkable source code repositories that showcase the ingenuity of developers throughout history, including the Apollo 11 Guidance Program, Quake III Arena, GNU Compiler Collection, Chromium, and Gitk.

Abstract

The article "Impressive Source Codes That Every Developer Should See" on the undefined website emphasizes the significance of exploring the source code of various projects to appreciate the depth of programming skill and innovation. It presents a curated list of groundbreaking software achievements that have set industry standards, starting with the Apollo 11 Guidance Program, whose 4 kilobytes of memory supported the lunar mission, with its source code now available on GitHub. The Quake III Arena game is recognized for its advanced graphics and optimized code, particularly the fast inverse square root function. The GNU Compiler Collection is acknowledged for its self-hosting nature, being written in C, and its extensive C source files. Chromium, the open-source project behind browsers like Google Chrome, is praised for its well-organized cross-platform codebase and its integration of complex components like Blink and v8 engines. Lastly, Gitk, a visual tool for navigating Git commits, is celebrated for its efficient, single-file source code written in Tcl/Tk.

Opinions

  • The author expresses admiration for the Apollo 11 engineering team's assembly language code, which was a feat given the limited abstraction levels and hardware constraints of the 1960s.
  • There is a clear appreciation for the optimization techniques used in Quake III Arena, especially the clever bit-level computations for rendering graphics in an era with limited hardware resources.
  • The article conveys a sense of wonder at the GNU Compiler Collection's bootstrapping process and the complexity of its C parser source file, which is a testament to the power of C as a language close to hardware.
  • The Chromium project is commended for its maintainability and the structuring of its large-scale, cross-platform codebase, which includes platform-specific code for various operating systems.
  • Gitk's implementation is highlighted as a remarkable example of a fully functional GUI application condensed into a single source file, showcasing the efficiency of using dynamic scripting languages like Tcl for rapid development.

Impressive Source Codes That Every Developer Should See

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

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.

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.

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.

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.

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.

Gitk was implemented as a single source file with around 12k lines, screenshot by the author
Programming
Technology
History
Software Engineering
Software Development
Recommended from ReadMedium