Code Monkey home page Code Monkey logo

phase-0-files-extensions-and-filetypes's Introduction

Files and File Types

Learning Goals

  • Define a file
  • Contrast text files and binary files
  • Identify the function of file extensions

Introduction

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 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.

Define a File

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

Contrast Text Files and 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 grade book program, directions to Carnegie Hall, etc. We create these text files with text editors like Visual Studio Code, 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

Common Filetypes and 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:

Table of file types

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 that provides hints about which program should be used to work with the file.

phase-0-files-extensions-and-filetypes's People

Contributors

bal360 avatar drakeltheryuujin avatar ihollander avatar jenmyers avatar jlboba avatar johncorn avatar lizbur10 avatar peterbell avatar sgharms avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.