Unit-IV-Programming Languages
Program Development Life Cycle
The Program Development
Life Cycle (PDLC) is a
structured process used by
software developers to
create and maintain
computer programs.
Program Development Life
Cycle (PDLC) is a
systematic way of
developing quality software.
Phases of PDLC
• Problem Definition
• Problem Analysis
• Algorithm Development
• Coding & Documentation
• Testing & Debugging
• Maintenance
Problem Definition
Define the problem statement and decide the boundaries of
the problem.
Need to understand the problem statement, what is our
requirement ,what should be the output of the problem
solution.
Problem Analysis
• Determine the requirements like variables,functions,etc to
solve the problems.
• We gather the required resources to solve this problem
defined in the problem definition part.
Algorithm Development
• Develop step by step procedure to solve the problem using
the specification given in the problem analysis part.
• Very important phase for the program development.
Coding and Documentation
• Uses a Programming language to write or implement the actual
programming instructions for the steps defined in the algorithm
development.
• Actual program is constructed.
• Solve the given problem using the programming languages like C,C++,Java.
• Written details are provided in the documentation process.
• This document includes the problem analysis, program design, coding,
Testing and Debugging
• The program is tested to ensure that it meets the requirements and is free of defects.
• To verify the program's functionality and identifying and correcting errors.
• The process of identifying, analyzing, and resolving errors (bugs) found during
testing.
• Four main levels of Testing:
• Unit Testing
• Integration Testing
• System Testing
• Acceptance Testing
Maintenance
• The program is maintained by fixing any bugs or
errors that are found and updating the program to meet
changing requirements.
• The programming team fixes program errors and
updates the software.
Program Design Tools
• Programming design tools are methodologies and representations used
to plan the logic and structure of a program before writing the actual
code in a specific programming language.
• These tools help in defining algorithms, visualizing data flow, and
outlining of the program components.
Program Design Tools
Different program design tools are:
Algorithm
Flowchart
Pseudocode
Algorithm
• An Algorithm is a step-by-step procedure or set of rules for solving a
specific problem or performing a computation.
• An Algorithm is the well-defined steps for performing a task or
solving a problem.
• It includes a number of steps sequentially that are used to solve a
problem.
• Each algorithm has clearly specified starting inputs and expected
outputs.
Algorithm-Example
Algorithm to find the sum of three numbers:
Step 1: Start.
Step 2: Read the three numbers suppose “a”, “b”, and
“c” from the user.
Step 3: Declared a variable “sum”.
Step 4: sum=a+b+c;
Step 5: Display “sum “.
Step 6: Stop.
Practice
Write an algorithm to find a given number is Odd or Even.
Step 1: Start.
Step 2: Read a number n from the user.
Step 3: Compute the remainder as r and r = n % 2
Step 4:If r == 0 then print “Even”
Step 5: Else print “Odd”
Step 6: Stop.
Flowchart
Flowchart is the graphical representation of the logical sequence of steps
involved in programming.
• They provide clarity and simplification to the complex processes and
algorithms, which in turn helps other people to understand them easily.
• Flowcharts provide a universal visual language that can be understood
by anyone across different teams and helps reduce miscommunications.
• Flowcharts help in increasing the visualization of the problem being
solved which enables more informed and data-driven choices.
Symbols used in Flowchart
Rules For Creating a Flowchart
Flowchart is a graphical representation of an algorithm. It should follow
some rules while creating a flowchart
Rule 1: Flowchart opening statement must be ‘start’ keyword.
Rule 2: Flowchart ending statement must be ‘end’ keyword.
Rule 3: All symbols in the flowchart must be connected with an
arrow line.
Rule 4: Each decision point should have two or more distinct
outcomes.
Rule 5: Flow should generally move from top to bottom or left to
right.
Draw a flowchart to input two numbers from the user and display the largest of two numbers
Practice- Flowchart to calculate the area of circle
Advantages of using a Flowchart
• Flowcharts are a better way of communicating the logic of the system.
• Flowcharts act as a guide for blueprint during program designed.
• Flowcharts help in debugging process.
• With the help of flowcharts programs can be easily analyzed.
• They provide better documentation.
• Flowcharts serve as a good proper documentation.
Disadvantages of using a Flowchart
Complexity with large problems
-For big programs, the flowchart becomes very large, cluttered, and hard to
follow.
Difficult to modify
-If the algorithm changes, updating a flowchart requires redrawing it, which is
not flexible.
Less practical for modern programming
-In real-world software development, pseudocode or structured programming
methods are often preferred over flowcharts.
Differences between algorithm and flowchart
Algorithm Flowchart
1. Flowchart is a graphical
1. Algorithm is the well-defined
representation of the logical
steps for performing a task or
sequence of steps involved in
solving a problem.
programming.
2. Algorithm is written in different
2. Flowchart is shown in the figure.
steps.
3. Algorithm is more difficult to
3. Flowchart is easier to understand
understand than the flowchart.
than the algorithm.
4. Easy to update or change the
4.Difficult to modify.
steps.
Pseudocode
• Pseudocode is an informal language used to express the flow of a
program.
• The programming process is a complicated one. So, one must first
understand the program specification and organize the thoughts to
create the program.
• Pseudocode is a step-by-step description of an algorithm written in
plain, human-readable language (not actual programming syntax).
• It acts as a bridge between problem-solving and coding, helping
programmers design logic before implementing it in a programming
language.
Finding the larger of two numbers
START
DECLARE numA, numB
INPUT numA
INPUT numB
IF numA > numB THEN
PRINT numA "is larger"
ELSE IF numB > numA THEN
PRINT numB "is larger"
ELSE
PRINT "Numbers are equal"
END IF
END
Role of Algorithms
Problem-Solving Framework
Algorithms provide a clear method to solve problems systematically.
Algorithms offer a systematic, step-by-step approach to breaking down complex problems
into smaller, manageable sub-problems.
This structured thinking is then translated into programming language instructions.
Efficiency and Optimization
Algorithms are designed to achieve a desired outcome efficiently, considering factors like
time complexity (how long it takes to run) and space complexity (how much memory it
uses).
The efficiency of a program depends largely on the algorithm used, not the language.
Accuracy:
An Algorithms ensure that a program produces consistent and accurate results
for a given set of inputs.
Reusability:
Once an algorithm is designed, it can be reused in multiple programs or
adapted to different languages with little change.
Optimization:
Algorithms help optimize memory use, execution time, and resource
management in programming.
Programming Paradigms
• A paradigm can also be termed as a method to solve a problem or
accomplish a task.
• A programming paradigm is an approach to solving a problem using a
specific programming language.
• Programming paradigms are fundamental styles or approaches used to
structure and develop computer programs.
High level languages Vs Low level
Languages
• High-level languages like Python and Java are close to human
language and easy to code.
• Low-level languages like Assembly are machine-dependent,
hardware-specific, but more efficient.
• High-level languages improve productivity, while low-level languages
provide more control.
Imperative programming paradigm
• The imperative programming paradigm is a style of programming where the
programmer gives the computer a sequence of instructions (commands) that
change the program’s state step by step.
• It focuses on how to achieve a task.
• The name comes from “imperatives” (commands) like do this, then do that.
• It is one of the oldest programming paradigm.
• It features close relation to machine architecture.
• Examples of imperative programming languages include C, C++, Java, Python,
and Fortran.
Features of imperative programming paradigm
• Step-by-step execution – Programs are written as ordered instructions.
• State changes – Variables store values, and their states change as
instructions execute.
• Focus on how – Tells the computer how to do something, not just what
to achieve.
• Close to machine model – Maps well to how computers actually
execute instructions (via CPU and memory).
• Control Structures: Uses loops, conditions and Function calls.
Advantages:
• Very simple to implement
• It contains loops, variables etc.
Disadvantage:
• Complex problem cannot be solved
• Less efficient and less productive
• Parallel programming is not possible
Procedural programming paradigm
• The procedural programming paradigm is a type of imperative
programming that organizes a program into procedures (functions or
routines).
• Each procedure contains a set of instructions to perform a specific
task.
• It focuses on breaking down a problem into smaller subproblems
(modularity).
• Examples of procedural programming languages include C, Pascal,
Python, and Fortran.
Procedural Unit
• A procedural unit is a block of code that performs a specific task, often
called a function or subroutine. It allows code reusability, modularity,
and simplifies debugging.
• For example, a function that computes factorial is a procedural unit.
Features of Procedural programming paradigm
• Based on procedures/functions → Programs are divided into smaller
parts.
• Step-by-step execution → Still imperative (focuses on how to do
things).
• Top-down approach → Start from the main program, break into
subroutines.
• Code reusability → Functions can be reused in multiple places.
• Use of variables → Data is stored in variables and modified during
execution.
• Control Structures: Uses loops, conditions and Function calls.
Advantages
• Simple to write and understand (especially for small programs).
• Encourages modularity (breaking problems into procedures).
• Code reusability (functions can be called multiple times).
• Easier debugging (test functions individually).
Disadvantages
• Global data issues → Functions often share global data, leading to
unexpected errors.
• Not suitable for very large projects (hard to manage thousands of functions).
• Weaker in handling real-world entities compared to Object-Oriented
Programming (OOP).
• Data and functions are separate (less secure than OOP, where data can be
encapsulated).
Object oriented programming
Organizes code around "objects" that contain data (attributes) and
methods (functions) that operate on that data.
Key concepts: encapsulation, inheritance, polymorphism
The program is written as a collection of classes and object which are
meant for communication
Examples: Java, C++, Python
Features of OOP
Objects – Basic units that represent entities with data and behavior.
Classes – Blueprints for creating objects.
Encapsulation – Hiding internal details; only exposing necessary parts.
Abstraction – Showing only essential features and hiding complexity.
Inheritance – Ability to create new classes from existing ones (reusability).
Polymorphism – Same method name can have different behaviors
(overloading, overriding).
Modularity – Code is organized into classes/objects for easier maintenance.
Advantages of OOP
Reusability → Inheritance avoids rewriting code.
Modularity → Code is divided into objects (easy to debug & maintain).
Encapsulation → Secure data by hiding internal details.
Scalability → Suitable for large and complex projects.
Real-world modeling → Maps directly to real-world entities.
Disadvantages of OOP
More complex to learn compared to procedural programming.
Sometimes slower than procedural programs due to abstraction layers.
Parallel processing approach
• Parallel Processing is the method of executing multiple tasks
(instructions) simultaneously by dividing a problem into smaller
subproblems and solving them at the same time on multiple processors
or cores.
• A parallel processing system posses many numbers of processor with
the objective of running a program in less time by dividing them
• Increase speed and efficiency of program execution.
• Examples are NESL (one of the oldest one) and C/C++ also supports
because of some library function.
Features of Parallel processing approach
• Divide and Conquer → Break large problems into smaller
independent parts.
• Concurrency → Multiple tasks progress in overlapping time.
• Speedup → Execution time decreases when tasks are distributed
across processors.
• Scalability → Performance increases with more CPUs/cores.
Advantages
Faster execution → Reduces program runtime.
Efficient resource utilization → Uses multi-core processors effectively.
Handles large data → Suitable for AI, simulations, scientific computing.
Disadvantages
Complex programming → Requires knowledge of concurrency, synchronization.
Overhead → Splitting tasks and combining results adds extra cost.
Not all problems are parallelizable (some require sequential steps).
Hardware dependent → Needs multi-core CPUs, GPUs, or clusters.
Language translation,Compiler,Intrepreter
• What do you mean by language translation?
Programming languages must be translated into machine code. Compilers
convert high-level language code into machine language at once, whereas
interpreters translate it line by line. Assemblers are used for assembly-level
code.
• What is a compiler?
A compiler is a translator that converts entire high-level program code into
machine code in one step. It provides error reports after scanning the whole
program. Example: GCC compiler for C language.
What is an interpreter?
An interpreter translates program code line by line into machine-
readable form. It executes instructions immediately but is slower. Errors
are reported instantly. Examples: Python interpreter, JavaScript engine.
Differentiate between compiler and interpreter.
Compiler: translates entire code, faster execution, error report at the
end.
Interpreter: translates line by line, slower execution, reports errors
instantly. Example: C uses compiler; Python uses interpreter.
Language implementation
Language implementation refers to how programming
languages are executed. It may involve compilation,
interpretation, or hybrid models (like Java, which compiles to
bytecode and interprets through JVM).
Declarative programming paradigm
• It is divided as Logic, Functional, Database.
• The declarative programming is a style of building
programs that expresses logic of computation without
talking about its control flow.
Uses of declarative programming
• The relational database is a popular declarative programming
concept. A programmer writes statements in a DSL called Structured
Query Language (SQL) to control the database. A SQL query that
pulls a set of records from a database does not use loops or
conditional logic. Instead, it includes SELECT * FROM <TableName>,
which tells the database to return the requested records.
• Configuration management tools such as Chef, Puppet and
Microsoft PowerShell Desired State Configuration (DSC) all use the
declarative programming approach. Each tool is built on an iterative
language, including Ruby, Python and PowerShell. The user defines
what they need the tool to do via the DSL, and the tool accomplishes
the task without requiring information about how to do it.
• The declarative programming paradigm is a style of
programming where you describe what you want to
achieve, rather than explicitly specifying how to
achieve it.
• This is the only difference between imperative (how to
do) and declarative (what to do) programming
paradigms.
Logic programming paradigms
It can be termed as abstract model of computation
.
Logic programming is a type of declarative programming where you
express facts and rules about problems within a system of formal logic.
Instead of specifying how to perform computations, you describe what
relationships or properties hold true.
Features
1.Rule-Based
• Programs consist of rules and facts.
• Rules express logical implications (if-then).
2.Logical Statements:
• Statements describe the relationships between entities.
Advantages
• Highly expressive for certain problem domains.
• Good for problems involving symbolic reasoning and search.
• The logic engine manages control flow and backtracking.
Functional programming paradigms
• Functional programming (FP) is a declarative programming paradigm
where computation is treated as the evaluation of mathematical functions.
• The main focus is how to solve.
• It uses expressions instead of statements. An expression is evaluated to
produce a value, whereas a statement is executed to assign variables main
focus is on “how to solve”.
• Data loosely coupled to functions.
Database/Data driven programming approach
• Database programming methodology is based on data and its movement.
• Program statements are defined by data rather than hard-coding a series of
steps.
• A database program is the heart of a business information system and
provides file creation, data entry, update, query and reporting functions.
• Instead of writing explicit instructions for every possible scenario, the
program reads data (e.g., rules, configurations, content) and reacts
accordingly.
Advantages
• Flexibility to change behavior without recompiling or
redeploying.
• Easier to maintain and update business rules or content.
• Scalable to complex and dynamic requirements.
Disadvantages
• Can add complexity if data and logic aren’t well separated.
• Debugging can be harder since behavior is influenced by
external data.
• Performance depends on efficient data access.
Differentiate between declarative and imperative
programming.
• Imperative programming emphasizes how a task should be performed
step by step.
• Declarative programming focuses on what outcome is needed.
Example: Procedural C code for sorting list is imperative,
while SQL sorting query is declarative.