Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

IT Overview

Learn the basic skills necessary to have a successful career in IT.

IT is a computer science field centered on how computers can be used to communicate information.
Most people use IT every single day. You are using IT each time you connect to the internet, send an
email, or print a document.

While there are many subjects that makeup IT, the Introduction to IT course covers the following core
pillars:

• Computers
• Networking and the Internet
• Operating Systems and Applications of Software
• Software Development
• Databases
• Cybersecurity

Computers

To understand how a computer can communicate information, it is first necessary to understand how a
computer works. At its core, a computer is a machine that can quickly complete a vast number of
extremely simple tasks. These tasks can then, in the aggregate, be used to complete much larger tasks.
Since computers are at the root of IT, it’s vital to understand what a computer is and what it can do.

Networking and the Internet

A computer can communicate information to its user relatively easily. Output to a monitor and speakers
can be used to visually and audibly convey information. But IT is not just about a computer conveying
information to its user – a computer must be able to communicate information to other computers and
their users as well. That’s where the internet comes in. The internet, in its simplest form, is a way for
computers all around the world to communicate with each other. Using signals similar to those used to
connect people audibly via telephone, the internet can be used to send vast amounts of data – which
together might form a picture, a video, a string of text, etc. – from one user to another.

Operating Systems and Applications of Software

Software programs are organized sets of instructions that utilize the computer’s hardware to complete
predefined tasks. Without software, our computer is a hammer without a nail. Hardware may have the
ability to communicate information, but software determines when, how, and what information gets
communicated.

The most foundational form of software is an operating system that directs the computer to use its
hardware to complete certain tasks and allows humans to interact with the computer in a way that
makes sense to us. For example, providing a visual interface as well as interactions between a person
and a computer using external devices like keyboards, monitors, etc.
Software Development

Software may dictate what information gets communicated in what ways, but it doesn’t do so on its
own. Just like computer hardware, software must be built – written – and it is the developer who sets
the parameters the program will ultimately follow. Just a few lines of code can turn into a program a
computer can execute. Software development is important within IT because these skills can be used to
develop systems or create functional programs that improve how a task can be completed.

Databases

A database is like a closet you store things in — except instead of clothes or old photo albums, a
database stores data — virtual information only accessible with a computer. This data is the information
that, in the context of IT, our computer shares and communicates. As more data are created each year,
it becomes increasingly important that the databases we use are built to insert new data and retrieve
old data quickly and efficiently.

Cybersecurity

One of the most pressing issues in IT today is cybersecurity. A computer can communicate information,
but communication itself is not enough. We must make sure the information is communicated and
stored safely and securely – only the right people should have access to it.

Today we store more sensitive information on computers than ever before (medical records, classified
documents, etc.). We also use computers to undertake more important tasks than ever before — flying
planes, handling financial transactions, etc. But as our reliance on computers increases, so too do the
incentives for malicious actors to infiltrate those computers to sabotage them, steal information, or
both. Cybersecurity engineers have the task of thwarting their efforts and making computing safer and
more secure for everyone.

HOW COMPUTERS WORK

Introduction
Computers make up the world around us - from robots to phones to our
coffee machines, modern appliances are often powered by computers. We rely
on this technology daily; therefore, we should ask ourselves the following
question:

How does a computer work?

Using a computer is an interactive experience. When we press a button on our


keyboard to type something, our computers know what characters to display.
When we move our mouse, computers generate a cursor that mimics the
mouse’s movements. How does a computer know what to produce based on
the interactions we have with it?
In this lesson, we’ll go over the four main functions of a computer that make
these interactions possible:

• Input
• Processing
• Memory
• Output

Input

• From clicking our mouse to turning up the volume of the speakers


during our favorite song, we are constantly giving our computers input.
We can think of input as how we as people physically interact with
computers. We give our computer commands by interacting with
various physical sensors (like buttons) which then get turned into data
for our computer to process.
• So how does a simple act such as clicking a mouse become the catalyst
for a computer to act? First, we need to establish a connection from our
input device to our computer through a physical port, which is usually
attached to the computer’s motherboard.
• The input device’s job is to detect and report any type of event; for
example, a mouse can sense the action of being clicked. Once an event
is received by the input device, it reacts by sending information to the
CPU. To properly “speak” with the CPU, information needs to be
communicated using binary code which are instructions composed of 0s
and 1s.
• Once the input is converted into binary, it is sent to the CPU to be
processed.

Processing
• Once we have some data, we need to process it so that our computer
can figure out what we’re asking it to do and how to execute those
requests. The job of processing information is given to the central
processing unit or CPU.
• The CPU controls all the different components between hardware and
software. We can think of it as the “brain” of the computer! The CPU also
holds the responsibility of establishing communication between
hardware and software. For example, if we turn the dial on our speakers
up, data about that interaction is sent to the CPU. The CPU then
deciphers the information and sends instructions to the speaker about
how to handle this task. If we want to run software on our computer, it is
also up to the CPU to perform all the necessary operations.
• That’s a lot of responsibility for one piece of hardware. With all the
different software and processes available to us, how can the CPU take
in information and execute the associated instructions so quickly? This is
where computer memory comes in handy!

Memory

• Our computers have a lot of information to process - where does all this
data get stored? Computer memory refers to the system or device used
to store computer-based data temporarily or permanently. The type of
hardware we use to store data depends a lot on how long we need to
hold on to that information.

Primary Memory
• Not all memory needs to last forever. Sometimes we just need
information temporarily. For example, if we want to order food, we only
need to remember the restaurant’s phone number long enough for us
to dial the number - then we can forget that information until the next
time we order food.
• This same idea applies to running software on our computers. When a
command to run a program is sent to the CPU, the CPU retrieves data
from Random Access Memory, or RAM, to access what instructions it
needs to execute. Accessing data from RAM is significantly faster than
accessing data from other memory systems.
• This type of data is also only stored temporarily; once we exit a program
or turn off the computer, the data is lost. For example, if we exit a word-
processing application before saving, anything we wrote in the
document is gone.
Secondary Memory
• If we upload 150 photos to our computer, the computer needs a space
to permanently store the data associated with the images so that we
could access the pictures anytime. This type of data would most likely be
saved onto our computer’s hard drive.

Output
Once the CPU processes data and sends out instructions on how to handle it,
the output is produced! We can think of output as the computer fulfilling the
command, we gave it through an output device.

Examples of output devices include the following:

• Monitors
• Speakers
• Printers

For example, if we clicked a mouse to open a file, the output would be the
monitor displaying the file’s content. If we turned the volume on our speakers
up, the output would be the sound becoming louder.

Output is the final step in the process of our computer interaction.

Review

• Input is data we give to our computers


• Processing is comprised of the translation of input and the instructions
given for the output
• Memory is used to store either temporary or permanent information
• Output is the information that gets returned by the computer
The CPU
A Central Processing Unit (CPU) is the electronic circuitry that executes instructions based on an input of
binary data (0’s and 1’s).

The CPU consists of three main components:

Control Unit (CU)

Arithmetic and Logic Unit (ALU)

Registers (Immediate Access Store)

These components are all wired in very specific ways to process data. It is important here to remember
that data, to our hardware, is a series of binary, on and off, electrical pulses. These pulses are run
through different wires, semiconductors, and components as a means to process and return data that is
usable by the software. Now that we have a general understanding of the CPU, let’s dive a little deeper.

Control Unit

The Control Unit (CU) is the overseer of the CPU, responsible for controlling and monitoring the input
and output of data from the computer’s hardware. The Control Unit is the component receiving
instructions from the software and running the show. Its primary job is to make sure that data is sent to
the right component, at the right time, and arrives with integrity.
Part of this job is keeping all the hardware working on the same schedule. It does this with a clock,
which sends out a regular electrical signal to all components at the same time to coordinate activities.

ALU

The Arithmetic and Logic Unit (ALU) is where all the processing on your computer takes place. Even as
you scroll this text box, the ALU is calculating pixel changes on the screen and sending that output to the
monitor. The ALU is the fundamental building block of the CPU, the brain of the entire computer. Nearly
all functional processing occurs in this chip. As the name implies, the ALU’s functions can be divided into
two primary areas:

Arithmetic operations that deal with calculating data (e.g. 5 * 4 = 20)

Logic operations that deal with comparisons and conditionals (e.g. 25 > 10)

Registers

The register, or immediate access store, is limited space, and high-speed memory that the CPU can use
for quick processing. Registers are small pieces of memory right on the CPU. They are fixed in number
and defined in the Instruction Set Architecture. There are typically 8, 16, 32, or 64 registers depending
on the architecture and are also fixed in size based on the size of the number it can hold. They provide
the CPU with a place to store and access values that are crucial to the immediate calculations the ALU is
processing.

Memory

The CPU is just a single component of the computer’s hardware, other important components of
hardware include Random Access Memory (RAM), buses (high-speed wires), as well as a hard disk, and
other non-volatile memory.

Random Access Memory

Random Access Memory, or RAM, is additional high-speed memory that a computer uses to store and
access information on a short-term basis. In general, a computer’s performance can be directly
correlated to the amount of RAM it has available to use. RAM is considered primary volatile memory,
which means it loses whatever is stored on it as soon as power is disconnected.

Buses

A bus is an engineering term for a job-specific high-speed wire. These wires are often grouped in
bundles and will transfer electrical signals either in parallel or in serial, that is many signals at once or
one pulse at a time. Buses can be grouped into three functions: data buses, address buses, and control
buses.
Data buses carry data back and forth between the processor and other components. Data buses are
bidirectional, which means that they transfer data both to and from other locations.

Address buses carry a specific address in memory and are unidirectional. We can visualize all of our
memory like a village with each house representing a package of data. Every house/data has an address.
When our computer tells a program or component what data to use, it sends the address and then the
component knows where to find the data when it needs it.

Control buses are also unidirectional and are responsible for carrying the control signals of the CU to
other components as well as the clock signals for synchronization.

Hard Disks

Hard disks, or hard drives, are responsible for the long-term, or secondary storage of data and programs.
This is an example of non-volatile memory, meaning that it will retain its information when we shut
down our computer.

Additional Hardware:

The Mainboard

The mainboard, or motherboard, is a printed circuit board that houses important hardware components
via ports. Hardware such as the CPU, the hard drive, various USB devices, and more are connected
through ports on the mainboard. The mainboard allows these components to communicate easily.
Ports

A port is a physical outlet used to connect outside, IO (Input/Output) devices to a computer. A computer
typically contains multiple ports. This connection allows for communication between the IO device and
our computers. Examples of IO devices include keyboards, mice, and monitors.

Number Bases

An overview of common number bases in computing.

Introduction to Bases

We use number bases every day without realizing it. When we think about numbers in everyday life, we
are almost always thinking of decimal numbers, or numbers in base 10, where each digit of a number
can be one of ten values. People have ten fingers and ten toes (most of the time), so it seems natural to
base a number system on ten. But we are not required to use ten as a base. For example, in the
movie Avatar, the Navi inhabitants have eight fingers and base their number system on eight because of
that. Back on Earth, we see other bases use commonly in computing systems, such as binary (base 2)
and hexadecimal (base 16).

