A Recipe for Understanding File Types

Discover the essentials of file types in computing with our guide. Learn the difference between text and binary files, understand file extensions, and how to manage them in macOS and Windows. Essential reading for developers and tech enthusiasts. Subscribe for more tech insights.

A Recipe for Understanding File Types
A Chef cooking with different file types

Overview

The rise of MOOC providers like Udacity has democratized access to computer science courses, making them available to a broad audience. However, these courses often have to make assumptions about a student's foundational knowledge, including general computing concepts.

One such fundamental yet often overlooked topic is understanding file types. In this beginner-friendly guide, we aim to demystify this essential subject.

What is a File Type?

At its core, every file is simply a collection of bits. There's no inherent difference between them. The distinctions we make, known as file types, are logical constructs designed to help us manage the sea of information on our computers. These file types guide us in understanding what actions we can perform on them.

While there are various ways to classify files into smaller or larger sets, at the most basic level, we can divide them into two main categories: text and binary.

Understanding this primary classification is crucial for anyone diving into computing courses, especially courses involving programming tasks.

What is a text file?

A text file is where the bytes represent alphanumeric characters and writing symbols. In practical terms, we can think of a text file as something we, as humans, can read and understand at some level. In contrast, a binary file remains unreadable to us.

Historically, text files were limited to 95 printable ASCII characters. However, with the introduction of UTF encoding, the range of printable characters has expanded. Despite this, the fundamental idea remains: a text file is something we can read.

We can easily view the contents of text files using stock tools available on our computers, even from the command line:

On the other hand, binary files usually require special tools for interpretation. While operating systems offer essential support for some binary files, specialized applications are often needed to work with them.

It's important to note that this classification is fundamental. Changing a file's extension won't alter its nature, although some operating systems use extensions as hints for handling files.

About File Extensions

File extensions serve multiple purposes. First, they inform us about the contents of a file, providing a clue as to what type of data it holds. Second, they act as hints for the operating system, enabling the OS to open the correct application when we open a file.

Extensions also help us categorize files into smaller, more precise sets. For example, test.txt and test.sql could be text files with identical contents.

However, the extension serves a specific purpose for applications. In the case of a .sql extension, developer tools can recognize that the file contains SQL code and activate SQL-specific functions, such as syntax highlighting.


But I Do Not See File Extensions!

A bunch of files without extensions

Popular operating systems like macOS and Windows usually hide file extensions for known files by default. These systems are designed for everyone, not just us developers or IT professionals; hence, they often hide file extensions and use graphical elements like unique icons to simplify things for the general user.

However, we must see the full file names and extensions to work effectively as programmers. Both macOS and Windows have settings that allow us to make these extensions visible.

On macOS, we can reveal all file extensions through the Finder preferences. Here's how:

To show all the extensions in Windows, we need to do something similar in Windows Explorer:

Also, advanced editors and IDEs have a project browser view, which will not only show the complete file names, including the extensions but provide a rename function in case we need it:


Conclusion

This article examined file types and their importance in computing and software development. Understanding the difference between text and binary files is vital, especially for developers and database professionals. It's not just about technical knowledge; it's about using the correct file type in practical situations, like job applications.

We also explored how file extensions help us identify and manage files. Knowing how to show file extensions in operating systems like macOS and Windows and using tools like Atom for file management are simple yet crucial skills. These steps help us work more effectively and keep us in control of our digital files.

Whether you're starting in tech or have been in the field for a while, understanding these basics is essential.

If you found this guide helpful, please consider subscribing, for more insights and articles.


Addendum: A Special Note for Our Readers

I decided to delay the introduction of subscriptions, you can read the full story here.

In the meantime, I decided to accept donations.

If you can afford it, please consider donating:

Every donation helps me offset the running costs of the site and an unexpected tax bill. Any amount is greatly appreciated.

Also, if you are looking to buy some Swag, please visit I invite you to visit the TuringTacoTales Store on Redbubble.

Take a look, maybe you can find something you like: