Program Function and Purpose
Diperkenalkan
6:10
Pengembangan Kreatif
Berikut program yang seharusnya mencetak rata-rata dua angka. Ia berjalan. Tidak crash. Mencetak jawaban — dan jawabannya salah. Beri empat dan enam…
Narasi bahasa Inggris · takarir bahasa Inggris dan 中文 yang dapat dipilih
Dalam pelajaran ini
| English | Makna |
|---|---|
| purpose/ˈpɜːpəs/ | tujuan |
| function/ˈfʌŋkʃn/ | fungsi |
| behavior/bɪˈheɪvjə/ | perilaku |
| Input/ˈɪnpʊt/ | |
| Processing/ˈprəʊsesɪŋ/ | pemrosesan |
| Output/ˈaʊtpʊt/ | |
| events/ɪˈvents/ | peristiwa |
| event-driven/ɪˈvent ˈdrɪvən/ | berbasis peristiwa |
| event handler/ɪˈvent ˈhændlə/ | penanganan peristiwa |
Tujuan vs fungsi
- Sebelum menulis kode, pastikan kamu jelas tentang dua ide yang terkait.
- Tujuan program adalah mengapa ia ada — masalah yang diselesaikannya.
- Fungsi adalah apa yang dilakukannya — perilaku yang dilihat pengguna.
- Aplikasi cuaca memiliki tujuan "membantu orang merencanakan"; fungsinya adalah "menampilkan prakiraan cuaca."
Input, processing, or output?
Every program takes input, processes it by its instructions, and produces output. Sort each part of a program into the right stage.
A program's purpose is why it exists; its function is:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Purpose = the goal; function = the visible behavior that reaches it.
Which is an example of input?
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
A tap is data the program receives; the others are outputs.
Model input → pemrosesan → output
- Setiap program mengikuti model sederhana: input → pemrosesan → output (model IPO).
- Input: data yang diterima program — pengetikan, sensor, file, internet.
- Pemrosesan: langkah-langkah yang dilakukan pada input tersebut.
- Output: hasilnya — teks, suara, file yang disimpan, robot bergerak.

Setiap program terurai menjadi input, pemrosesan, dan output

Put the IPO model in order.
Kesulitan 3/5 · 200 koin + bonus kecil pada penyelesaian pertama hari ini
Data comes in, is processed, and a result goes out.
A program that waits and reacts to clicks and key presses is ______-driven.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Each event triggers an event handler.
A program always gives the same output, whatever input it receives.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
False. A program's behavior is how it responds to input, so different inputs can give different outputs.
Perilaku dan peristiwa
- Perilaku program adalah bagaimana ia merespons input — input yang berbeda dapat menghasilkan output yang berbeda.
- Banyak program modern bersifat berbasis-peristiwa: mereka menunggu dan bereaksi terhadap peristiwa seperti klik atau penekanan tombol.
- Setiap peristiwa memicu sekecil potongan kode yang disebut handler peristiwa.
- Permainan, tombol situs web, dan aplikasi obrolan semuanya berbasis-peristiwa.
A well-designed program should: (Select all that apply)
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
Good design also handles every possible input, including unusual ones.
Apa yang dilakukan program yang dirancang dengan baik
- Menyelesaikan masalah asli bagi penggunanya.
- Jelas mengenai input yang diharapkan dan output yang diberikan.
- Melakukan tugasnya dapat diandalkan setiap kali dijalankan.
- Memikirkan setiap kemungkinan input adalah bagian dari perancangannya dengan benar.
Kartu ini baru, jadi ditampilkan dalam bahasa Inggris sampai terjemahannya siap.
Worked example: a step-counter app
A step-counter app helps people stay active. It reads the phone's motion sensor, counts each step, and shows the day's total; when the user taps "Reset", the count goes back to zero. Identify its purpose, function, input, processing, output and an event.
- Purpose: help people stay active. Function: count and display steps. Input: motion sensor data and taps on the screen.
- Processing: detect a step pattern in the sensor data and add 1 to the count. Output: the step total on screen. Event: tapping "Reset" triggers its event handler 事件处理程序, which sets the count to 0.
In a calculator app, the user typing "7 × 6" is the:
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
It is data given to the program.
In an event-driven program, code runs in response to actions such as a click or key press.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
Each event triggers its handler.
Tujuan program adalah mengapa ia ada; fungsinya adalah apa yang dilakukannya. Setiap program sesuai dengan input → pemrosesan → output (model IPO). Perilakunya adalah bagaimana ia merespons input — dan banyak program bersifat berbasis-peristiwa, bereaksi terhadap klik dan penekanan tombol melalui handler peristiwa.
Apa yang salah? Hanya tim situs yang dapat melihatnya.