انتقل إلى المحتوى
أمين أبوزيد
منشورBEG-002-L01

ما هي البرمجيات: تعليمات وبيانات وسلوك

  • الدرس 1 من 5
  • 15 دقيقة قراءة
  • مبتدئ
في هذا الدرس 11 موضوعات

هذا الدرس متاح حاليًا باللغة الإنجليزية فقط، ولم تُنشر نسخته العربية بعد.

Lesson Overview

In Module 1 you learned what a computer is made of: a CPU that follows instructions, RAM that holds what is in use, storage that keeps things for later, and input and output devices. But a computer with nothing on it does nothing useful. This lesson is about the missing ingredient: software.

By the end you will be able to say what software is in one sentence, tell software apart from the data it works on, and explain why the same phone can be a map, a camera, or a game just by changing the software.

We will use a restaurant as a picture for the whole module. The dining room is what you see and touch. The kitchen is where the work happens. The recipes are the instructions that tell the kitchen what to do. In this lesson, recipes are the star.

Why this matters: a backend engineer writes software for a living. If you have a clear, correct picture of what software is, every later topic (code, programs, servers, databases) has somewhere to attach.

This lesson builds on Module 1, especially "What a computer actually does" and "CPU, RAM, and storage". It needs no programming experience.

Learning Objectives

By the end of this lesson you will be able to:

  • Define software as instructions plus the data those instructions use.
  • Explain the difference between hardware and software, with examples of each.
  • Tell whether something on a device is software (instructions) or data (information), and justify the answer.
  • Explain how one piece of hardware can behave like many different devices by running different software.
  • Describe in plain words how software gets from a programmer's idea to something the computer runs.
  • Explain what "behavior" means when we say software has behavior.

Written Explanation

Hardware and software

A computer has two sides.

  • Hardware is the physical equipment you could, in principle, touch: the CPU chip, the RAM, the SSD, the screen, the battery.
  • Software is the set of instructions that tells the hardware what to do. You cannot touch it. It exists as stored data that the CPU reads and carries out.

An everyday comparison helps. A piano is hardware: strings, keys, wood. A piece of sheet music is something else: it does not make a sound on its own, but when a player follows it, the piano plays a specific tune. Change the sheet music and the same piano plays a different song. Software is the sheet music of the computer.

Remember from Module 1 that the CPU follows instructions one small step at a time. Those instructions have to come from somewhere. Software is where they come from.

The one-sentence definition

Software is a set of instructions, together with the data those instructions use, that tells a computer what to do.

Notice the two parts:

  1. Instructions: what to do, step by step. "Add these two numbers." "If the password is wrong, show an error."
  2. Data: the information the instructions read, change, or produce. A contact list, a photo, a bank balance, a game score.

Instructions: the recipe

Think about a recipe for pancakes. It says: take two eggs, mix with flour, heat the pan, pour a ladle, flip when bubbles appear. Every step is precise, because the cook will do exactly what is written and nothing more.

A computer is an extremely literal cook. It does not guess what you meant. If the recipe says "add the first number to the second", it does exactly that. That is why instructions for computers must be exact and complete.

Real software is made of a huge number of such steps, sometimes millions of lines of instructions, organized into groups so that people can understand them. You do not need to read any of it yet. You only need to know that a program is a list of instructions, and the CPU carries them out.

Data: the ingredients

Instructions work on data. In the pancake recipe, the eggs and flour are the data (the ingredients) and the recipe is the instructions.

In software, data can be:

  • Typed by a user (a message you write).
  • Read from storage (a saved photo).
  • Received over the network (a weather forecast).
  • Produced by the software itself (the total of your shopping basket).

You learned in Module 1 that all of it is stored as bits and bytes. That is true of instructions too: the instructions themselves are saved as data in files. This is a key idea: software is stored in the same kind of storage as your photos. The difference is not how it is kept; the difference is how it is used. The CPU treats instructions as things to do, and treats data as things to work on.

Behavior: what the software does

