0% found this document useful (0 votes)
2 views17 pages

Module IV

The document outlines the Program Development Life Cycle (PDLC), detailing its phases from problem definition to maintenance, emphasizing systematic program design and development. It introduces various program design tools such as algorithms, flowcharts, and pseudocode, and discusses programming languages, paradigms, and implementation methods. Additionally, it covers procedural units, language implementation, and the distinction between declarative and imperative programming styles.

Uploaded by

thenmozhi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views17 pages

Module IV

The document outlines the Program Development Life Cycle (PDLC), detailing its phases from problem definition to maintenance, emphasizing systematic program design and development. It introduces various program design tools such as algorithms, flowcharts, and pseudocode, and discusses programming languages, paradigms, and implementation methods. Additionally, it covers procedural units, language implementation, and the distinction between declarative and imperative programming styles.

Uploaded by

thenmozhi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CS25C03 - ESSENTIALS OF COMPUTING

MODULE IV – PROGRAMMING LANGUAGES


Program Development Life Cycle (PDLC)
The Program Development Life Cycle is a systematic process used by programmers and
software developers to design, develop, test, and maintain computer programs. It ensures that
programs are created efficiently, meet user requirements, and work correctly.
It usually consists of the following phases:
1. Problem Definition
 Understand and clearly define the problem that needs to be solved.
 Identify inputs, expected outputs, and constraints.
 Example: If the problem is to calculate student grades, define what inputs (marks) are
needed and what output (grade) should be displayed.
2. Analysis
 Study the problem in detail to determine what the program must do.
 Break down the requirements into smaller tasks.
 Decide the logic and steps needed.
 Example: Calculate total marks, percentage, and assign grades based on rules.
3. Design
 Create the algorithm (step-by-step solution) or flowchart (diagrammatic
representation).
 Decide the program structure (modules, functions, loops, conditions).
 This acts as the "blueprint" before coding.
4. Coding (Implementation)
 Translate the design into a programming language (like C, C++, Python, Java).
 Follow proper syntax, indentation, and coding standards.
 Example: Writing a program in C to calculate student grades.
5. Testing and Debugging
 Run the program with sample data to check if it works correctly.
 Find and fix errors (bugs).
 Types of testing:
o Unit testing (checking small parts)
o Integration testing (checking modules together)
o System testing (checking the entire program).
6. Documentation
 Prepare user manuals, technical documentation, and comments within the code.
 Helps other developers and users understand the program.
7. Deployment
 Install and deliver the program to the end users.
 Provide training if required.
8. Maintenance
 Update the program to fix new bugs, improve performance, or add new features.
 Ensures long-term usability.
Program Design Tools
When designing a program, developers use various tools to represent, plan, and organize
the solution before coding. These tools help in visualizing the logic, structure, and flow of a
program so errors can be avoided early.
The main Program Design Tools are:
1. Algorithms
 An algorithm is a step-by-step sequence of instructions to solve a problem.
 Written in simple English or pseudo-code (close to programming language but
human-readable).
 Example: Algorithm to add two numbers:
1. Start
2. Read two numbers A and B
3. Calculate Sum = A + B
4. Print Sum
5. Stop
2. Flowcharts
 A flowchart is a graphical representation of an algorithm.
 Uses symbols to represent different operations:
o Oval → Start/End
o Parallelogram → Input/Output
o Rectangle → Process (calculation, action)
o Diamond → Decision (Yes/No or True/False conditions)
 Example: Flowchart for checking even/odd number.
3. Pseudocode
 A simplified, informal way of writing program logic that is easy to understand.
 It is not a programming language but resembles one.
 Example:
 Input number
 If number MOD 2 = 0 then
 Print "Even"
 Else
 Print "Odd"
 End If
4. Decision Tables
 A tabular method to represent complex conditions and actions.
 Columns represent rules (conditions) and rows represent possible actions.
 Useful for problems with many combinations of conditions.
 Example: Loan approval table based on salary and credit score.
5. Decision Trees
 A tree-like structure that shows decisions and their possible outcomes.
 Useful for sequential decision-making.
 Example: If marks ≥ 50 → Pass → If marks ≥ 75 → Distinction.
6. Structured English
 Uses a limited form of English with keywords like IF, THEN, ELSE, DO, WHILE.
 Helps to describe program logic in a structured and clear way.
Algorithm
An algorithm is a finite set of well-defined steps or instructions to solve a specific
problem or perform a task.
Steps to Develop an Algorithm for Real-World Problems
🔹 1. Understand the Problem Clearly
 Identify what is being asked.
 Determine inputs (what you have) and outputs (what you need to find).
 Note any constraints or special conditions.
📌 Example: A grocery store wants to calculate the total bill with a 5% discount if the purchase
is above ₹1000.
🔹 2. Analyze and Break Down the Problem
 Break the problem into smaller manageable parts.
 Think about how the data will flow (input → process → output).
You may need to:
 Add multiple item prices.
 Check if total > 1000.
 Apply a 5% discount if needed.
🔹 3. Design the Algorithm (Step-by-Step Instructions)
Use plain language or pseudocode to define each step.
🧾 Example: Billing Algorithm with Discount
Step 1: Start
Step 2: Set total = 0
Step 3: Input number of items (n)
Step 4: Repeat n times:
- Input item price
- Add price to total
Step 5: If total > 1000, apply 5% discount:
- discount = total × 0.05
- total = total - discount
Step 6: Display final bill
Step 7: End
🔹 4. Check for Edge Cases
 Think about unusual situations like:
o What if no items are bought?
o What if total is exactly ₹1000?
Make sure your algorithm can handle these properly.
🔹 5. Optimize if Necessary
 Could it be made faster or more efficient?
 Are there unnecessary steps that can be removed?
🔹 6. Translate to Code (Optional Step for Programming)
Once the algorithm works well, it can be implemented using a programming language (e.g.,
Python, C++).
Real-World Problem Examples with Algorithms
Example 1: ATM Withdrawal
Problem: Design an algorithm to withdraw money from an ATM, checking if the balance is
sufficient.
Algorithm:
Step 1: Start
Step 2: Input balance and withdrawal amount
Step 3: If withdrawal amount > balance
- Display "Insufficient funds"
Else
- balance = balance - withdrawal amount
- Display "Please collect your cash"
- Display remaining balance
Step 4: End
Example 2: Grading System
Problem: Calculate a student's grade based on average marks.
Algorithm:
Step 1: Start
Step 2: Input marks of 5 subjects
Step 3: total = sum of marks
Step 4: average = total / 5
Step 5: If average ≥ 90 → Grade = A
Else if average ≥ 80 → Grade = B
Else if average ≥ 70 → Grade = C
Else if average ≥ 60 → Grade = D
Else → Grade = F
Step 6: Display grade
Step 7: End
Flowchart
A flowchart is a diagram that represents an algorithm visually using symbols like arrows,
rectangles, ovals, and diamonds.
Basic Flowchart Symbols:
 Start/End: Oval
 Process: Rectangle
 Decision: Diamond
 Input/Output: Parallelogram
 Arrow: Flow of control
Pseudocode
Pseudocode is a way to describe an algorithm using plain English-like statements that
resemble programming logic.
Example Problem:
Problem: Develop a solution to find the largest of two numbers.
🔹 A. Algorithm
Algorithm: Find the largest of two numbers
1. Start
2. Input two numbers A and B
3. Compare A and B
4. If A > B, then A is the largest
5. Else, B is the largest
6. Output the largest number
7. End
🔹 B. Flowchart
Here's a text version (you can visualize or draw it):
[Start]
|
v
[Input A, B]
|
v
[A > B?] ---> Yes ---> [Print "A is largest"]
| |
No v
| [End]
v
[Print "B is largest"]
|
v
[End]
🔹 C. Pseudocode
Start
Input A, B
If A > B Then
Print "A is the largest"
Else
Print "B is the largest"
End If
End
Summary Table
Concept Description Key Use

Algorithm Step-by-step instructions Logical planning of solution

Flowchart Visual diagram of the algorithm Easy visualization of control flow

Code-like but plain language Bridge between algorithm and real