When we wish to discuss non-ten bases, we use a leading notation like this: 0b1100111101 (binary for
decimal 829). Any number can be a base; however binary, hexadecimal, and decimal are the most
common on computer systems.

Binary (Base 2): leading 0b

Decimal (Base 10): leading nothing (we use it all the time!)

Hexadecimal (Base 16): leading 0x

As an IT person, it’s important to understand number systems like binary and hexadecimal because they
are vital for representing data within a computer. In this article, we will discuss the binary and
hexadecimal number system.

Binary
As the old joke goes:

There are only 10 types of people in the world, those that understand binary and those that don’t.

Binary information is defined as relating to, composed of, or involving two things. What we, as computer
scientists, understand as examples of binary can be broken into two distinct categories:

Binary Numbers

Binary Data

Binary numbers are expressed as a combination of 0s and 1s. For example, 100110 is the binary
equivalent of the number 38.

Here you can see decimal values 1 - 10 represented in binary form:


Common examples of binary data include:

Machine Code (001010101100111001010010011)

Boolean Expressions (True or False)

Hardware states (On or Off)

Networking and File Storage

Binary numbers are expressed using a base of two.

Binary in Computing

You may find yourself asking why we go through all the bother of binary numbers when the decimal
system has worked so well for humans for so long.

Computers only understand two states of being, off and on, represented by the bits 0 and 1 respectively.
Computer hardware would be incredibly large, expensive, and resource-intensive if they were made to
handle ten different states of data.

Binary data, when run through hardware, is seen as power applied or power not applied. An incredible
level of precision and regulation would have to be built into the hardware to modify the applied
electrical voltage so minutely as to fluctuate between ten levels of power.

Specially-designated binary numbers also represent various alphabets, including ASCII and Unicode.
ASCII is an older system for representing characters, and Unicode is the current international standard
for characters.

Binary data also typically comes in specific lengths, for example, eight bits is called a Byte and two Bytes
(16 bits) are called a Word. When the incoming data follows these guidelines, it is easy for the hardware
to process and compute the desired result.

File storage on your computer is referenced in Byte size. For example, your favorite app might be 250
Megabytes (MB).

Hexadecimal

Hexadecimal (base 16), often called “hex,” is a convenient and concise way to represent binary numbers
on a computer. Hex numbers are often used for values like colors and any other place where we need to
represent bits more space efficiently. They are also commonly used to represent memory addresses.

Every four binary digits become a single hexadecimal digit, which simplifies conversions between the
two bases. Because hexadecimal is base 16, we must have 16 numerals, including zero. Here is the
standard representation for the 16 numerals (remember to scroll to see the entire table):
Decimal Hexadecimal

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 8

9 9

10 A

11 B

12 C

13 D

14 E

15 F

Notice the use of the letters A, B, C, D, E, and F, which means “15” (F) is the largest numeral in any
column.

Let’s look at one hex digit to four binary digits:

0xA9FC = 0b1010100111111100

Let’s expand that so we can see the results more easily:

0x A 9 F C = 0b 1010 1001 1111 1100

Value of a Digit

When we see a number in a base other than 10, we might find it difficult to understand the actual value
of that number. In this section, we’ll go over converting a non-decimal number to a decimal value.

The value of a digit is determined by its placement in a number. Its decimal value is determined when
we take the digit value and multiply it by the base value to the power of the exponent value.
The exponent value begins at 0 for the rightmost digit. The exponent value increases by 1 each time we
move one digit to the left.

Take the decimal number 123. Note that decimal values have a base of 10.

1 \cdot 10^2 + 2 \cdot 10^1 + 3 \cdot 10^01⋅102+2⋅101+3⋅100

The rightmost digit is 3. To determine this digit’s decimal value, we must multiply 3 by the base value 10
to the power of 0 (100) which equals 3.

The next value will be the digit to the left. In our example, 2 will be the next digit. To find this digit’s
decimal value, we will use the same formula as before, but this time we will increase the exponent value
by 1. So, the decimal value of the second digit is 2 times 101 which equals 20.

Continuing, the next digit to the left is 1. We will once again increase the exponent value by 1 to find its
value. Its decimal value is 1 multiplied by 102 which equals 100.

When we add the decimal value of each digit together, we get 100 + 20 + 3 which equals our value 123.

This seems simple with a decimal number, but we can apply this logic when determining the value of a
number on other bases too. We can find the decimal value of binary number 101 like so:

The rightmost value is 1 - its decimal value is determined by multiplying 1 with the value 2 to the power
of 0 (20) which is 1. We use 2 here since that’s the base of binary values like 10 is the base of decimal
values.

The value of the next digit to the left is 0. We’ll increase the exponent value by 1. Its decimal value
is 0 multiplied by 21 which equals 0.

The value of the next digit to the left is 1. We’ll increase the exponent value by 1 again. Its decimal value
is 1 multiplied by 22 which equals 4.

We’ll add each of the digit’s decimal values together to find the decimal value of the binary number
101. 4 + 0 + 1 = 5. So binary value 101 is equivalent to decimal value 5.

Review:

• Binary numbers are expressed in base 2, meaning they are represented using only the
values 1 and 0. Binary data can be found in computing in areas such as machine code and
Boolean expressions.
• Hexadecimal numbers are expressed in base 16. They are represented using a combination of
decimal numbers 0-9 as well as letters A-F. Hexadecimal numbers can be found in memory
addresses as well as colors.
Units of Measure in Computing
Learn about how computer features are measured and compared!

Computers are digital. This means that they operate on numbers, be it photos, music, or text
documents; everything within a computer is represented as a number, and all operations are
some form of arithmetic.

In this article, we’ll go over the most important measures of these numbers.

Data representation and storage


It all starts with a bit (the binary digit), which makes up the smallest unit of data for computers.
Being a binary value, this unit can only have one of two values: 0 or 1, usually to represent if an
electronic signal is on or off.

All data on the computer is represented in this binary notation. For example, the
number 228 can be represented as 11100100 in binary, and a lowercase j can be represented
as 01101010 in the ASCII encoding standard. These groupings of 8 bits are so common that it has
a special name, a byte.

Bytes serve as the more common unit that a person may come across, usually with unit prefixes
to represent more workable amounts of data:

Value Name (Abbreviation) Example

1000 Bytes Kilobyte (kB) A typical email (~2kB)

10002 Bytes Megabyte (MB) A novel (~1.5MB) or 1 song (~5MB)

10003 Bytes Gigabyte (GB) A 1080p movie (5GB)

10004 Bytes Terabyte (TB) Entire major libraries

10005 Bytes Petabyte (PB) All the data held by a major tech company

Measuring storage performance