When instructions run on data, something happens: a photo gets brighter, a message gets sent, a map moves as you walk. We call what the software does, as you can observe it from outside, its behavior.

A useful way to think about behavior:

text
   input (data in)  ->  instructions run  ->  output (data out / action)

This is the same four-step picture from Module 1 (input, processing, storage, output), now seen from the software's side. Two things decide behavior: which instructions are there, and which data they are given. A calculator app with the data "2 and 3" outputs 5. The same app with "10 and 4" outputs 14. Same instructions, different data, different result.

The instructions also decide what kind of thing the device is. That brings us to the next idea.

Same hardware, many devices

A modern phone has a CPU, RAM, storage, a screen, a camera, a microphone, and a GPS receiver. That hardware does not change when you install an app. Yet the phone can be:

  • A map, when a map app uses the GPS receiver and the screen.
  • A camera, when a camera app uses the lens and stores photos.
  • A game console, when a game app draws moving pictures and reads your touches.

Nothing physical changed. The software did. This is why computers are called general-purpose machines: the hardware can do many jobs, and the software chooses the job. Contrast this with a simple desk lamp, whose hardware does exactly one thing.

Where software comes from

People write software in a programming language, which is a way of writing instructions that is readable by humans, with strict rules. Java, which you will learn in this course, is one such language. The text a programmer writes is called source code.

The CPU cannot read source code directly. It understands only its own very basic instruction set, written in bits. So source code has to be converted into a form the computer can run. Different languages do this differently, and you will meet the details when you learn Java. For now, keep the simple chain:

text
  Programmer writes source code  ->  it is turned into runnable form  ->  CPU runs it

Once software has been prepared like this and stored on your device, running it means the operating system (Module 1) loads it into RAM and the CPU starts following the instructions.

Layers of software

Not all software is the same sort of thing. Roughly:

  • The operating system manages the hardware and runs other software (Module 1).
  • Applications are the programs you use for a purpose: a browser, a messaging app, a spreadsheet.
  • Firmware is software stored inside a device, close to the hardware, that makes the device work. A washing machine controller is an example. We meet it properly in the next lesson.

All of them are software: instructions plus data. They differ in their job and in how close they sit to the hardware.

Is it software or is it data?

This question trips up beginners. A good test:

  • If the thing is a list of steps that the computer runs, it is software.
  • If the thing is information that software reads, shows, or changes, it is data.

A photo is data: you do not "run" a photo. The photo viewer is software: it runs and shows the photo. A text document is data, and the word processor is software. A song file is data, and the music player is software.

There is a grey area, which you should know about. Some files mix both. A web page, for example, is mostly data (text and pictures) but can also contain instructions that the browser runs (small programs written in a language called JavaScript). A spreadsheet can contain formulas. When in doubt, ask: does the computer carry this out as steps, or does it just read it? Parts of a single file can be both, and that is fine.

Examples

Example 1: one phone, three apps (simple)

Hold up a single phone and open three apps.

AppHardware it leans onWhat the phone behaves like
MapsGPS receiver, screenA navigation device
CameraLens, storageA camera
Puzzle gameTouch screen, speakerA game console

The phone did not change. Its CPU, RAM, storage, and screen are the same in every row. Only the instructions changed, and so did the behavior. This is the whole idea of software in a single picture.

Example 2: a calculator app, instructions versus data (practical)

A calculator app has instructions, roughly like this in plain English:

  1. Wait for the user to press a digit or an operator.
  2. When the user presses "=", take the two numbers and the operator.
  3. If the operator is "+", add the numbers. If it is "-", subtract them.
  4. Show the result on the screen.

Now ask which parts are data. The numbers 2 and 3 that you type are data. The result 5 is data. The history list of past calculations, if the app keeps one, is data. The four steps are the instructions.

Run it with "7 + 8": result 15. Run it with "7 - 8": result -1. The instructions did not change between the two runs. The data did, and so did the behavior you observe.