Pseudocode
representation code
Programming Languages
A programming language is a set of rules, symbols, and syntax used to write instructions that
a computer can understand and execute.
Types of Programming Languages
1. Low-Level Languages
o Machine Language: Written in binary (0s and 1s). Directly understood by the
computer. Very difficult for humans.
o Assembly Language: Uses mnemonics (e.g., ADD, MOV). Easier than
machine language but still hardware dependent.
2. High-Level Languages
o Closer to human language, easier to learn and use.
o Examples: C, C++, Java, Python.
o Requires a compiler or interpreter to convert into machine code.
3. Fourth Generation Languages (4GL)
o More user-friendly, designed for specific tasks.
o Examples: SQL (databases), MATLAB (mathematics).
Programming Paradigms
A programming paradigm is a style or approach to writing programs. It defines how problems
are thought about and how solutions are structured.
Major Programming Paradigms
1. Imperative Paradigm
o Program = sequence of instructions.
o Tells the computer how to do a task.
o Examples: C, Pascal.
2. Procedural Paradigm
o A type of imperative programming.
o Focuses on procedures (functions) that operate on data.
o Example: C.
3. Object-Oriented Paradigm (OOP)
o Organizes code into objects (data + methods).
o Principles: Encapsulation, Inheritance, Polymorphism.
o Examples: C++, Java, Python.
4. Functional Paradigm
o Based on mathematical functions.
o Avoids changing state or data.
o Examples: Haskell, Lisp.
5. Logical Paradigm
o Uses rules and facts. The computer makes inferences.
o Example: Prolog.
Traditional Programming Concepts
These are the fundamental concepts used in programming across different paradigms:
1. Variables and Constants
o Variables: Storage locations whose values can change.
o Constants: Fixed values that cannot change.
2. Data Types
o Define the kind of data (int, float, char, string, boolean).
3. Operators
o Symbols to perform operations: arithmetic (+, -), relational (<, >), logical
(AND, OR).
4. Control Structures
o Sequential: Instructions executed one after another.
o Selection (Decision-making): if-else, switch.
o Iteration (Looping): for, while, do-while.
5. Functions/Procedures
o Reusable blocks of code for performing specific tasks.
6. Input and Output
o Reading data (input) and displaying results (output).
7. Modularity
o Breaking a program into smaller, manageable parts (modules).
8. Error Handling
o Detecting and managing errors in execution (exceptions).
Procedural Units
A procedural unit (also called a procedure, function, or subroutine) is a block of code
designed to perform a specific task within a program.
Characteristics of Procedural Units
 They have a name (identifier).
 They can accept inputs (called parameters).
 They may return a value or simply perform an action.
 They promote modularity and reusability in programs.
Types of Procedural Units
1. Procedures (Subroutines)
o Perform a specific task but do not return a value.
o Example (C-like pseudocode):
o void displayMessage() {
o printf("Hello, World!");
o }
2. Functions
o Perform a specific task and return a value.
o Example:
o int add(int a, int b) {
o return a + b;
o }
Advantages of Procedural Units
 Modularity – program is divided into smaller parts.
 Reusability – code can be reused in multiple places.
 Debugging & Testing – easier to test small units.
 Readability – programs are easier to understand.
Language Implementation
Language implementation refers to how a programming language is translated into
machine-executable instructions. Since computers understand only machine code (binary),
high-level programs must be converted.
Stages of Language Implementation
1. Source Code
o The program written in a high-level language (e.g., C, Java, Python).
2. Translator (Compiler/Interpreter/Assembler)
o Converts source code into machine code.
Types of Translators:
o Assembler → converts Assembly Language into Machine Language.
o Compiler → translates the whole program into machine code before
execution (e.g., C, C++).
o Interpreter → translates and executes line by line (e.g., Python, JavaScript).
3. Execution
o The machine code is executed by the CPU.
Language Implementation Methods
1. Compilation
o Entire program is translated before running.
o Fast execution.
o Example: C, C++.
2. Interpretation
o Translates code line by line while running.
o Slower but easier to debug.
o Example: Python, JavaScript.
3. Hybrid Implementation
o Uses both compilation and interpretation.
o Example: Java → Compiled to bytecode, then interpreted/compiled by JVM.
Declarative Programming
o Declarative programming is a programming paradigm where you describe
what the program should accomplish, not how it should be done.
o You focus on the logic of computation rather than the control flow.
o The language or runtime system decides the "how".
o It contrasts with imperative programming, where you specify step-by-step
instructions.
o Examples of Declarative Programming
o 1. SQL (Database Querying)
o In SQL, you don’t describe how to fetch data (loops, conditions). Instead, you
just declare what you want.
o -- Declarative: Just specify WHAT you want
o SELECT name, age
o FROM students
o WHERE age > 18;
o Here, you ask "give me all students older than 18" — the database decides
how to fetch it.
o 2. HTML (Web Page Structure)
o HTML is declarative because you declare what elements should appear on a
web page.
o <h1>Welcome to My Website</h1>
o <p>This is a simple paragraph.</p>
o You describe what content should appear, not how the browser should
render it internally.
Functional Programming (Haskell, Python)
o Declarative programming also appears in functional style, where you describe
what transformation you want, not the control flow.
o Example in Python (functional style):
o # Imperative style (how): loop through numbers and filter
o numbers = [1, 2, 3, 4, 5, 6]
o evens = []
o for n in numbers:
o if n % 2 == 0:
o [Link](n)
o print(evens) # [2, 4, 6]
o # Declarative style (what): use filter
o numbers = [1, 2, 3, 4, 5, 6]
o evens = list(filter(lambda x: x % 2 == 0, numbers))
o print(evens) # [2, 4, 6]
Key Features of Declarative Programming
o Focus on what to do, not how.
o Hides implementation details.
o Often used in databases, configuration, functional languages, logic
programming.