These file sizes lead to the importance of storage performance. If hard drives only had a speed
of 1 megabyte per second (B Mbps then the example song above would take 5 seconds to load
before playing! No user would consider that acceptable!

Luckily, modern drives are much faster than that. The storage of most devices today is solid
state drives. For portable devices such as phones, they are usually able to read files at about
1500 Mbps and write new files at 500 Mbps. Desktop devices can reach read and write speeds
of over 5000 Mbps!
Special types of storage
While these speeds can be very fast, there is a special type of short-term storage, Random
Access Memory (RAM), that is used for intermediate storage of values and is even faster! The
speed of these types of storage is typically around 20,000 Mbps! Much faster than any type of
long-term storage!

However, these numbers only cover sequential throughput. Throughput is the total amount of
data that can be transferred during a given amount of time. Another important measure
is latency, the amount of delay before that transfer of data begins. This is helpful when many
small files need to be transferred and the data seeking and accessing processes need to be
repeated many times.

Here is where RAM truly shines; newer devices usually have a latency of around 10
nanoseconds, while even the fastest solid-state drives (SSDs) have latency times of a few
microseconds or almost 1000 times slower!

Measuring Internet performance


These types of data speeds don’t apply to just storage devices. It is true for any appliance that
transfers data.

Internet bandwidth and latency are measured in the same way. However, instead of
representing the speed of a specific device, measures of Internet devices consist of the entire
“pipe” that attempts to bring the data to a device.

Everything from the speed of the server providing the data, the miles of cables connecting it to
an Internet service provider (ISP), and all of the similar connections until it reaches the desired
device make up this measure. Most importantly, these speeds are decided by the slowest
device along the entire chain. Even if a consumer owns the fastest routers and computers, if the
server is an ancient turtle connected with a shoestring to the Internet, the entire connection
will be slow.

Measuring computational performance


All this data brought to the computer needs to be processed by the central processing unit
(CPU). Each CPU has a clock speed for determining how quickly it can do computations. This is
commonly about 3.5GHz or 3.5 billion operations per second, and will likely stay around that
number for the foreseeable future to the physical limitations in the durability of silicon.

Therefore, a more important measure going forward is the number of cores a CPU contains.
Each core within a CPU can do one computation at a time. Therefore, a CPU with four cores can
simultaneously do four times as many computations as a CPU with one core. So, need to make
a computationally heavy task four times faster? Just get a processor with four times as many
cores! For well-threaded programs, it’s that simple.
Graphical processing units (GPUs) are similarly measured to CPUs, as they are both devices
focused on computations. However, with the GPU’s different goal of computing graphics comes
different implementations. They tend to have many more computational cores (up to 80!), but
with much slower clock speeds (around 2GHz).

Measuring electricity usage


One thing all these devices have in common is their hunger for power. This energy is measured
in watts and differs based on how powerful the device is; more powerful devices tend to use
more energy.

This is an important measure because over time the cost of electricity can eclipse the cost of
the actual device. So much so that it is common for servers to be completely replaced by newer
models not because of speed improvements, but because of improvements in power
consumption.

Power consumption has other effects as well. All of the energy taken in by a device is dissipated
as heat, so more powerful devices will typically need complex cooling solutions to best maintain
performance.

Review:

• Throughput is the total amount of data that can be transferred in a given amount of
time.
• Latency is the amount of delay before that transfer of data begins.
• The smallest unit of data is the bit, and the performance of any data transfer, be it long-
term storage devices, short-term RAM, or Internet devices is measured in the
throughput and latency of this data.
• Both CPUs and GPUs have similar measures for computation performance. Each is made
up of cores that can do one operation at a time, and these cores have set clock speeds
that determine how often they can perform these operations.
• The energy devices use is measured in watts. The greater the wattage, the greater the
amount of heat the device creates. Electricity costs can be a substantial part of the cost
over the lifetime of the device.
OVERVIEW OF THE INTERNET

Hello, Internet
It is nearly impossible to overstate how much the internet has changed how
we consume information and communicate with one another. More than four
billion people around the world are internet users and the total number of
websites on the world wide web is nearing two billion.

Despite the presence of the internet in our lives, very few internet users
understand how it works. You don’t need to be an engineer to benefit from
understanding how the internet works. However, understanding the internet’s
infrastructure will help you decide if learning web development is right for
you.

In this lesson, you will learn how the internet works behind the scenes. After
finishing this lesson, you’ll be able to answer questions like:

• How is data sent from one computer to another?


• What is the relationship between a browser and a server?
• How is code turned into the experience that users see in their browsers?
• How has the web and web development changed from its invention to
today?

By the end of this lesson, you will have the knowledge that you need to
collaborate more effectively with engineers and jump into your career in web
development.

The Ever-Expanding Network


So how did the internet start? In 1969, the United States Department of
Defense funded the creation of ARPANET, a precursor network to the internet.
ARPANET stands for Advanced Research Projects Agency Network. ARPANET
connected supercomputing centers run by government agencies and
universities.

These institutions wanted to connect their networks for large-scale


information transfer. However, many of them followed different standards and
technical implementations. In the 1970s, the transmission control
protocol and internet protocol, otherwise known as TCP/IP, were created to
provide standards around the transfer of data that would allow these early
networks to communicate with each other.

TCP/IP was researched and specified throughout the 1970s and adopted in the
early 1980s. As different networks adopted TCP/IP, the interconnected global
network of networks that is today known as the internet was formed.

The World Wide Web


While people today often use the terms internet and world wide web
interchangeably, they refer to quite different things.

The internet refers to the actual network of connected computing devices.


Although the internet was around in the 1980s, there was not an intuitive way for
most people to browse the internet. The internet just sent messages produced by
one computer and presented them to another computer.

Engagement with the internet changed in 1989 when Tim Berners-Lee invented
the world wide web. The world wide web is a collection of interlinked websites
and other web resources. The world wide web, in combination with the rise of
web browsers in the 1990s, introduced a user-friendly interface that enabled
users to browse multimedia content and interact with other users.

Browsers and Servers


As we’ve seen, the internet is a network that links computer devices
worldwide, enabling people to share information despite vast distances. But
how is information sent from one device to another?

One way of understanding this process is to look at the client-server model. In


this model, the client refers to the user’s device or program that is requesting
data. A client can be a browser or application running on a user’s laptop,
smartphone, or tablet.

The server is the device or program in that network that waits for incoming
requests and sends back data. This might be an in-house server, a rented
server at a data center, or a cloud server. At Codecademy, we have servers that
store lesson data, and our servers are sending this lesson data to your client
device.
404 Status Code
Let’s take a deeper dive into the client-server model by exploring a part of
HTTP that you’ve probably seen before: HTTP status codes.

When a server responds to a client, the server specifies a status code as a part
of the response. Status codes indicate whether or not the HTTP request was
completed and if there was an error, they contain some information about the
type of error that happened. The status code helps the browser know how to
handle the data that was sent back with the response.

Review the HTTP statuses below and see if any of them seem familiar.

Instructions
1. The browser is currently displaying a website that Alex has created to
show photos and descriptions of her pets. If you click on the links
for Dogs or Cats, you can see more information about Alex’s dogs and
cats.
2. Next, click on the file icon in the upper left corner of the text editor.
You’ll see the different HTML files that the server is ready to send to the
browser whenever those links are clicked. These HTML files
corresponding to the different web pages that are displayed in the
browser. When the Dogs link is clicked, the server will send
the dogs.html file to the client.
3. Try out the Dogs and Cats links now!
4. Let’s create a 404-status response by requesting a non-existent
resource. Alex hasn’t built a webpage to list her turtles! Click on the link
for Turtles to see the browser display the 404-status code.

How Do Browsers Work


So far, we’ve seen how a single request and response are handled between a
client and a server. But most of the time, our devices aren’t making a single
request. Every time we load a webpage, our device sends a request for each
file that makes up that page. So even when we’re just loading one webpage,
that page can make multiple requests to retrieve different pieces of content,
like images.

So how does this process work when we’re making multiple requests
simultaneously?

All of the following steps happen in a split second:

1. When a user types in a URL and presses enter, the server processes the
request and sends the HTML file back to the client. HTML files hold the
content of a website and they also contain links for any additional assets
or code that are needed to display the site properly.
2. The browser will begin to search for elements in the HTML file and it will
start to make additional HTTP requests for any other external resources
used by the HTML file. This often includes:

• One or more CSS stylesheets. CSS stands for cascading style sheets; CSS
creates the style and layout of a web page. The browser will request the
CSS stylesheet, and when the server sends it back, the browser analyzes
the CSS and starts applying the visual styles to the content of the site.
• The request-response cycle also sends website assets, like images and
videos, from the server to the browser. If these files are large, there
might even be a noticeable delay before they are rendered by the
browser.
• One or more JavaScript files. JavaScript makes the webpage interactive.
This programming language functions as the “behavior” of the web
page. A webpage that does not use JavaScript is known as
a static webpage.

In most modern browsers, these additional requests are made in parallel. This
means that these requests are initiated at the same time, and the browser
does not wait to receive one resource before requesting the next resource.

All of the resources are typically displayed as soon as possible. The HTML will
be displayed even if some of the other assets have not been received by the
browser.

Voila! The user can now interact with the website that they requested to see.
This whole process typically happens in about a second or less, depending on
the speed of the user’s connection, the size of the website, and even the
physical distance between the browser and the server.

Review:

• The growth of the internet as a network


• The difference between the internet and the world wide web
• The relationship between browsers and servers
• HTTP status codes, like 404 Not Found
NETWORK BASICS

Introduction to Network Basics


What happens when we access Codecademy? How are we able to access the
content provided by this course? Networking!

Your device uses a network connection and goes through a series of defined
network protocols to send and receive information.

A network is two or more computers or devices that are linked to share


information.

Our computers and devices can communicate due to a large set of standards,
much like we have road systems and traffic protocols when we drive a car.
These network standards have been built by the community over the decades,
and these standards guide engineers and security professionals.

In this lesson, we’ll learn about types of networks, conceptual models to


describe all the layers of networking, and important network protocols.

Types of Networks

When we talk about a network, that could be anything connecting two or


more devices. We must understand the different types of networks. Networks
are broken into different subsets based on their size and function. Here are
some of the most common network types:

LAN
A Local Area Network (LAN) is a smaller network that
connects multiple devices in a limited area. Examples of
LANs include small offices, a home, or any other network
contained within a small area
CAN
A Campus Area Network (CAN) connects multiple
computers and devices over a slightly larger area. In
many cases, these types of networks will connect
multiple buildings located in the same vicinity. You
may see these networks in a university where multiple
buildings and outdoor spaces provide students with
network access.

WAN
A Wide Area Network (WAN) connects multiple
computers over a geographically large area. Large,
international organizations may operate these types of
networks. To ensure that computers spread over large
regions can communicate, companies may use
a VPN (Virtual Private Network) to connect systems
securely. A VPN can allow systems across large regions
to connect and interact with one another on the same
network.

Since we’re all connected to the Internet, the whole Internet can technically be
classified as a WAN!

OSI: Network Model


The OSI (Open Systems Interconnection) Model was developed in the 1970s and
1980s, and it is a conceptual model that breaks networking into seven
separate layers. Each layer refers to a set of functions that are responsible for
specific tasks. The layers start from physical signals up to the web applications
we interact with. Each layer generally only interacts with the layer below it and
provides useful tools or information to the layer above it.
This is a conceptual model, meaning it is neutral to specific implementations
or standards. We will talk about the TCP/IP Model, which maps to specific
implementations, later in this lesson. OSI is used to help us categorize network
processes so we can communicate about them during troubleshooting and
while improving security.

OSI Layers 1 and 2

Layer 1 – Physical
The Physical, and lowest layer of the model, covers how unstructured data, like
bits, is transmitted. Some concrete examples of this are the ways wires are
configured, the way signals are transferred over those wires, and the radio
frequencies computers use. Technology such as Wi-Fi, Bluetooth, and cable
standards such as CAT5 and CAT6 all operate at this layer. This layer also
includes the hardware part of modems, adapters, and repeaters.

Over these wires and signals, the raw data bits are received as a stream of 0s
and 1s. Fixing errors that occur just at this layer means considering physical
damage or interference.
Layer 2 – Data Link

The Data Link layer covers how data is sent from device to device when they
are connected to the same local network.

The data link layer includes many functionalities:

• It structures incoming or outgoing data bits into data frames.


• It involves physical addresses of devices, called Media Access Control
(MAC) addresses. All devices have a unique 48-bit MAC address where
the first 24 bits relate to the manufacturer, and the last 24 bits make it
unique to each device.
• It routes data frames to the correct physical addresses. A switch (could
be your computer or router) keeps track of local devices and their MAC
addresses and makes sure data frames get to the correct physical
location.
• It ensures the flow of data is synchronized between devices, so data
doesn’t jam up the memory of a slow receiving physical device.
• It detects errors within data frames. This involves a system of error
control!
OSI Layers 3 and 4

In layers 3 and 4, we begin to see how data is routed between different


networks and how transportation protocols function within these layers!

Layer 3 – Network
The Network layer describes how data packets are routed between wider
networks such as the Internet. Whereas a data frame at the data link layer
travels to local MAC addresses, a data packet at the network layer is routed
from a source IP (Internet Protocol) address to a destination IP address.

Think of a data packet as an envelope. IP addresses are assigned to every


computer or device connected to the Internet, and these addresses are
formatted into four numbers each ranging from 0 to 255. Example:

192.168.0.1
At this layer, there are routing protocols designed to help packets (aka, our
envelopes) get from point A to point B as quickly as possible over the Internet.
Your nearest router is one of the many routers connected to the Internet that
help packets find where they need to go!
Layer 4 – Transport
The Transport layer refers to how data is transferred. Let’s say you wanted to
upload a photo from your phone onto social media. The transport layer
handles how the image data from that photo is split (segmentation), the rate
at which the packets are sent, and how errors are handled if data packets
don’t make it to the site’s server.

The most common transport protocols on the Internet are TCP (Transmission
Control Protocol) and UDP (User Datagram Protocol). We’ll go into these two
protocols later in this lesson!

OSI Layers 5, 6, 7

Layer 5 – Session
When two computers or devices have started an exchange of information, we
call that a session. The Session layer in OSI is responsible for opening, closing,
and maintaining sessions.
In terms of opening and closing, the session layer includes authentication and
authorization measures. For example, without logging in or having the right
permissions, you may not be able to connect to parts of a website. But if you
are logged in, your access permission is stored for a set amount of time or
session length.

Meanwhile, session management ensures communications occur successfully


by providing safeguards in case a connection fails or drops.

Layer 6 – Presentation
The Presentation layer includes all the methods that convert data into a format
usable by an application. This layer handles functions such as
encoding/decoding, encryption/decryption, and compression/decompression
of files.

Layer 7 – Application
The final layer of the OSI model is the Application layer. This layer includes
websites, browsers, email, mobile applications, and how they render Internet
data so that we can interact with it.
TCP/IP Model and Implementation

The OSI Model isn’t the only model that describes networking.

You will hear more often about the TCP/IP model, which is a 4-layered model
that makes direct reference to current Internet implementations. Its
foundational protocols are TCP and IP.

The four layers of TCP/IP are as follows:

Application Layer
This includes the opening and closing of sessions, translating data, and
interacting with content at the application level. Here, there are multiple
protocols for web content, email, and accessing files, including HTTP, FTP,
SMTP, and more.

Transport Layer
TCP and UDP are the core protocols here.

TCP is a connection-oriented protocol, where a more rigorous


acknowledgment between one sender and one receiver must happen before
any data can be sent. This protocol also includes flow control and error
recovery, and it is used when larger amounts of data need to be sent and
timing is less of a concern.

UDP is a more lightweight protocol that does not require a fixed channel
between a sender and receiver. It is often used when the amount of data sent
is piecemeal and needs to be transmitted quickly.

The Internet Layer


This is where IP addressing and routing occur.

Network Access Layer


Sometimes called the Link layer, this layer encompasses the sending or
receiving of network data at the local network level.
Take a look at the diagram, and you’ll see how the TCP/IP model covers the
responsibilities outlined in each OSI layer.

Network Protocols: DNS, HTTP, Email

Now that we have a conceptual model of everything it takes for data to travel
in a network, let’s talk about some of the most common network protocols we
use every day.

What are network protocols? They are simply a set of standards for devices
interacting on the Internet! It’s important to understand these protocols from
the angle of network security. Threat actors often abuse the rules of a protocol
to gain access to sensitive information.
In this exercise, we’ll talk about a few protocols within the TCP/IP
implementation Application layer.

DNS
The Domain Name System (DNS) protocol converts
domain names to IP addresses. Think of it as a
phonebook for the Internet. It’s hard to remember an
exact IP address when we want to access a website.
When we request the URL codecademy.com, our computer
sends a DNS request to a DNS server. The server then
returns the correct IP addresses to route data to and
from Codecademy.

HTTP
The HTTP (The Hyper Text Transfer
Protocol) handles our web requests to servers.
HTTP uses a set of verbs, like GET, POST, PUT,
and HEAD, to retrieve and send data. Anytime a
page is loaded, there are multiple web requests
to retrieve content like images, text, and
formatting code.

IMAP, POP, and SMTP


How does email work? IMAP (Internet Message
Access Protocol) and POP (Post Office
Protocol) allow users to access emails stored on a
remote web server. In IMAP, servers store your
email and return copies to you, allowing you to
access the same email on multiple devices. In
POP3 (POP version 3), however, emails are
generally downloaded from the server onto just a
single device.

To send an email, the standard is SMTP (Simple Mail Transfer Protocol).


How do data packets get routed to these services from the transport layer?
Specific numbers called ports are reserved so that packets for different services
can come in at the same time. Think of ports as lanes for network traffic!

Transport Protocol Port Number

DNS TCP/UDP 53

HTTP TCP 80/8080

IMAP TCP 143

POP3 TCP 110

SMTP TCP 25/587

Network Protocols: SSH, SMB, FTP

The protocols in the last exercise are all involved in everyday Internet activity.
Below are some other Application-layer protocols that are more commonly
used by IT professionals.

SSH
Secure Shell (SSH) is used to access a remote terminal
or virtual machine (VM) over a secure connection. IT
professionals and engineers use this to help configure
and program a system remotely and securely. For
example, accessing GitHub from the command line uses
SSH!
FTP

The File Transfer Protocol (FTP) is used to


transfer files from one system to another.
Modern implementations of FTP can
include encryption as well.

SMB
The Server Message Block (SMB) protocol
allows multiple users to interact with a
remote system like a file share or printing
services. Multiple people can view and
modify shared resources and files in a
centralized server.

Again, these are some of the protocols that are most often used and
configured by IT professionals. They are central to the behind-the-scenes work
of maintaining the web.

Review
Networks, and the technology behind networking, help us connect to the
world around us. By following multiple protocols, we’re able to use physical
technologies to exchange a massive amount of information every single day.

To review, we’ve:

• Discussed the difference between Local Area Networks (LAN), Campus


Area Networks (CAN), and Wide Area Networks (WAN)
• Introduced the OSI conceptual model of the 7 layers of networking,
including:
o Physical Layer
o Data Link Layer
o Networking Layer
o Transport Layer
o Session Layer
o Presentation Layer
o Application Layer
• Introduced the TCP/IP model, also known as the Internet protocol suite
that revolves around TCP and IP
• Learned about essential protocols like DNS, HTTP, and email protocols
• Learned about SSH, SMB, and FTP protocols that are important for
accessing specific resources securely

While networking technology has helped connect people throughout the


world, it has also created new risks. Only by understanding network
architecture more and more can we make educated decisions on network
security.

Basics of Operating Systems


Learn about what an operating system is and what they are responsible for.

The four main functions of a computer are input, processing, memory, and output; but where
do operating systems fit into this? In this article, we’ll go over the various responsibilities of an
operating system at a high level.

Introduction to Operating Systems


Take a moment to recall the process of using a computer. It may look something like this: We
press a button and a humming noise signifies that our computer has powered on. After a
moment, our computer monitor displays a desktop background and what happens next is up to
us! Here are a few examples:

• Use our mouse to open up our favorite music application and turn up our speakers to
enjoy our favorite song.
• Start up a word processing software to write something for work and then save it to our
computer in a folder we use specifically for our job.
• Open up an internet browser to write an email while playing our favorite online
multiplayer game.
The possibilities are truly endless. The process of interacting with our computers to do these
types of activities often seems easy from our perspective. The truth is, these tasks are quite
complicated from the perspective of our computers. Let’s revisit this task:

Use our mouse to open up our favorite music application and turn up our speakers to enjoy our
favorite song.
For our computer to accomplish this task, it needs to handle the input of mouse movement and
mouse clicks, fetch the data necessary to run the software responsible for the music
application, run that software, retrieve the data necessary to play a specific song, communicate
with the speaker to output this song, handle the input of the speaker dial being turned, and
communicate with the speaker to output the music at a louder volume.

That’s a lot of work being done in just a few seconds! Lucky for us, as users, we don’t have to
think about any of this. The responsibility of handling tasks like this fall on the operating
system.
What is an operating system?
An Operating System, or OS, is system software that’s responsible for handling the basic
functionalities of a computer. Some examples of popular OSs are:

• Windows
• Linux
• Mac
• Android
• iOS

Every computer contains at least one operating system which starts working the moment a
computer is turned on. The OS has control over both the software and hardware resources of a
computer. At the core of an operating system is the kernel which manages all the interactions
between the hardware and software components of a computer.

Functions of an OS
Take a look at some of the vital functions of an OS:

• Process Management
• Memory Management
• File Management
• IO Management
• Multitasking
• Networking
• Security
• Providing a user interface

We’ll focus on the following: process management, memory management, file management,
and IO management.

Process Management
Our computers run a lot of software. Word processing documents, internet browsers,
spreadsheet documents, video games - all these are examples of software. But how does the
software know what to do? Being on Codecademy, we might already be familiar with this
answer - computer programs! Computer programs contain specific instructions that dictate
how a program should work when they’re run.

When we run a program, the instance of that execution is represented by a process. Operating
systems handle the responsibility of managing active processes.

Memory Management
We utilize a significant amount of memory to store data in our computers; however, not all
data is treated the same! Some data, like pictures, need to be stored permanently. Other data,
like the information we need to run a process, only needs to be stored temporarily while the
application is in use. This temporary memory is known as primary, or main, memory. While
hardware like hard disks is used to store permanent data, the operating system is responsible
for the management of primary memory stored in RAM.

File System Management


If we store source code, such as a C program, in a folder on our computer, we are utilizing our
computer’s file system. The operating system manages information about individual files as
well as the directories they belong in. The OS is also responsible for maintaining file systems by
being able to perform tasks such as creating, deleting, renaming, and copying files and/or
directories.

IO Management
Keyboards and speakers and mice, oh my! IO stands for Input/output and represents the
devices used for interaction. A mouse is considered an input device because we use them to
send data to our computer. A monitor is regarded as an output device since it is used to
communicate data (like an image) to us, the user. The operating system plays a large role in
managing IO by ensuring communication between IO hardware and IO software.

Review:

• The operating system (OS) is system software that manages the basic functionalities of a
computer.
• Every computer has at least one operating system. The operating system starts running
as soon as a computer is turned on.
• Some of the tasks that an OS is responsible for our process management, memory
management, file system management, and IO management.

FILESYSTEMS
Introduction to Filesystems
Whether it is playing music, looking at photos, or watching a movie,
computers are responsible for holding a lot of data. Having this data be stored
safely in an efficient way is critical for the operation of any computer and the
filesystem is the component within the operating system that handles this.

The filesystem is the data structure used by the operating system to store and
retrieve data. This is a software abstraction that allows developers to
manipulate data without having to be concerned with the minutiae of how
each storage device works.

This data is organized into files that are units of storage used to describe a
self-contained piece of data. Each file has a format depending on what that
file contains. This is indicated by the file’s extension that follows the file’s
name.

Some common extensions and their file types:

• .txt for text files


• .doc for Microsoft Word files
• .jpg for image files encoded using the JPEG compression algorithm

These files are in turn organized into directories. A directory is a data structure
that contains references to files and other directories. They are typically
organized in a hierarchical tree structure called a directory tree, as shown in
the image on the right.

In this lesson, we’ll learn about the metadata and permissions that organize
files, the layers of abstraction that make up a filesystem, and common
operations for files and directories.

File Metadata, Permissions, and Attributes


Not only is it expected that files will hold important data, but it is also
assumed that a certain amount of metadata is kept to manage these files. The
file control block holds all of this metadata for the file, including file
permissions, owners, sizes, and create, modified, and access times.

Alongside this bookkeeping metadata, files can also have attributes that
indicate special behavior. While this differs on the operating system, common
attributes include:

• Hidden: Cannot be viewed by default in file managers.


• Immutable: Cannot be modified or deleted.
• Compressed: The file is in a compressed form to save space.

Example images of file metadata, permissions, and attributes in MacOS (left) and
Windows (top right and bottom right). This shows information such as when the
file was created, who can read the file, and if it is ready to be archived.
File Permissions Overview
Within the file permissions are controls for the three main actions that can be
performed on a file: reading, writing, and executing. These permissions differ
by the user as well as collections of users called groups.

In Unix operating systems, the permissions for a file are represented using a
line of 10 characters. The first character can either be - for a file or d for a
directory. The other 9 characters are separated into three equal parts called
triads.

The first triad containing the first three characters contains the permissions for
the owner, the second triad contains the permissions for the group, and the
third triad contains the permissions for any other user outside of this.

Each of these three characters within a triad is a flag indicating


permission. r means that the file is readable, w means that the file is writable,
and x means that the file is executable.

A directory from a Linux operating system showing the permissions for a variety
of files:

• For apple, -rw------- means that the file is readable and writable for only
the owner.
• For banana, -rw-rw-rw- means that
the file is readable and writable for
all users on the system.
• For cranberry, -rwxrwxrwx means
that the file is readable, writable,
and executable for all users on the
system.
• For pear, -rw-r--r-- means that the
file is readable and writable for the
owners, but only readable for
everybody else.
• For raspberry, -r--r--r-- means that the file is read-only.
Hardware Representation of Data
As data is the cornerstone of how a computer operates, discussing its physical
representation is crucial to best understanding it. What does it look like in the
real world when a file is saved onto a hard drive?

For this discussion, we will focus mainly on the spinning metal hard disc drive,
as most of the design choices for filesystems were based on their inclusion
and they are still the most prevalent form of data storage, especially in servers.

Within a hard disk drive is a spinning platter with a thin magnetic coating. A
pointy head that looks like a thin fountain pen moves over this platter to etch
data into the platter by adjusting the direction of the magnetic field at an
incredibly precise location.

The smallest chunk of this physical storage is called a sector. It is the smallest
unit of storage for the physical drive and its size is determined by a balance
between excessive metadata and wasting space.

Smaller sectors require more information to index the entire drive, like a
librarian trying to organize millions of small pamphlets. This ruins performance
for finding files as well as creates substantial overhead for documenting the
location and content of each sector.

However, larger sector sizes also have drawbacks. For example, if saving a file
that has a size of 512 bytes and the sector size is 4096 bytes, the entire sector
is written and used, effectively wasting 3584 bytes of space.

This is abstracted further in the software filesystem, where blocks are used to
represent groupings of sectors. This is used as an abstraction so that the
operating system and all of the applications that reside on it can have a
common block size to target instead of needing to accommodate whatever
arbitrary sector size is chosen by the hardware manufacturer.
A sector is shown as a small region on a hard disk drive, while a block is a
collection multiple such sectors.

The Layers of a Filesystem


Building upon this system of sectors and blocks, the rest of the filesystem is
also implemented as a collection of abstract layers.

For example, user applications such as text editors make up the highest layer.
At this level, a developer can easily and abstractly request to write to a file.
However, this simple task becomes more intricate as it bubbles down to the
lowest device layer. At this level, the on-board computers of the storage
device need to activate certain motors with a precise amount of force to alter
the magnetic state of a sector of the drive.

The entirety of the most common layers is:

Application Programs - The day-to-day programs that are run by the user,
like web browsers and text editors.

Logical File System - The system that manages the file control blocks
containing the metadata of files such as file permissions, owners, sizes, and
access times. Simplifies the access to files for applications regardless of how
the underlying filesystem or hardware organizes them.

File-Organization Module - The component responsible for organizing the


software blocks of the filesystem. Simplifies hardware differences between
storage devices for the logical file system.

Basic File System - Communication layer between software block layout and
hardware sector layout. Schedules IO requests and manages resource blocks
for file-organization module.

IO Control - The low-level software drivers that can communicate with the
storage device’s controller. Understands how to manipulate the physical
device to read and write data.

Devices - The mechanisms of the physical storage devices. For example, the
motors and controls that do the physical act of storing data within the
medium, be it changing the magnetic state of spinning disks or altering the
placement of electrons in flash storage.

The hierarchy of the many layers of the filesystem. The top is the most user-
facing applications, while the bottom is the hardware devices:
File Operations

A file can be manipulated in a variety of ways. In fact, Unix built upon this to
create an operating system where everything is treated as a file. Therefore,
learning some simple command line file operations is crucial:

• New empty files are commonly created using the touch command.
• The contents of a directory can be listed using the ls command. (Be sure
to type a lowercase “L” as in “list” and not the number 1.)
• A string of text can be output to the terminal using the echo command.
This is useful in coordination with the > operator that redirects the text
output to a file.
• A file can be output and read using the cat command.
• A file can be deleted using the rm command.

Instructions
1.

Using the command line, create a new file called lunch using the
command touch lunch.

Optionally, you can verify that this file has been created by using the
command ls to list all the files in the current directory.
Checkpoint 2 Passed

Hint
Type touch lunch into the command line and press enter. After, type ls into the
command line and press enter.

Remember to type the ls command using a lowercase “L” as in “list” and not
the number 1.
2.

Write a list of foods such as burger, salad, and sandwich to the lunch file using
the following command:

echo "burger, salad, and sandwich" > lunch

Optionally, you can verify this by reading the file using the command cat
lunch.
Checkpoint 3 Passed
Hint

Type:

echo "burger, salad, and sandwich" > lunch

into the command line and press enter. After, type cat lunch into the
command line and press enter.
3.

Delete the lunch file using the command rm lunch.


Checkpoint 4 Passed

Hint

Type rm lunch into the command line and press enter.

Directory Operations

Directories give a hierarchy to files and therefore learning commands for their
manipulation is important as well:

• New empty directories can be created using the mkdir command. This
can also create directories within existing directories, called sub-
directories.
• Again, the contents of a directory can be listed using the ls command.
• A directory can be deleted using the rm command with the -r recursive
flag to also delete any files it may contain.

Instructions
1.

Using the command line, create a new directory called dinner using the
command mkdir dinner.

Verify that this new directory has been created using the command ls to list
all the files in the current directory.
Checkpoint 2 Passed

Hint
Type mkdir dinner into the command line and press enter. After, type ls into
the command line and press enter.

2.

Create 2 more directories within the dinner folder using the command:

mkdir dinner/entree dinner/dessert

Verify the beginnings of this hierarchical tree structure using the ls -


R command.
Checkpoint 3 Passed

Hint

Type mkdir dinner/entree dinner/dessert into the command line and press
enter. After, type ls -R into the command line and press enter.
3.

Create a variety of files within these new folders using the command:
touch dinner/entree/turkey dinner/entree/fish dinner/dessert/cake
dinner/dessert/pudding

Verify the full hierarchical tree structure using the ls -R command.


Checkpoint 4 Passed

Hint

Type:

touch dinner/entree/turkey dinner/entree/fish dinner/dessert/cake


dinner/dessert/pudding

into the command line and press enter. After, type ls -R into the command
line and press enter.
4.

Delete the dinner directory using the command rm -r dinner.


Checkpoint 5 Passed

Hint

Type rm -r dinner into the command line and press enter.


Review:

Filesystems are the data structure used by operating systems to store and
retrieve data. Therefore, they are crucial for the daily operations of a computer
and learning about them.

The building blocks of the filesystem are the files themselves. A file is a unit of
storage used to describe a self-contained piece of data.

Files can have a variety of formats depending on the type of data that they
store, as indicated by the file extension following their name.

Files have permissions that determine which users and groups can read, write,
and execute that file.

Directories are the data structure that contains references to files as well as
other directories. Both files and directories can be created, opened, written,
listed, and deleted using a wide variety of commands.

The file system itself is organized in a collection of abstract layers. These layers
include the applications, logical file system, file-organization module, basic file
system, IO control, and the storage devices themselves.

Understanding Applications
Learn about what applications are and how to manage them.

What is an application?
An application (or “app”) is a computer program that performs a certain task.
You’re using an app right now to read this! A web browser is just one of the
many apps you have on your computer.

Nearly everything you do on a computer involves an app. Want to type a


letter? The word processor is an app. Need to join a meeting? Zoom and
Skype. Need to access the Settings? That’s an app, too!
The role of the computer itself is to make sure users can use apps securely and
efficiently. Imagine your computer wasn’t able to open a word processor, a
web browser, and the calendar app at the same time.

The framework that an app is anything that takes care of a certain task is
powerful. If there is no existing app to address a task, someone can build their
own! Of course, starting this journey requires building technical knowledge!

Types of applications
There are many different types of apps, and some can fit into multiple
categories or defy classification altogether. However, there are a few broad,
non-exhaustive categories that many if not most apps fall into.

Productivity applications
Productivity apps allow users the ability to perform daily tasks and engage
with information in an efficient way. A word processor is considered a
productivity app. A lot of time is saved by typing documents on a word
processor rather than a typewriter. A web browser is a productivity app too as
it is much faster to search a term online rather than page through an
encyclopedia.
Collaboration applications
Then there are collaboration apps. These apps help people work together and
communicate efficiently. Email and video-conferencing applications would fall
into this category.

Business applications
A third category you should be aware of is business apps. Apps in this
category revolve around certain business needs. Included here might be a
stock-trading app, an accounting app, or a supply-chain management app.

Single-platform vs. cross-platform applications


Depending on the app, though, it may or may not be able to run on multiple
operating systems. An app that can only run on Windows, for example, is a
single-platform app because it cannot also run on Mac or Linux. An app that
can run on multiple operating systems is called a cross-platform app. This
single- vs. cross-platform distinction is a fundamental difference between
apps.

Managing applications
Viewing a running application
Being able to determine which apps are currently running is critically
important to IT. Sometimes apps will operate in the background. Between
foreground and background apps, you can sometimes lose track of all the
apps you’re running. When too many apps are open, our computer can slow
down as its hardware struggles to keep up with all the requests.

Thankfully, your computer provides an accessible way (through an app itself)


to see which apps are running at a given time. To do this, follow these steps
(for Mac and PC).

Killing an application
Sometimes, an error may occur and an app stops responding to your
computer. When this happens, you will not be able to interact with the app
until it starts responding again. But since you may be waiting indefinitely, you
may just want to force the app to close so that you can relaunch it.
Try this on your computer
For PC users
To view running apps, press CTRL + ALT + DELETE . Once you do this, you will
see a screen with a variety of options. Click Task Manager. You should now see
a window with several currently-running apps.

To kill an app, open Task Manager, click on the name of the app you wish to
close and then click End Task.

For Mac users


Press CMD + OPTION + ESC . You should now see a window with the title “Force
Quit Applications”. This window displays a list of all the apps currently running
on your Mac. To kill the app, click on the app you wish to close, and then click
Force Quit.
Note: on Mac, you can also see active running apps using a different tool
called Activity Monitor. This tool, however, shows more than just apps — it
shows all running processes — information that is unnecessary for our
purposes.

Review:
A computer without apps is like a video game console without any games.
Your computer is a powerful tool, but without apps, it is a tool with no
purpose.
Beyond just the importance of apps, though, you should take away a few key
points from this article.

• Certain apps can work on more than one operating system while others
cannot. The ones that cannot are called single-platform apps; the ones
that can are called cross-platform apps.
• There is a wide range of apps, but some key categories are productivity,
collaboration, and business.
• Using your computer’s tools, you can know what apps are running and
close any or all of those apps.

What is Programming?
Programming is a collaboration between humans and computers.

PROGRAMMING IS EVERYWHERE
Programming is, quite literally, all around us. From the take-out we order to
the movies we stream; code enables everyday actions in our lives. Tech
companies are no longer recognizable as just software companies — instead,
they bring food to our door, help us get a taxi, influence outcomes in
presidential elections, or act as a personal trainer.

AND PROGRAMMING IS FOR EVERYONE

For many years, only a few people have known how to code. However, that’s
starting to change. The number of people learning to code is increasing year
by year, with estimates of around 26.2 million software developers worldwide,
which doesn’t even account for the many OTHER careers that relate to
programming.

Here at Codecademy, our mission is to make technical knowledge accessible


and applicable. Technology plays a crucial role in our economy — but
programming is no longer just for software engineers. Any person can benefit
from learning to program — whether it’s learning HTML to improve your
marketing emails or taking a SQL course to add a dose of analysis to your
research role.
Even outside of the tech industry, learning to program is essential to
participating in the world around you: it affects the products you buy, the
legal policies you vote for, and the data you share online.

So, let’s dig into what programming is.

WHAT IS PROGRAMMING?
Put simply, programming is giving a set of instructions to a computer to
execute. If you’ve ever cooked using a recipe before, you can think of yourself
as the computer and the recipe’s author as a programmer. The recipe author
provides you with a set of instructions that you read and then follow. The
more complex the instructions, the more complex the result!

PROGRAMMING AS COMMUNICATION, or CODING


“Ok, so now I know what programming is, but what’s coding? I’m here to learn
how to code. Are they the same thing?”

While sometimes used interchangeably, programming and coding have


different definitions.

• Programming is the mental process of thinking up instructions to give to


a machine (like a computer).
• Coding is the process of transforming those ideas into a written
language that a computer can understand.

Over the past century, humans have been trying to figure out how to best
communicate with computers through different programming languages.
Programming has evolved from punch cards with rows of numbers that a
machine reads, to drag-and-drop interfaces that increase programming speed,
with lots of other methods in between.
via GIPHY

To this day, people are still developing programming languages, trying to


improve our programming efficiency. Others are building new languages that
improve accessibility to learning to code, like developing an Arabic
programming language or improving access for the blind and visually
impaired.

PROGRAMMING AS COLLABORATION
“The problem with programming is not that the computer isn’t logical—the
computer is logical, relentlessly literal-minded.”
Ellen Ullman, Life in Code

When we give instructions to a computer through code, we are, in our way,


communicating with the computer. But since computers are built differently
than we are, we have to translate our instructions in a way that computers will
understand.

Computers interpret instructions in a very literal manner, so we have to be


very specific in how we program them. Think about instructing someone to
walk. If you start by telling them, “Put your foot in front of yourself,” do they
know what a foot is? Or what does front means? (and now we understand why
it’s taken so long to develop bipedal robots…). In coding, that could mean
making sure that small things like punctuation and spelling are correct. Many
tears have been shed over a missing semicolon (;) a symbol that a lot of
programming languages used to denote the end of a line.
But rather than think of this as a boss-employee relationship, it’s more helpful
to think about our relationship with computers as a collaboration.

The computer is just one (particularly powerful) tool in a long list of tools that
humans have used to extend and augment their abilities.

As mentioned before, computers are very good at certain things and well, not
so good at others. But here’s the good news: the things that computers are
good at, humans suck at, and the things that computers suck at, humans are
good at! Take a look at this handy table:

Just imagine what we can accomplish when we work together! We can make
movies with incredible special effects, have continuous 24/7 factory
production, and improve our cities and health.
via GIPHY

The best computer programs are the ones that enable us to make things that we
couldn’t do on our own but leverage our creative capacities. We may be good at
drawing, but a computer is great at doing the same task repeatedly — and
quickly!

CONCLUSION
As programming becomes a larger part of our lives, everyone must have an
understanding of what programming is and how it can be used. Programming
is important to our careers, but it also plays a key role in how we participate in
politics, how we buy things, and how we stay in touch with one another.

Learning to code is an exciting journey. Whether your goal is to build a mobile


app, search a database, or program a robot, coding is a skill that will take you
far in life. Just remember — computers are tools. While learning the program
may initially be frustrating, if you choose to stick with it, you’ll be able to make
some brilliant things.
Variables

In programming, we have a way of storing values so that we can reuse them


throughout our program or change them, if necessary. This concept is known
as a variable.

A variable is a way of saving a piece of information with a specific name. By


giving a value a name, we can easily reuse that value over and over again in
our code. Like the idea of variability, a programming variable allows us to
easily change a value throughout our code.

For example:

numberOfApples = 12
The above example shows a variable numberOfApples set to a value of 12.

Variables are an important first step in coding because with variables we can
start using an important programming tool: repetition. Rather than writing out
a piece of data every time we need it, we write it out once and the computer
remembers it and can repeat that information back.

We can utilize variables to reuse a data value or to change an existing value.


When we reuse a value, it will appear in multiple places in our code. Re-typing
that value becomes tedious, which leads to errors, and without a variable
name, it becomes unclear as to what the value represents.

Imagine that you’re building a game using tiles with different patterns,
representing different terrains. We can consider Terrain One, Terrain Two, and Terrain
Three as variables - the data they store represents the type of terrain shown on
the tile.
Data Types

Data is a basic unit in programming. Without data, we couldn’t write any


programs! But what is data? We may be familiar with data as information, or
facts. In computing, data is the pieces of information that we use to build
programs, like the numbers in a calculation, or the text printed on a screen.

Data types are exactly what they sound like: different types of data. Data types
tell us about the data, including how it can be stored and what types of
operations we can perform. For example, we can write a program that squares
numbers, but it wouldn’t be able to square a word.

In programming, there’s a special group of data types called primitives.


Primitives are the most basic data types, so basic that you can find them in
pretty much every programming language. They include:

• Numbers
• Strings - any sequence of characters such as "Hello!"
• Booleans - a True or False value

Computers can do different things with different kinds of data. This computer
will process data according to the function that you give it. If the function
matches the data type, you will get an answer! If it doesn’t, you’ll see an error.

The functions do the following:

• capitalize: will turn


lowercase characters into
uppercase characters
• square: will square a
number
• evaluate: will determine if
an input is true or false
Operators

In computing, we work with lots of different forms of data. But the real fun
comes when we can do something with this data.

Operators are different symbols that represent an operation, such as the plus
sign (+) as a symbol for addition. Operations enable us to process our data, to
transform it into something else. There are different ways we can use
operators in programming.

Arithmetic Operators
If we want to write a program that performs calculations, we need to
use arithmetic operators. They include addition (+), subtraction (-),
multiplication (*), and division (/).

Comparison Operators
Comparison operators allow us to compare values and evaluate their
relationships true or false, AKA Boolean values. Expressions that evaluate to
Boolean values are known as Boolean expressions. Comparison operators
include:

• Less than < — value to the left is less than the value to the right: 2 < 6
• Greater than > — value to the left is more than the value to the right: 14
> 5
• Equals == — value to the left is equal to the value to the right: 3 == 3

Logical Operators
Logical operators, also known as Boolean operators, evaluate multiple Boolean
expressions. It looks at several relationships by connecting them with logical
operators and then determines the logic/validity of the overall expression.
Logical operators include:

• AND — both expressions evaluate to true, so the final result is true


• OR — one of the expressions evaluates to true, so the final result is true
• NOT — an expression, no matter its logical value, evaluates to the
opposite
Conditionals
Every program is a set of instructions, executed in a certain order. This order,
called control flow, is just as important as the instructions themselves.
Computers can run instructions on their own, but they can’t make decisions on
their own. Programmers can give them multiple sets of instructions and
describe the right conditions in which to use each set. They can describe a
structure like the quoted program above: “if X, then do instruction set 1.
Otherwise do instruction set 2.” This structure is called a conditional control
structure because the computer’s instructions depend on some condition(s).

In our social media example to the right, all the instructions are shown in the
diagram, but only some of them will be executed each time. Here they are in
text form:

1. Check profile privacy


2. Hide the post
3. Show the post

When is step 2 executed and when is 3 executed? The answer is: it depends.
The control flow is 1-2 if the profile is private and 1-3 if the profile is public.
The condition is the privacy setting on the profile.

Conditional control structures, or just conditionals, allow programs to do


different things in different scenarios. As you can see, they follow a logic
similar to how humans think, making it easy to write clear code while still
handling complex processes.

Lists
When we start writing more complex programs, we’ll start working with more
pieces of data. But data can get messy real fast if we’re not careful.

To keep our data tidy, we’ll want to use data structures. Data structures are
formats that we can use to keep track of our data in an organized fashion.

Lists are one very basic data structure. Programmers use lists as a container to
store multiple pieces of information that relate to each other in some way. Like
a list of the presidents of the US, types of cheeses in alphabetical order, and
the finishing positions of runners in a race. Lists are useful because we can
add, remove, search through, and access values within them.

What makes lists special is that they order our data in a specific, linear
sequence. Since our values are kept in order, it allows us to easily find the
information we’re looking for; otherwise, we’d have a huge jumbled mess of
data!

The position of value in a list is known as its index. You can think of an index
like an address - it’s what we use to locate an item in a list.

List indices (the plural of index) are numbers. Usually, lists will start their index
at 0 and then add one for each value. So, if you want to select the first item in
the list, make sure to remember to use 0 in order to do so!

Knowing an item’s index allows us to select a value from a list and do


something with it, like save it to a variable. It can also be useful in modifying a
list, whether by adding something or removing it.

Functions
Imagine we were creating a sandwich-making program for a store. The four
instructions could be to add bread, add peanut butter, add jelly, and then add
another bread on top. Sounds easy, right?

But imagine needing to write enough code for 1000 sandwiches? That requires
us to write a lot more code over and over again. Luckily, we can use functions
to make this process easier!

A function is a named sequence of instructions, packaged as a unit, that


performs a specific task. Functions make code flexible, reusable, and well-
organized. Let’s take a look at a sample function:
function makeSandwich() {
Add bread
Add peanut butter
Add jelly
Add bread
}
Our makeSandwich() function will execute all the instructions inside of it anytime
it is called in a program. Now we can easily make a sandwich whenever we
need one!

However, no store only sells peanut butter and jelly sandwiches - our program
needs to be able to make all kinds of sandwiches. Instead of writing a different
function for each type of sandwich, we can have one function that can make
them all!

function makeSandwich(topping1, topping2) {


Add bread
Add topping1
Add topping2
Add bread
}
We’ve updated our function makeSandwich() by giving it two inputs,
or parameters. Parameters are variables that can be used inside the function
body. Each time we call the function, we’ll give actual values for each
parameter, called arguments.

For example, we make a ham-and-cheese sandwich with makeSandwich("ham",


"cheese"). We call the function with the arguments “ham” and “cheese”. Those
will be the values for the topping1 and topping2 parameters.

Review:

• Variables are named pieces of data. We can create and update the value
attached to a variable.
• Operators allow us to process and transform data. There are different
kinds of operators like arithmetic operators, conditional operators, and
comparison operators.
• Data types are used to specify various kinds of data, such as numbers,
strings, or Booleans.
• Conditionals use true or false expressions to determine whether a block
of code is executed or not.
• A loop is a block of instructions that is executed repeatedly for a
specified number of times.
• A list is a data structure that stores multiple pieces of data.
• A function is a reusable block of code that can be called multiple times
in a single program.

Pseudocode and Flowcharts


Learn about how flowcharts and pseudocode are used to design algorithms!

Software development is complex and usually involves many parties working


together. Therefore, planning out a project before beginning to program is
essential for success.

In this article, we will take a real-world problem and attempt to design


an algorithm step by step to best solve it using pseudocode and flowcharts.

Password validator
The problem
Passwords are everywhere, and we create them all the time to access a great
array of services. However, it can sometimes be helpful to guide users to make
stronger passwords. This can be done by imposing some restrictions on what
passwords are considered valid.

If we want to set a couple of restrictions, such as that the password must be at


least 8 characters and contain a number, then the following passwords would
be valid:

• supers3cure
• james1510
• meandmy2dogs
But these would not:

• password
• dog
• hunter2

We have all seen plenty of passwords like these, so let’s come up with a simple
algorithm to validate passwords like this!

The solution
First, let’s take this problem and brainstorm some steps to validate passwords
that are at least 8 characters long and also contain a number:

1. Input the password that we plan to validate.


2. To keep track of the password length, establish a pass_length variable and
set it to 0.
3. To keep track of whether the password contains a number, establish
a contains_number variable and initially set it to False.
4. Has the entire password been searched?

If not, continue to step 5.

If so, skip to step 8.


5. Iterate, or move to, to the next character in password.
6. Increase the value of pass_length by 1.
7. Is the current character a number?

If not, go straight back to step 4 and continue to iterate over the


entire password.

If so, set the contains_number variable to True and then go back to step 4.
8. Is the pass_length greater than 8 and is contain_number equal to True?

If not, then the password is invalid.

If so, then the password is valid!


Doodling a flowchart
Now that we have a framework for the task that needs to be completed, we
can get to formalizing the solution. As a picture is worth a thousand words, a
nice doodle can be a helpful way to communicate a complex idea — and in
software development, the professional form of doodling is the flowchart!

Common flowchart symbols


Flowcharts have some standard symbols that allow them to be read and
understood by a wider group of people. These are some of the most
commonly-used symbols:

Terminal
The terminal is an oval that indicates the beginning and end of a program. It
usually contains the words Start or End.

Flowline
The flowline is a line from one symbol pointing towards another to show the
process’s order of operation. This displays the flow of execution in a program.

Input/Output
Input/output is represented by a rhomboid and indicates the input or output
of data. This is similar to setting a value to a variable.

Process
A process, represented by a rectangle, is an operation that manipulates data.
Think of this as changing the value of a number-based variable using an
operator such as +.

Decision
Decisions are represented by a rhombus and show a conditional operation
that will determine which path a program should take. This is similar to
conditional statements which control the flow of execution in a program.

Converting steps into symbols


Ok! Now that we have all of the steps for the algorithm figured out, let’s pair
them with the relevant flowchart symbol:

1. INPUT/OUTPUT: Input the password that we plan to validate.


2. PROCESS: To keep track of the password length, establish
a pass_length variable and initially set it to 0.
3. PROCESS: To keep track of whether the password contains a number,
establish a contains_number variable and initially set it to False.
4. DECISION: Has the entire password been searched?

FLOWLINE: If not, continue to step 5.

FLOWLINE: If so, skip to step 8.


5. PROCESS: Iterate to the next character in password.
6. PROCESS: Increment pass_length.
7. DECISION: Is the current character a number?

FLOWLINE: If not, go straight back to step 4 and continue to iterate


over the entire password.

PROCESS/FLOWLINE: If so, set the contains_number variable to True and


then go back to step 4.
8. DECISION: Is the pass_length greater than 8 and is contain_number equal
to True?

TERMINAL: If not, then the password is invalid.

TERMINAL: If so, then the password is valid!


Drawing the flowchart
Whew. Now that every step is associated with a symbol, we can connect them
all together to put the flow into the chart!
Luckily, most steps just happen one after another, so the final product is
relatively straightforward. However, do note how the iteration of
the password requires the flowlines to physically loop in the flowchart:

Progressing with pseudocode


Now that we have the entire algorithm thought out and in visual form, we can
take steps to turn it into code. Some people may be able to jump right into a
development environment and start hacking away, but let’s take it slow and
create some pseudocode first.

Pseudocode is a description of an algorithm using everyday wording, but


molded to appear similar to a simplified programming language.

To create pseudocode from what we have so far we can use the flowchart’s
flowlines to guide the structure of our code as we simplify the steps we
outlined earlier:
define password
create a pass_length variable and set it to 0
create a contains_number variable and set it to False
if the entire password hasn't been searched:
iterate to the next character of the password
increment the pass_length variable
if the current character of the password contains number:
set contains_number to True
if pass_length is greater than 8 and if contain_number is equal to True:
valid password
otherwise:
invalid password
The final code
Now the closing moments! With pseudocode in hand, the algorithm can be
programmed in any language. Here it is in Python:

# 1. Input the `password` that we plan to validate


password = "c0decademy"
# 2. To keep track of the password length, establish a `pass_length` variable and
initially set it to `0`
pass_length = 0
# 3. To keep track of if the password contains a number, establish
a `contains_number` variable and initially set it to `False`
contains_number = False
# 4. Has the entire `password` been searched?
while pass_length is not len(password):
# 5. Iterate to the next character in `password`
current_character = password[pass_length]
# 6. Increment `pass_length`
pass_length = pass_length + 1
# 7. Is the current character a number?
if current_character.isdigit():
# If so, set the `contains_number` variable to `True` and then go back to step 4
contains_number = True

# 8. Is the `pass_length` greater than `8` and is `contain_number` equal to `True`?


if pass_length > 8 and contains_number is True:
# If so, then the `password` is valid!
print("Valid Password!")
else:
# If not, then the `password` is invalid
print("Invalid Password")
Even if this code seems foreign, the power of flowcharts and pseudocode
shines through. It allows people, regardless of technical expertise, to
communicate algorithms and other technical solutions. These ideas can then
be implemented in whatever technologies work best, and the notes can be
kept around in case the algorithm needs to be reimplemented in different
technologies in the future.

Review:

• Pseudocode is a description of an algorithm using everyday wording,


but molded to appear similar to a simplified programming language.
• In code-based flowcharts, common ANSI shapes are ovals for terminals,
arrows for flowlines, rhomboids for inputs and outputs, rhombuses for
decisions, and rectangles for processes.

What is a Relational Database


Management System?
Learn about RDBMS and the language used to access large datasets – SQL.

What is a Database?
A database is a set of data stored in a computer. This data is usually structured
in a way that makes the data easily accessible.
What is a Relational Database?
A relational database is a type of database. It uses a structure that allows us to
identify and access data in relation to another piece of data in the database.
Often, data in a relational database is organized into tables.

Tables: Rows and Columns


Tables can have hundreds, thousands, sometimes even millions of rows of
data. These rows are often called records.

Tables can also have many columns of data. Columns are labeled with a
descriptive name (say, age for example) and have a specific data type.

For example, a column called age may have a type of INTEGER (denoting the type
of data it is meant to hold).

In the table above, there are three columns (name, age, and country).

The name and country columns store string data types, whereas age stores integer
data types. The set of columns and data types make up the schema of this
table.

The table also has four rows, or records, in it (one each for Natalia, Ned, Zenas,
and Laura).
What is a Relational Database Management System (RDBMS)?
A relational database management system (RDBMS) is a program that allows
you to create, update, and administer a relational database. Most relational
database management systems use the SQL language to access the database.

What is SQL?
SQL (Structured Query Language) is a programming language used to
communicate with data stored in a relational database management system.
SQL syntax is similar to the English language, which makes it relatively easy to
write, read, and interpret.

Many RDBMSs use SQL (and variations of SQL) to access the data in tables. For
example, SQLite is a relational database management system. SQLite contains
a minimal set of SQL commands (which are the same across all RDBMSs).
Other RDBMSs may use other variants.

(SQL is often pronounced in one of two ways. You can pronounce it by


speaking each letter individually like “S-Q-L”, or pronounce it using the word
“sequel”.)

Popular Relational Database Management Systems


SQL syntax may differ slightly depending on which RDBMS you are using. Here
is a brief description of popular RDBMSs:

MySQL

MySQL is the most popular open source SQL database. It is typically used for
web application development, and often accessed using PHP.

The main advantages of MySQL are that it is easy to use, inexpensive, reliable
(has been around since 1995), and has a large community of developers who
can help answer questions.

Some of the disadvantages are that it has been known to suffer from poor
performance when scaling, open source development has lagged since Oracle
has taken control of MySQL, and it does not include some advanced features
that developers may be used to.
PostgreSQL

PostgreSQL is an open source SQL database that is not controlled by any


corporation. It is typically used for web application development.

PostgreSQL shares many of the same advantages of MySQL. It is easy to use,


inexpensive, reliable and has a large community of developers. It also provides
some additional features such as foreign key support without requiring
complex configuration.

The main disadvantage of PostgreSQL is that it can be slower in performance


than other databases such as MySQL. It is also slightly less popular than
MySQL.

For more information about PostgreSQL including installation instructions,


read this article.

Oracle DB

Oracle Corporation owns Oracle Database, and the code is not open sourced.

Oracle DB is for large applications, particularly in the banking industry. Most of


the world’s top banks run Oracle applications because Oracle offers a powerful
combination of technology and comprehensive, pre-integrated business
applications, including essential functionality built specifically for banks.

The main disadvantage of using Oracle is that it is not free to use like its open
source competitors and can be quite expensive.

SQL Server

Microsoft owns SQL Server. Like Oracle DB, the code is close sourced.

Large enterprise applications mostly use SQL Server.

Microsoft offers a free entry-level version called Express but can become very
expensive as you scale your application.
SQLite

SQLite is a popular open source SQL database. It can store an entire database
in a single file. One of the most significant advantages this provides is that all
of the data can be stored locally without having to connect your database to a
server.

SQLite is a popular choice for databases in cellphones, PDAs, MP3 players, set-
top boxes, and other electronic gadgets. The SQL courses on Codecademy use
SQLite.

For more info on SQLite, including installation instructions, read this article.

Using An RDBMS On Codecademy


On Codecademy, we use both SQLite and PostgreSQL. While this may sound
confusing, don’t worry! We want to stress that the basic syntax you will learn
can be used in both systems. For example, the syntax to create tables, insert
data into those tables, and retrieve data from those tables are all identical.
That’s one of the nice parts of learning SQL — by learning the fundamentals
with one RDBMS, you can easily begin work in another.

That being said, let’s take a look at some of the more subtle details:

• File extensions — when working with databases on Codecademy, take a


look at the name of the file you’re writing in. If your file ends in .sqlite,
you’re using a SQLite database. If your file ends in .sql, you’re working
with PostgreSQL.
• Data types — You’ll learn about data types very early into learning a
RDBMS. One thing to note is that SQLite and PostgreSQL have slightly
different data types. For example, if you want to store text in a SQLite
database, you’ll use the TEXT data type. If you’re working with
PostgreSQL, you have many more options. You could
use varchar(n), char(n), or text. Each type has its own subtle differences.
This is a good example of PostgreSQL being slightly more robust than
SQLite, but the core concepts remaining the same.
• Built-in tables — As you work your way through more complicated
lessons on databases, you’ll start to learn how to access built-in tables.
For example, if you take our lesson on indexes, you’ll learn how to look
at the table that the system automatically creates to keep track of what
indexes exist. Depending on which RDBMS system you are using (in that
lesson we’re using PostgreSQL), the syntax for doing that will be
different. Any time you’re writing SQL about the database itself, rather
than the data, that syntax will likely be unique to the RDBMS you’re
using.
Conclusion
Relational databases store data in tables. Tables can grow large and have a
multitude of columns and records. Relational database management systems
(RDBMSs) use SQL (and variants of SQL) to manage the data in these large
tables. The RDBMS you use is your choice and depends on the complexity of
your application.

MANIPULATION Introduction to SQL


SQL, Structured Query Language, is a programming language designed to
manage data stored in relational databases. SQL operates through simple,
declarative statements. This keeps data accurate and secure, and helps
maintain the integrity of databases, regardless of size.

The SQL language is widely used today across web frameworks and database
applications. Knowing SQL gives you the freedom to explore your data, and
the power to make better decisions. By learning SQL, you will also learn
concepts that apply to nearly every data storage system.
The statements covered in this course use SQLite Relational Database
Management System (RDBMS). You can also access a glossary of all the SQL
commands taught in this course.

Relational Databases

SELECT * FROM celebs;


A relational database is a database that organizes information into one or
more tables. Here, the relational database contains one table.

A table is a collection of data organized into rows and columns. Tables are
sometimes referred to as relations. Here the table is celebs.

A column is a set of data values of a particular type. Here, id, name, and age are
the columns.

A row is a single record in a table. The first row in the celebs table has:

• An id of 1
• A name of Justin Bieber
• An age of 22

All data stored in a relational database is of a certain data type. Some of the
most common data types are:

• INTEGER, a positive or negative whole number


• TEXT, a text string
• DATE, the date formatted as YYYY-MM-DD
• REAL, a decimal value
Statements
The code below is a SQL statement. A statement is text that the database
recognizes as a valid command. Statements always end in a semicolon ;.

CREATE TABLE table_name (


column_1 data_type,
column_2 data_type,
column_3 data_type
);
Let’s break down the components of a statement:

1. CREATE TABLE is a clause. Clauses perform specific tasks in SQL. By


convention, clauses are written in capital letters. Clauses can also be
referred to as commands.
2. table_name refers to the name of the table that the command is applied
to.
3. (column_1 data_type, column_2 data_type, column_3 data_type) is
a parameter. A parameter is a list of columns, data types, or values that
are passed to a clause as an argument. Here, the parameter is a list of
column names and the associated data type.

The structure of SQL statements varies. The number of lines used does not
matter. A statement can be written all on one line, or split up across multiple
lines if it makes it easier to read. In this course, you will become familiar with
the structure of common statements.

Create
CREATE statements allow us to create a new table in the database. You can use
the CREATE statement anytime you want to create a new table from scratch. The
statement below creates a new table named celebs.

CREATE TABLE celebs (


id INTEGER,
name TEXT,
age INTEGER
);
1. CREATE TABLE is a clause that tells SQL you
want to create a new table.
2. celebs is the name of the table.
3. (id INTEGER, name TEXT, age INTEGER) is a list
of parameters defining each column, or attribute
in the table and its data type:

• id is the first column in the table. It stores


values of data type INTEGER
• name is the second column in the table. It
stores values of data type TEXT
• age is the third column in the table. It
stores values of data type INTEGER

Insert
The INSERT statement inserts a new row into a table.

We can use the INSERT statement when you want to add new records. The
statement below enters a record for Justin Bieber into the celebs table.

INSERT INTO celebs (id, name, age)


VALUES (1, 'Justin Bieber', 22);

• INSERT INTO is a clause that adds the specified row or rows.


• celebs is the table the row is added to.
• (id, name, age) is a parameter identifying the columns that data will be
inserted into.
• VALUES is a clause that indicates the data being inserted.
• (1, 'Justin Bieber', 22) is a parameter identifying the values being
inserted.
o 1: an integer that will be added to id column
o 'Justin Bieber': text that will be added to name column
o 22: an integer that will be added to age column
1.
Add a row to the table. In the code editor, type:

INSERT INTO celebs (id, name, age)


VALUES (1, 'Justin Bieber', 22);
Look at the Database Schema. How many rows are in the celebs table?
Checkpoint 2 Passed

Hint
Make sure there is a set of parentheses around the column names and values
to be inserted into the table!

Notice the single quotes around Justin Bieber. This is because text strings
require quotes around them, while numbers don’t.

There should be 1 row in the celebs table now.


2.
Add three more celebrities to the table. Beneath your
previous INSERT statement type:

INSERT INTO celebs (id, name, age)


VALUES (2, 'Beyonce Knowles', 33);

INSERT INTO celebs (id, name, age)


VALUES (3, 'Jeremy Lin', 26);
INSERT INTO celebs (id, name, age)
VALUES (4, 'Taylor Swift', 26);
Look at the Database Schema. How many rows are in the celebs table now?
Checkpoint 3 Passed

Hint
Make sure to enter the three new INSERT statements beneath the
first INSERT statement.

There should be 4 rows in the celebs table now.

Select
SELECTstatements are used to fetch data from a database. In the statement
below, SELECT returns all data in the name column of the celebs table.

SELECT name FROM celebs;


1. SELECT is a clause that indicates that the statement is a query. You will
use SELECT every time you query data from a database.
2. name specifies the column to query data from.
3. FROM celebs specifies the name of the table to query data from. In this
statement, data is queried from the celebs table.

You can also query data from all columns in a table with SELECT.

SELECT * FROM celebs;


* is a special wildcard character that we have been using. It allows you to
select every column in a table without having to name each one individually.
Here, the result set contains every column in the celebs table.

SELECT statements always return a new table called the result set.

Alter
The ALTER TABLE statement adds a new column to a table. You can use this
command when you want to add columns to a table. The statement below
adds a new column twitter_handle to the celebs table.

ALTER TABLE celebs


ADD COLUMN twitter_handle TEXT;
1. ALTER TABLE is a clause that lets you make the specified changes.
2. celebs is the name of the table that is being changed.
3. ADD COLUMN is a clause that lets you add a new column to a table:

• twitter_handle is the name of the new column being added


• TEXT is the data type for the new column

4. NULL is a special value in SQL that represents missing or unknown data. Here,
the rows that existed before the column was added have NULL (∅) values
for twitter_handle.

Update
The UPDATE statement edits a row in a table. You can use the UPDATE statement
when you want to change existing records. The statement below updates the
record with an id value of 4 to have the twitter_handle @taylorswift13.

UPDATE celebs
SET twitter_handle = '@taylorswift13'
WHERE id = 4;
1. UPDATE is a clause that edits a row in the table.
2. celebs is the name of the table.
3. SET is a clause that indicates the column to edit.

• twitter_handle is the name of the column that is going to be updated


• @taylorswift13 is the new value that is going to be inserted into
the twitter_handle column.

4. WHERE is a clause that indicates which row(s) to update with the new column
value. Here the row with a 4 in the id column is the row that will have
the twitter_handle updated to @taylorswift13.

Delete
The DELETE FROM statement deletes one or more rows from a table. You can
use the statement when you want to delete existing records. The statement
below deletes all records in the celebs table with no twitter_handle:

DELETE FROM celebs


WHERE twitter_handle IS NULL;

1. DELETE FROM is a clause that lets you delete rows from a table.
2. celebs is the name of the table we want to delete rows from.
3. WHERE is a clause that lets you select which rows you want to delete.
Here we want to delete all of the rows where the twitter_handle
column IS NULL.
4. IS NULL is a condition in SQL that returns true when the value
is NULL and false otherwise.

Constraints
Constraints that add information about how a column can be used are invoked
after specifying the data type for a column. They can be used to tell the
database to reject inserted data that does not adhere to a certain restriction.
The statement below sets constraints on the celebs table.

CREATE TABLE celebs (


id INTEGER PRIMARY KEY,
name TEXT UNIQUE,
date_of_birth TEXT NOT NULL,
date_of_death TEXT DEFAULT 'Not Applicable'
);
1. PRIMARY KEY columns can be used to uniquely identify the row. Attempts to
insert a row with an identical value to a row already in the table will result in
a constraint violation which will not allow you to insert the new row.

2. UNIQUE columns have a different value for every row. This is similar to PRIMARY
KEY except a table can have many different UNIQUE columns.

3. NOT NULL columns must have a value. Attempts to insert a row without a
value for a NOT NULL column will result in a constraint violation and the new
row will not be inserted.

4. DEFAULT columns take an additional argument that will be the assumed value
for an inserted row if the new row does not specify a value for that column.

Review
SQL is a programming language designed to manipulate and manage data
stored in relational databases.

• A relational database is a database that organizes information into one


or more tables.
• A table is a collection of data organized into rows and columns.

A statement is a string of characters that the database recognizes as a valid


command.

• CREATE TABLE creates a new table.


• INSERT INTO adds a new row to a table.
• SELECT queries data from a table.
• ALTER TABLE changes an existing table.
• UPDATE edits a row in a table.
• DELETE FROM deletes rows from a table.

Constraints add information about how a column can be used.

In this lesson, we have learned SQL statements that create, edit, and delete
data. In the upcoming lessons, we will learn how to use SQL to retrieve
information from a database.
The Cybersecurity Industry
In this article, we will break down common domains in cybersecurity.

Cybersecurity is becoming a broader field as more industries migrate onto the


Internet and become a part of the digital landscape. That means there are
cybersecurity needs in nearly every industry in addition to cybersecurity being
an industry itself. Security roles are no longer just the hacker stereotype of
cracking into systems and writing code all the time; cybersecurity as a whole
encompasses many skills that work together.

There are lots of overlap between different domains and cybersecurity careers,
so keep in mind that the domains are not drawn with hard lines, especially as
they keep evolving.

Security engineering
This section refers to the technical implementation of various forms of security.

• Information security, or InfoSec, protects data in any form from being accessed,
modified, shared, or deleted by the wrong people.
• Network security is concerned with the network infrastructure of an organization
that guards against unauthorized access or data from being intercepted.
• Application security refers to implementing measures that defend an application
(mobile, desktop, or web) from attack, including both software and hardware
solutions. Examples of application security include secure coding, the use of
antivirus programs, firewalls, and encryption.
• Cloud security refers to the new field of making sure resources uploaded into the
cloud are secure. Companies and users are constantly moving more resources
into the cloud, and professionals in this field need to be familiar with
implementing security in this environment.
• Cryptography focuses on methods to hide and un-hide information so that data
is only readable or usable by authorized people. This requires familiarity with all
types of encryption and hashing algorithms.
• Critical infrastructure security is defending physical systems that are becoming
more digital/networked, such as energy grids, hospitals, water and waste systems,
and even schools. Among the issues that come up are natural disasters and
outages.
Governance and compliance
It’s critical to understand international, federal, and state laws and regulations for
security. This has implications on the security operations for all organizations.
Compliance refers to making sure an organization enforces certain policies, and
continuously auditing as well.

This is becoming an increasingly important area of work. While these roles might not
require programming knowledge, these roles require foundational knowledge of
cybersecurity as well as all the laws and regulations that impact a particular industry.

Risk management and threat intelligence


No system will ever be perfect, and there will always be risk, so this area of work is about
managing that risk.

How is risk managed? Through identifying risks, assessing the likelihood and potential
threat of security vulnerabilities, and finding the most cost-effective and efficient
security measures.

Threat intelligence is the continuous gathering of knowledge of possible attacks.


Intelligence could look like knowing the motivations behind attacks, what the scale of
attacks could be, and what vectors that might use. These roles often intersect with data
science and machine learning because of the need to process all this information.

Security operations
People who work in this area are responsible for implementing security principles,
monitoring for incidents, and recovering from disasters. They work closely with everyone
under the security umbrella to:

• Detect when something has gone wrong.


• Implement preventative measures against cyber attacks.
• Make sure there are back-ups in case a system is compromised and data is lost.
• Track changes to a system.
• Come up with disaster recovery plans in advance
• Create documents and organization policies for all of the above.

Education
Security education is a growing area in itself! This domain acknowledges that the most
securely designed technologies are only as strong as the people who use them. User
education teaches best practices for people to protect themselves against cyber threats.
Security training also happens in large organizations, where employees are educated
and updated on the organization’s security policies and practices.

This domain can also include the career development and training of new security
professionals as well.

Conclusion
There are a broad set of cybersecurity roles that vary in technical expertise and required
training. There are roles that intersect with engineering, roles that intersect with
education, and roles that intersect with administration and management.

You might also like