Where does the history list live while the app is open? In RAM, as you learned in Module 1. If the app saves it to a file, a copy sits in storage as well.

Example 3: a food-ordering app (realistic)

Open a food-ordering app on your phone. At a high level, several kinds of instructions and data are involved:

  • Instructions on your phone: draw the menu, handle your taps, add an item to the basket, show the total.
  • Data on your phone: the logo and pictures, your saved delivery address, the contents of your basket right now (in RAM).
  • Data from far away: the list of restaurants near you, the prices, the status of your order. Your phone does not invent these; they are sent from somewhere else.
  • Instructions somewhere else: check that the restaurant is open, calculate delivery fees, record your order permanently.

You can see already that the product is more than the screen. Part of the software runs on your phone and part runs elsewhere. The following lessons give names to these pieces and show where each one runs. For now, note that all of it is the same kind of thing: instructions plus data that they use.

Backend Insight

A backend engineer writes the instructions that run somewhere other than the user's device, and decides how the data is kept safe. Everything in this lesson applies directly:

  • Backend software is still instructions plus data. The data is often the valuable part: orders, accounts, payments.
  • The instructions decide the behavior: what happens when a request arrives, what is checked, what is saved, what is sent back.
  • Because the instructions are exact and literal, a small error in them affects every user who depends on them. If the instructions say "charge the customer twice" because of a mistake, the computer will charge twice, every time, without noticing.

One more important consequence: changing behavior means changing instructions. Software is not fixed like a physical machine. Teams can improve it, fix errors, and add features by changing the instructions, which is what the lifecycle lesson in this module is about. This also means the data and the instructions should be kept separate in your mind: you can update the instructions while keeping the same data, and you can keep the same instructions with new data.

Common Mistakes

Mistake 1: Thinking software is only what you see on the screen

  • Incorrect: "Software is the app window and the buttons."
  • Correct: "The window is the part of the software I can see. Much of the software, including parts that run on other computers, is not visible."

In the restaurant picture, the dining room is visible, but the kitchen is where much of the work happens. This will matter a lot in the next lessons.

Mistake 2: Calling data "software"

  • Incorrect: "My vacation photos are software."
  • Correct: "My vacation photos are data. The photo viewer that opens them is software."

Both are stored as bits, and both are files, which is why this is confusing. The difference is use: the CPU runs instructions and works on data.

Mistake 3: Mixing up hardware and software

  • Incorrect: "My phone's operating system is part of the hardware."
  • Correct: "The operating system is software. The CPU, RAM, and screen are hardware."

A quick test: if you can drop it on your foot, it is hardware.

Mistake 4: Believing a computer understands what you mean

A computer follows its instructions exactly. It does not infer your intention. If the instructions are wrong or incomplete, the behavior is wrong or incomplete, even though every step ran perfectly. This is the source of the word bug for an error in software.

Exercises

Try each exercise yourself before opening the solutions.

Level A: Foundation

A1. Write a one-sentence definition of software that includes both instructions and data.

أظهر الحل A1

A1. Software is a set of instructions, together with the data those instructions use, that tells a computer what to do.

A2. Sort these into hardware, software, or data: (a) the touch screen, (b) a weather app, (c) a PDF of your CV, (d) the SSD, (e) a video player.

أظهر الحل A2

A2. (a) Hardware. (b) Software. (c) Data. (d) Hardware. (e) Software.

A3. In the pancake analogy, what are the instructions and what is the data?

أظهر الحل A3

A3. The recipe is the instructions: the exact steps in order. The ingredients (eggs, flour) are the data the steps work on.

Level B: Application

B1. A music player app plays "song1.mp3". Which one is software and which is data? What would change if you played "song2.mp3" in the same app: the instructions, the data, or both?

أظهر الحل B1

B1. The music player is software; "song1.mp3" is data. Playing "song2.mp3" changes only the data. The instructions of the player are the same, but the sound you hear (the behavior) is different.