Software Development Life Cycle (SDLC)


Software Development Life Cycle (SDLC) is a structured process that is used to design,
develop, and test high-quality software. SDLC, or software development life cycle, is a
methodology that defines the entire procedure of software development step-by-step. The
goal of the SDLC life cycle model is to deliver high-quality, maintainable software that meets
the user's requirements.
SDLC in software engineering models outlines the plan for each stage so that each stage of
the software development model can perform its task efficiently to deliver the software at a
low cost within a given time frame that meets users requirements.
What is the Software Development Life Cycle (SDLC)?
SDLC is a process followed for software building within a software organization. SDLC
consists of a precise plan that describes how to develop, maintain, replace, and enhance
specific software. The life cycle defines a method for improving the quality of software and
the all-around development process.

SDLC
Stages of the Software Development Life Cycle
SDLC specifies the tasks to be performed at various stages by a software engineer or
developer. It ensures that the end product is able to meet the customer's expectations and fits
within the overall budget. Hence, it's vital for a software developer to have prior knowledge
of this software development process. SDLC is a collection of these six stages, and the stages
of SDLC are as follows:
Software Development Life Cycle Model SDLC Stages
Stage 1: Planning and Requirement Analysis
Planning is a crucial step in everything, just as in software development. In this same
stage, requirement analysis is also performed by the developers of the organization. This is
attained from customer inputs, and sales department/market surveys.
The information from this analysis forms the building blocks of a basic project. The quality
of the project is a result of planning. Thus, in this stage, the basic project is designed with all
the available information.

Stage-1 : Planning and Requirement Analysis


Stage 2: Defining Requirements
In this stage, all the requirements for the target software are specified. These requirements get
approval from customers, market analysts, and stakeholders.
This is fulfilled by utilizing SRS (Software Requirement Specification). This is a sort of
document that specifies all those things that need to be defined and created during the entire
project cycle.

Stage-2 : Defining Requirements


Stage 3: Designing Architecture
SRS is a reference for software designers to come up with the best architecture for the
software. Hence, with the requirements defined in SRS, multiple designs for the product
architecture are present in the Design Document Specification (DDS).
This DDS is assessed by market analysts and stakeholders. After evaluating all the possible
factors, the most practical and logical design is chosen for development.

Stage 3: Design
Stage 4: Developing Product
At this stage, the fundamental development of the product starts. For this, developers use a
specific programming code as per the design in the DDS. Hence, it is important for the coders
to follow the protocols set by the association. Conventional programming tools like
compilers, interpreters, debuggers, etc. are also put into use at this stage. Some popular
languages like C/C++, Python, Java, etc. are put into use as per the software regulations.

Stage 4: Development
Stage 5: Product Testing and Integration
After the development of the product, testing of the software is necessary to ensure its smooth
execution. Although, minimal testing is conducted at every stage of SDLC. Therefore, at this
stage, all the probable flaws are tracked, fixed, and retested. This ensures that the product
confronts the quality requirements of SRS.
Documentation, Training, and Support: Software documentation is an essential part of the
software development life cycle. A well-written document acts as a tool and means to
information repository necessary to know about software processes, functions, and
maintenance. Documentation also provides information about how to use the product.
Training in an attempt to improve the current or future employee performance by increasing
an employee's ability to work through learning, usually by changing his attitude and
developing his skills and understanding.
Stage 5: Testing
Stage 6: Deployment and Maintenance of Products
After detailed testing, the conclusive product is released in phases as per the organization’s
strategy. Then it is tested in a real industrial environment. It is important to ensure its smooth
performance. If it performs well, the organization sends out the product as a whole. After
retrieving beneficial feedback, the company releases it as it is or with auxiliary improvements
to make it further helpful for the customers. However, this alone is not enough. Therefore,
along with the deployment, the product's supervision.

Stage 6: Deployment and Maintenance

You might also like