SP Topic 1 - Introduction To SP
SP Topic 1 - Introduction To SP
TOPIC 1: INTRODUCTION
INTRODUCTION TO STRUCTURED PROGRAMMING
Computer hardware - the physical components and devices that make up a computer system.
These components are:
a. Input devices – they are used to enter data and instructions into the computer system before any
computation begins.
• Examples: keyboard, mouse, scanner
b. Storage unit – used to store data and instructions entered into a computer system as well as all
intermediate and end results before being passed to an output unit.
It is divided into 2:
• Primary storage
• Secondary storage
c. Central Processing Unit – This is the brain of the computer. It makes all major decisions,
calculations and comparisons. It also directs (i.e., activates and controls the operation of) other parts
of the computer system.
d. Output devices – they provide data and/or information to a computer user. This data and/or
information is produced by the computer in coded (machine readable) form, converted into human
readable form and then displayed to the computer user.
• Examples: monitors, printers, projectors
Computer software - a collection of programs, data, and instructions that control the operation and
functionality of a computer system.
It is divided into 2:
a. System software – Programs that act as an interface between the hardware of the computer and the
application software.
• Example: Operating system (OS), device drivers
b. Application software - Programs designed to perform specific tasks or provide specific functionality
to users.
It is the type of software that users interact with directly to accomplish various purposes, such as
productivity, entertainment, or communication.
• Example: Word processing software, Web browsers, Multimedia software
Data - collection of raw facts and figures that can be processed to gain information or insight.
It can be represented in various formats, including numbers, text, images, audio, video, or any other form
that can be stored and manipulated by computers.
Information - Processed or organized data that has been interpreted or given context to make it meaningful
and useful.
It is the result of analyzing, categorizing, and presenting data in a way that can be understood and applied by
individuals or systems.
Programming - the process of writing sets of instructions, known as code, that instruct a computer on how
to perform specific tasks.
Program - a set of instructions written in a programming language that is designed to be executed by a
computer.
Structured programming - a method of writing code that emphasizes the use of control flow constructs to
improve the clarity, readability, and maintainability of software code.
It promotes the idea of breaking down programs into smaller, manageable units called modules which
perform specific tasks.
These modules are then combined to form the overall program.
Importance of structured programming
1. It reduces the complexity of programs.
2. Enhances code readability, making it easier to understand and modify.
3. It promotes modularization and code reuse.
4. It promotes writing code that is less prone to errors.
These are just a few examples from the vast landscape of programming languages. Over time, countless
languages have been developed, each with its own strengths and purposes, catering to different application
domains and programming paradigms.
PROGRAMMING PARADIGMS
Programming paradigms are different approaches or styles of programming that provide a set of principles,
concepts, and techniques for designing and building computer programs. These paradigms dictate how
programmers structure and organize their code, how they solve problems, and how they think about
programming.
Here are some commonly recognized programming paradigms:
1. Unstructured programming - programming paradigm characterized by a lack of systematic
organization and control structures. In this paradigm, program flow is typically based on the use of
"go to" statements, allowing the execution to jump between arbitrary points in the code.
Demerits of unstructured programming
a. Unstructured programming can result in spaghetti code, which is difficult to read, understand,
and maintain.
b. It lacks clear structure and can lead to code duplication, poor code reuse, and increased
complexity.
Unstructured programming is generally considered outdated and has been largely superseded by more
structured and disciplined programming paradigms.
3. Object-oriented programming (OOP) - programming paradigm that revolves around the concept
of objects, which are instances of classes.
OOP allows for the modeling of real-world entities as objects with properties (attributes) and
behaviors (methods), enabling a more intuitive representation of the problem domain.
OOP facilitates the development of modular, maintainable, and scalable software systems by
providing a structured approach to designing and interacting with code.