Topic 4
PROGRAMMING LANGUAGES AND PROGRAM
DEVELOPMENT
Learning Objectives
Explain the advantages of high-level programming languages over assembly
language
Describe the general process of translation from high-level source code to object
code
Name the five procedural programming languages used in the examples of this
chapter
Explain why the software development life cycle is necessary for creating large
software programs
List the steps in the software development life cycle, explain the purpose of each,
and describe the products of each
Explain how agile software development differs from the traditional waterfall
model
The Language Progression
•Machine Language.
•Assembly Language.
•High-level language.
What is Machine Language?
•Definition:
o The only language a computer's CPU understands directly.
o Consists of binary code (1s and 0s) representing instructions.
•Key Features:
o Hardware-specific (differs between CPU architectures).
o No human-readable syntax (pure numeric/hexadecimal).
o Executes at the fastest speed (no translation needed).
How Machine Language Works
•Binary Instructions Example:
o10110000 01100001 (x86 example: Move value 61h to register AL).
•Role of the CPU:
o Fetches, decodes, and executes these binary instructions.
Why Machine Language
•Advantages:
oDirect hardware control (used in firmware, bootloaders).
oMaximum efficiency (no compiler overhead).
oFoundation of all software execution.
•Disadvantages:
oHard to write/read (error-prone).
oNot portable (CPU-specific).
How Humans Use Machine
Language
•Assemblers: Convert assembly into machine code.
•Compilers: High-level code into machine code.
•Reverse Engineering: Disassemblers convert machine code into
assembly.
What is Assembly Language?
•Definition:
oA human-readable low-level programming language.
oCorrespond with machine code (binary), but uses mnemonics (e.g.,
MOV, ADD) instead of numbers.
•Key Features:
oHardware-specific (x86, ARM, MIPS each have their own
assembly).
oNo portability (code written for Intel CPUs won’t run on ARM chips).
oMinimal abstraction (you manage registers, memory, CPU flags
directly).
How Assembly Code Runs
•Assembler:
oAn assembler (like NASM, GAS) is a translator program that
converts assembly code into machine code (binary).
Input: hello.asm (human-readable).
Output: hello.o (object file, machine code).
•What the assembler does:
oTranslates MOV EAX, 4 into B8 04 00 00 00 (x86 machine code).
oResolves labels (e.g., msg into memory address).
Assembly vs. Machine Code
Machine Code Assembly Language
10110000 01100001 MOV AL, 61h
Pure binary (CPU-friendly) Mnemonics (human-friendly)
Hard to read/write Easier to understand
Why Learn Assembly?
Real-world Uses of Assembly:
1. Hardware Control: Write OS kernels and device drivers.
2. Education: Learn how CPUs work.
3. Bootloaders: First code run when a PC powers on.
4. Game Engines: Optimized graphics/physics code.
5. Microcontrollers: Washing machines, car ECUs.
6. Virus Analysis: Reverse-engineer malicious code.
What Are High-Level Languages?
•Definition:
oDesigned for human readability and productivity (e.g., Python, Java,
C++).
oAbstracted from hardware (no manual memory/register management).
oProgramming statements are closer to natural language and use
mathematical notation.
•Key Features:
oPortable: Write once, run anywhere (mostly!).
oExpressive: One line ≈ hundreds of machine instructions.
oSlower than assembly: But 99% of the time, readability > speed.
How High-Level Code Runs
Two main approaches:
1.Compilers: translator programs that translate code into machine
code before execution.
1. Languages: C, C++, Java, Fortran, COBOL, Rust, and Go.
2. Pros: Faster execution.
3. Cons: Slower to debug (need to recompile).
2.Interpreters: translator programs that translate code into machine
code line-by-line at runtime.
1. Languages: Python, JavaScript, Ruby, MATLAB, Perl, and PHP.
2. Pros: Easier debugging (no compile step).
3. Cons: Slower execution.
Real-world Uses of High-Level
Languages
•Compiler-based:
oC++: Game engines (Unreal).
oRust: OS kernels.
oJava: Android apps.
•Interpreter-based:
oPython: Data science (PyTorch).
oJavaScript: Web browsers.
Software Engineering
•Software development life cycle
oIt is the process required to create large-scale software projects.
o25 to 40 percent of time spent on problem specification and
program design
o10 to 20 percent of time spent on initial implementation
o40 to 65 percent of time spent reviewing, modifying, fixing, and
improving software
Software Engineering
•Software Development Life Cycle (SDLC) steps:
1. Before Implementation
a. Feasibility study
b. Problem specification
c. Program Design
d. Algorithm selection or development, and analysis
2. Implementation
a. Coding
b. Debugging
Software Engineering
3. After Implementation
a. Testing, verification, and benchmarking
b. Documentation
c. Maintenance
Software Engineering
•Feasibility study:
oEvaluate the costs and benefits of various solutions.
oConsider alternatives.
•Problem specification:
oClear statement of the problem the software is to solve.
oProblem specification document is prepared.
Real-world Uses of High-Level
Languages
•Program design:
oDivide-and-conquer, top-down decomposition
oBreak the problem into tasks and subtasks.
oProgram design document is prepared.
•Algorithm selection or development, and analysis:
oChoose or design an algorithm for each subtask.
oAnalyze efficiency.
oDocument: describe algorithm in pseudocode; provide
efficiency analysis and rationale.
Software Engineering
•Coding:
oTranslate the pseudocode and design into computer code.
oBetter design = easier coding
oProgram code document is prepared
•Debugging: locating and correcting program errors
oSyntax errors: wrong grammar in code statements.
oRuntime errors: illegal operations like dividing by zero.
oLogic errors: errors in the algorithm itself that give wrong
results.
Software Engineering
•Testing, verification, and benchmarking:
oEmpirical testing: develop a test suite to check correctness.
oUnit testing: test each module or subtask.
oIntegration testing: test how modules work together.
oRegression testing: when a change occurs, test to be sure
the change did not introduce errors.
oProgram verification: to prove code is correct.
oBenchmarking: run the software on many data sets (inputs)
to check if performance meets the required limits.
Software Engineering
•Documentation:
oInternal documentation: comments in code.
oExternal documentation: all earlier documents (problem
specification, program design, etc.)
oTechnical documentation: information for programmers to
understand the code.
oUser documentation: helps users run programs.
•Program maintenance:
oAdd features, fix bugs, and improve performance
Software Engineering
•Most programmers use an Integrated Development Environment
(IDE) for developing software.
•The Integrated Development Environment (IDE) provides:
oProgram editor
oFile manager
oCompiler or interpreter
oDebugger
oPrototypes
oRapid Prototyping
oVersion control and document management
Software Engineering
•There are two models for the Software development
process:
1. Waterfall model
2. Agile model
Software Engineering
•Waterfall Model:
oThe software development process is sequential.
oOne step must be completed before moving on to the next.
oThe previous steps are never revisited.
Software Engineering
Software Engineering
•Agile Model:
oIt is a flexible and iterative approach.
oAlternative to the waterfall model.
oPhilosophy
i. Problem specification can change at any time
ii. Changes are expected; respond in an agile way.
iii. Customer or user is involved throughout process.
Software Engineering
Summary
Programming languages are of different types. Each has its
usage.
The Software Development Life Cycle is critical in developing
and documenting a software product.
The Waterfall model and Agile models have different
philosophies.