Tutorial 1: Introduction to Computer Science

Unit 1 · An Introduction to Computational Thinking · Section 1

Objectives

Computer science studies information processes: how problems can be represented, procedures designed, machines built, and results evaluated. It is broader than programming. Programming expresses procedures, while computer science also asks what can be computed, how efficiently, and with what consequences.

What Is Computation?

Computation is the systematic transformation of an input representation into an output representation by following rules. A computational process has an input domain, a set of valid operations, a state that changes as work is performed, and an output condition. The same idea applies to a spreadsheet formula, a database query, a sorting algorithm, or a CPU instruction sequence.

input data + rules + current state -> new state -> output

A computer is a programmable machine because its operations and data can be encoded, stored, and changed. The stored-program model keeps instructions and data in memory so a general-purpose processor can perform many tasks. This is why a computer can run a browser, compiler, game, or database without being rebuilt for each task.

Data, Information, and Knowledge

Data is recorded representation: numbers, characters, measurements, events, or symbols. Information is data interpreted in a context so that it answers a question or supports a decision. Knowledge includes models, rules, and experience used to interpret information. A value such as 72 is data; “72% on the first assessment” is information because its meaning and context are known.

Representations affect what can be computed. Text may be encoded with Unicode, images as pixels, and numbers in binary patterns. A representation must preserve the distinctions a problem cares about. If a date is stored only as an unstructured string, ordering and validation become harder than when its year, month, and day are represented explicitly.

From a Real Problem to a Computational Problem

  1. Specify the goal: state what result would count as success.
  2. Identify inputs and outputs: name their types, ranges, and units.
  3. State constraints: include limits, invalid cases, privacy needs, and performance expectations.
  4. Choose a representation: preserve relevant meaning and make required operations practical.
  5. Design and evaluate a procedure: check correctness, resource use, usability, and consequences.

For example, “find a student's progress” is vague. A computable specification might accept completed tutorial IDs and a fixed course total, reject duplicate or unknown IDs, and output both a count and a percentage. The specification exposes decisions that would otherwise become hidden bugs in code.

Abstraction and Layers

An abstraction provides a small vocabulary of operations while hiding implementation details. A file abstraction exposes open, read, write, and close even though the operating system manages blocks and device drivers. A function exposes parameters and a return value while hiding its internal steps. Layers compose abstractions: applications use libraries, libraries use operating-system services, and the OS controls hardware.

A good abstraction has a clear interface, a representation-independent meaning, and stated invariants. If a queue promises first-in-first-out behavior, callers should not need to know whether it uses an array or linked nodes. An abstraction is poor when it leaks irrelevant representation details or permits states that its users cannot interpret.

Worked Example: Course Progress

input: completed tutorial identifiers
representation: set of valid identifiers
procedure: remove duplicates, reject unknown IDs, count valid IDs
output: count and count / total tutorials
invariant: progress is between 0% and 100%

The set representation expresses the rule that completing the same tutorial twice does not increase progress. The procedure is separate from the user interface, so it can be tested with different inputs. Evaluation includes correctness, understandable feedback, privacy of student records, and acceptable response time.

problem -> representation -> algorithm -> implementation -> evaluation

Abstraction hides irrelevant detail while preserving what a task needs. A file, function, network address, and database table are useful abstractions because they let people reason without manipulating every physical detail.

Exercises

  1. Classify three computing tasks as representation, algorithm, or evaluation and justify each choice.
  2. Describe an everyday abstraction and identify its interface, hidden representation, and invariant.
  3. Specify inputs, outputs, constraints, and an invariant for a course-progress calculator.
  4. Encode the meaning of a date in both a string representation and a structured representation. Compare the operations each supports.
  5. Explain why programming is part of, but not all of, computer science.
  6. Trace the layers involved when an application reads a file, from application call to persistent storage.

Self-check

  1. What does computer science study?
  2. What is abstraction?
  3. Why evaluate an algorithm?

Self-Check Quiz

1. Which activity expresses a procedure in a language?

AnswerProgramming expresses a procedure in a formal programming language.

2. What does abstraction remove?

AnswerIt removes irrelevant implementation detail while retaining the detail needed for reasoning or use.

3. Which property says that a valid abstraction remains within its allowed states?

Answer(A) An invariant is a condition that must remain true for every valid state.

4. Why is 72 not automatically information?

AnswerIts meaning depends on context such as what was measured, its units, and when it was recorded.

5. Which step should identify invalid input and resource limits?

AnswerThe computational problem specification should state constraints before implementation.

Homework

  1. Analyze a library-book borrowing task as a computing problem.
  2. Identify its data, procedure, representation, and evaluation criteria.
  3. Write a short reflection on the role of abstraction.
  4. Include one test for a normal case, one boundary case, and one invalid case.
Sample answerA solution represents books, members, and loan dates; applies eligibility and due-date procedures; stores records; and evaluates correctness, usability, and privacy. A catalog abstraction hides storage details while exposing search and availability.

Homework Extension: Design Review

Write a one-page design review for your library system. Discuss representation, correctness, privacy, accessibility, and one performance concern. State one abstraction leak that your design avoids.

Sample answer

Books, members, and loans are represented as records with stable identifiers; a loan stores dates and references the other records. The system rejects unknown members, duplicate active loans, and impossible dates. It protects personal data with role-based access and clear retention rules, presents status without relying only on color, and indexes identifiers for practical lookup. A client calls borrow(bookId, memberId) rather than depending on table names or storage blocks, so the database representation can change without changing the client.