B2. Explain, without using the word "app", how a single tablet can be used as a drawing board in the morning and a book reader in the evening.

أظهر الحل B2

B2. The hardware (screen, processor, memory, storage) stays the same. In the morning it runs instructions that turn touches into lines on the screen. In the evening it runs different instructions that display pages of a book and respond to swipes. Changing the instructions changes what the device does.

B3. A friend says: "Installing a new app adds new hardware to my phone." Correct this in two or three sentences.

أظهر الحل B3

B3. Installing an app adds software, not hardware. The phone's physical parts are the same before and after. The new instructions and their data are stored in the phone's storage and use the existing hardware.

Level C: Challenge

C1. A web page contains text, pictures, and a small script that shows a clock which updates every second. Identify the data and the instructions in that page, and explain why the page is a mixed case.

أظهر الحل C1

C1. The text and pictures are data. The script that updates the clock is instructions, which the browser runs. The page is a mixed case because one file contains information to show and steps to carry out. The browser treats each part differently: it displays the data and runs the instructions.

C2. A shop's website charges customers the wrong total because of a mistake in the instructions that add up the basket. Explain why the computer did not notice, and why the same mistake appears for every customer.

أظهر الحل C2

C2. A computer follows its instructions exactly and has no idea what the shop meant to do. If the instructions add the basket incorrectly, the computer carries out the wrong steps perfectly. The same instructions are used for every customer's basket, so every customer who triggers that wrong step gets the wrong total.

Mini Challenge

Take any phone or computer you use and make a short "software or data?" list.

  1. Write down ten items you can find on it (apps, photos, documents, music, settings, the system itself).
  2. Mark each item: software, data, or mixed.
  3. For two of the software items, write one sentence about which hardware they use (screen, camera, speaker, network, GPS).
  4. For one of the data items, name the software that opens it.

Check your work: every software item has instructions that run, every data item is something that is read or shown, and the "mixed" items are explained in one sentence. If you are unsure about an item, write your guess and the reason, and revisit it after the next lesson.

Summary & Next Lesson

Key takeaways

  • Software is instructions plus the data those instructions use. Hardware is the physical equipment; software tells it what to do.
  • Instructions are exact. The computer follows them literally and does not guess.
  • Behavior is what software does as observed from outside. It depends on both the instructions and the data.
  • Instructions and data are both stored as bits. The difference is how they are used.
  • The same hardware can act as many different devices by running different software.
  • A product is more than the screen you see. Much of the software runs out of sight.

Next lesson

Now that you know what software is, the next lesson, "Kinds of software, with everyday examples", sorts software into five kinds (desktop, mobile, web frontend, backend, and embedded) by asking one question: where does it run?

Self-check

  1. What are the two parts of software?
  2. Is a photo software or data? Why?
  3. Why can one phone act as a map, a camera, and a game?
  4. What does it mean that a computer is "literal"?
  5. Why is the screen you see only part of an app?
أظهر الإجابات
  1. Instructions, and the data those instructions use.
  2. Data. A photo is information that software opens and shows. It is not a list of steps for the computer to carry out.
  3. The hardware stays the same, and different software gives it different instructions. The instructions decide the behavior.
  4. It carries out its instructions exactly as written and cannot guess what the writer intended, so wrong instructions give wrong behavior.
  5. Part of the software runs on other computers that you cannot see, and it stores data and applies rules, while the screen is only the visible part.

References

  • MDN Web Docs, What is JavaScript?. Supports the statements that a web page can include scripts that the browser runs, in addition to its text and pictures, and that some code runs in the browser and some runs on a server.
  • Wikipedia, Embedded system. Supports the description of firmware as the software written for a device's own processor, stored in read-only or flash memory. Wikipedia is a general reference, so treat this as an overview rather than a primary source.
  • The hardware and software definition, the sheet-music analogy, and the restaurant picture are this course's own teaching framing, not claims from a source. The statement that source code is turned into a runnable form is deliberately general; Java-specific details are covered later in the course.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.