Files And Filetypes Readme

Problem Statement

Have you tried to memorize a phone number "for a second" as you tried to write it down? Maybe you kept repeating it over and over? Have you ever felt a little overwhelmed when someone was giving you too much information at once and you were trying to keep up--but felt relief when you finally "got it"? As humans we can only hold a few things in our heads before they start to, well, vanish or get mixed up. Our working memory is not too reliable!

Computers also have a limited working memory. Just like us, they keep things in working memory that they're, well, working with.

When computers or people run out of space, they write down information stored in their working memory. Humans sometimes use a napkin, Post-It Notes or the back of their hands. Computers use files. The stuff computers write into their files fits into two main categories:

  1. information humans can read ("text files")
  2. information only computers can read ("binary files")

Developers create lots of files. This README will help us all get on the same page with how to talk about them.

Objectives

  1. Define what a file is
  2. Contrast text files versus binary files
  3. Identify the function of file extensions

Define What a File Is

A file is a thing computers use to store facts ("data") or processes ("programs") for later use.

Contrast Text Files Versus Binary Files

Computers think in electricity.

Whoa!

Computers' thoughts are usually shown as 1's and 0's. This is called binary code. When computers write things down, they often write them down in files in their language, binary. These files are binary files.

Types of binary files are images, music, and software programs. We can create these files with Adobe Photoshop, the C programming language, or Ableton.

Nobody is exactly sure how humans think. That's a question for science or philosophy. When we write our ideas down, we write them in files in our language, text. These files are text files.

Types of text files are HTML, letters to grandma, a list of student grades for a gradebook program, directions to Carnegie Hall, etc. We create these text files with text editors like the LearnIDE editor, Atom, Sublime Text, vim, or emacs.

ASIDE: You might hear some developers call text files "plaintext" or "plain text files" They all mean the same thing.

The Curious Case of Word Processing Files

What about files made by word processors Microsoft Word or MacOSX's TextEdit? While you're typing text, those programs store the text as well as information about the text (which font to use, which words are in bold, whether these next five lines are part of a bullet-list, etc.) in the same file. To make the loading and saving fast, these programs save the file in binary.

Word Processors and HTML, Code

Since word processing programs store their output in binary files and programs that read HTML (like browsers) or run code (like Ruby, Python, JavaScript, or Java) need text, Word Processors should not be used to create HTML or code. Developers do their work in text editors, not word processors.

Identify the Function of File Extensions

Many file names have an "extension" that comes after a .. It is not a requirement, but it's a best practice. The extension is a "hint" to the operating system of which program should be used to work with the file. For example, LetterToGrandma.docx has a docx extension which hints to the OS that it should open the file with the Word word processing program by Microsoft. The file job_offer.pdf hints to the OS that it could open the file with either Acrobat or MacOSX's Preview application. When the OS finds many good options, it will ask for the user's help in selecting the right program.

Changing an extension does not change the type of file you have. A text file called groceries.txt could be renamed groceries.mp3 but it would still be a text file. A Toyota with a BMW medallion does not suddenly become a BMW. Our groceries did not suddenly become music because we changed the extension.

Some operating systems, like MacOSX hide the file extension by default. They reckon that most users "no longer care about it." Since we're developers, though, we will frequently dig below the "end-user" layer. When in a terminal, we will see full file names - including extensions.

Here's a table to help train your instincts in seeing text- files versus binary-files:

File Text or Binary Extension Use
beethoven_09_04_.mp3 Binary .mp3 Recording of the "Ode to Joy"
CarletonDance.gif Binary .gif Image of a dancer from "The Fresh Prince of Bel-Air"
fibonacci_printer.py Text .py A Python program written in text; executable by the python binary file
index.html Text .html An HTML File designed for sharing information on the web
LetterToGrandma.docx Binary .docx A binary file for Microsoft Word
minaswan.rb Text .rb A Ruby program file written in text; executable by the ruby binary file
cannonball.mov Binary .mov A movie showing someone jumping into a swimming pool Splash!

Conclusion

In this lesson we have taken some time to get to know files. Files are things in which computers store data that needs to last a while or which their users might want to refer to again later. We've noted that files generally come in binary and text formats. And we saw that many files also have an extension which provides hints about which program should be used to work with the file.

Unlock your future in tech
Learn to code.

Learn about Flatiron School's Mission

With a new take on education that falls somewhere between self-taught prodigy and four-year computer science degree, the Flatiron School promises to turn students with little programming experience into developers.

In the six months since the Manhattan coding school was acquired by WeWork, it has spawned locations in Washington, D.C., Brooklyn, and London. Now, WeWork is opening a fourth Flatiron School location, this time in Houston.

Adam Enbar, Flatiron School's cofounder, believes now is the time to grow. "How the world is changing has impacted working and learning in very similar ways. We think education fundamentally is about one thing: enabling people to pursue a better life."

Learn. Love. Code.
Students come to Flatiron School to change their lives. Join our driven community of career-changers and master the skills you need to become a software engineer or a data scientist.
Find Us