SlideShare a Scribd company logo
3
Most read
4
Most read
20
Most read
LOGO
11
MODULAR PROGRAMMINGMODULAR PROGRAMMING
Submitted to: Submitted by:Submitted to: Submitted by:
Mrs. Priyanka Soni Krati KatyalMrs. Priyanka Soni Krati Katyal
MCA 1MCA 1stst
SemSem
Topics Covered
• Modular Programing
• Need of Modular Programming
• Why Modular Programming??
• Modularity
• Elements of Modular Programming
• Modular Programming Example
• Advantages of Modular Programming
• Disadvantages of Modular Programming
• Reference
Modular ProgrammingModular Programming
Modular programmingModular programming is a software designis a software design
technique that emphasizes separating thetechnique that emphasizes separating the
functionality of afunctionality of a programprogram into independent,into independent,
interchangeable modules, such that each containsinterchangeable modules, such that each contains
everything necessary to execute only one aspect ofeverything necessary to execute only one aspect of
the desired functionality.the desired functionality.
Need for Modular ProgrammingNeed for Modular Programming
• When a program becomes very large andWhen a program becomes very large and
complex, it becomes very difficult task for thecomplex, it becomes very difficult task for the
programmers to design, test and debug such aprogrammers to design, test and debug such a
program.program.
• Therefore a long program can be divided into aTherefore a long program can be divided into a
smaller program called modules as the modulessmaller program called modules as the modules
can be designed, tested and debugged separately,can be designed, tested and debugged separately,
the task of programmer becomes easy andthe task of programmer becomes easy and
convenient.convenient.
• It makes your program easy to understand.It makes your program easy to understand.
• Helps manage complexityHelps manage complexity
o Smaller blocks of codeSmaller blocks of code
o Easier to readEasier to read
• Encourages re-use of codeEncourages re-use of code
Within a particular program or acrossWithin a particular program or across
different programsdifferent programs
• Allows independent development of codeAllows independent development of code
Why Modular Programming??Why Modular Programming??
ModularityModularity
• How do you solve a big/complexHow do you solve a big/complex
problem?problem?
• Divide it into small tasks and solve eachDivide it into small tasks and solve each
task. Then combine these solutions.task. Then combine these solutions.
Divide and ConquerDivide and Conquer
• In C we useIn C we use functionsfunctions also referred to asalso referred to as
modulesmodules to perform specific tasks that weto perform specific tasks that we
determined in our solutiondetermined in our solution
• This strategy is essentially based on theThis strategy is essentially based on the
divide-and-conquer approach to problemdivide-and-conquer approach to problem
solving and has many advantages oversolving and has many advantages over
developing a program for the entire problem.developing a program for the entire problem.
• We will assign a name to each module andWe will assign a name to each module and
combine the named modules in a programcombine the named modules in a program
structure under the control of a mainstructure under the control of a main
program.program.
• Such a program structure consists of aSuch a program structure consists of a
set of modules and an order ofset of modules and an order of
execution.execution.
Elements of Modular ProgrammingElements of Modular Programming
• C requires that function names be unique in aC requires that function names be unique in a
source program file.source program file.
• Program execution always begins and eventuallyProgram execution always begins and eventually
terminates in the main function.terminates in the main function.
• Additional functions are called or invoked whenAdditional functions are called or invoked when
the program encounters function namesthe program encounters function names
• Functions could beFunctions could be
Pre-defined library functions (e.g., printf, sin, tan)Pre-defined library functions (e.g., printf, sin, tan)
oror
Programmer-defined functions (e.g., my_printf,Programmer-defined functions (e.g., my_printf,
area)area)
• FunctionsFunctions Perform a specific taskPerform a specific task
 Arguments with no return typeArguments with no return type
void fun(int x, int y)void fun(int x, int y)
{{
//statement//statement
}}
 Arguments with return typeArguments with return type
int fun(int x, int y)int fun(int x, int y)
{{
//statement//statement
return 0;return 0;
}}
 No arguments with no return typeNo arguments with no return type
void fun( )void fun( )
{{
//statement//statement
}}
 No Arguments with return typeNo Arguments with return type
int fun( )int fun( )
{{
//statement//statement
return 0;return 0;
}}
These functions require three elements:These functions require three elements:
1.1.Function declaration: In this only theFunction declaration: In this only the
name and the syntax of the function willname and the syntax of the function will
written.written.
2.2. Function calls: In this program will callFunction calls: In this program will call
the functionthe function
3. Function definition: In this program3. Function definition: In this program
will defines that how the function willwill defines that how the function will
perform there task.perform there task.
A function definition consists ofA function definition consists of
1. A function type1. A function type
2. A function name2. A function name
3. An optional list of formal parameters enclosed in3. An optional list of formal parameters enclosed in
parenthesesparentheses
4. A compound statement.4. A compound statement.
Ex : Void start(int a)Ex : Void start(int a)
{{
…….statement…...statement…..
}}
#include <stdio.h>#include <stdio.h>
int max(int num1, int num2);int max(int num1, int num2);
int main ()int main ()
{{
int a = 100;int a = 100;
int b = 200;int b = 200;
int ret;int ret;
ret = max(a, b);ret = max(a, b);
printf( "Max value is : %dn", ret );printf( "Max value is : %dn", ret );
Modular Programming ExampleModular Programming Example
return 0;return 0;
}}
int max(int num1, int num2)int max(int num1, int num2)
{{
int result;int result;
if (num1 > num2)if (num1 > num2)
result = num1;result = num1;
elseelse
result = num2;result = num2;
return result;return result;
}}
OutputOutput
Max value is : 200Max value is : 200
Advantages of using modulesAdvantages of using modules
• Modules can be written and testedModules can be written and tested
separatelyseparately
• Modules can be reusedModules can be reused
• Large projects can be developed inLarge projects can be developed in
parallelparallel
• Reduces length of program, making itReduces length of program, making it
more readablemore readable
• Promotes the concept ofPromotes the concept of abstractionabstraction
 A module hides details of a taskA module hides details of a task
 We just need to know what this moduleWe just need to know what this module
doesdoes
 We don’t need to know how it does itWe don’t need to know how it does it
Disadvantages of using modulesDisadvantages of using modules
• means documentation of modules must bemeans documentation of modules must be
systematicsystematic
• can lead to problems when modules are linkedcan lead to problems when modules are linked
because link must thoroughly testedbecause link must thoroughly tested
• Since separate modules map repeat certainSince separate modules map repeat certain
functions, the modular programming oftenfunctions, the modular programming often
need extra time and memory.need extra time and memory.
ReferenceReference
www.google.comwww.google.com
www.encyclopedia.comwww.encyclopedia.com
www.wikipedia.comwww.wikipedia.com
www.ctutorial.comwww.ctutorial.com
Thank You
MLSU
UNIVERSITY

More Related Content

PPT
Chapter Introduction to Modular Programming.ppt
PPT
Microprocessor ppt
PPT
Chapter 2 instructions language of the computer
PPTX
structured programming
PPTX
Importance of strategic planning
PPT
Control Structures
PPTX
PPTX
virus and antivirus
Chapter Introduction to Modular Programming.ppt
Microprocessor ppt
Chapter 2 instructions language of the computer
structured programming
Importance of strategic planning
Control Structures
virus and antivirus

What's hot (20)

PPTX
PPTX
C Programming: Control Structure
PPTX
Python Functions
PPTX
Function in C program
PDF
Strings in python
PPT
Basic concept of OOP's
PPT
Operators in C++
PPTX
Dynamic memory allocation in c
PPT
Function overloading(c++)
PPTX
Nested loops
PPTX
C tokens
PPTX
Operators in java
PPTX
Identifiers
PPTX
Functions in C
PPTX
Strings in C language
PPTX
Pointer in c
PPT
Operator Overloading
PPT
RECURSION IN C
PPTX
Procedural programming
PPTX
Functions in c language
C Programming: Control Structure
Python Functions
Function in C program
Strings in python
Basic concept of OOP's
Operators in C++
Dynamic memory allocation in c
Function overloading(c++)
Nested loops
C tokens
Operators in java
Identifiers
Functions in C
Strings in C language
Pointer in c
Operator Overloading
RECURSION IN C
Procedural programming
Functions in c language
Ad

Viewers also liked (6)

PPT
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
PPTX
And or graph problem reduction using predicate logic
PPT
Knapsack problem using fixed tuple
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
And or graph problem reduction using predicate logic
Knapsack problem using fixed tuple
Ad

Similar to Modular programming (20)

PPTX
Chapter One Function.pptx
PDF
Booting into functional programming
PPTX
PPTX
Mastering Python lesson 4_functions_parameters_arguments
PPT
U19CS101 - PPS Unit 4 PPT (1).ppt
PDF
5. Functions in C.pdf
PDF
C Interview Questions PDF By Scholarhat.pdf
PPT
chapterintroductiontomodularprogramming-230112092330-e3eb5a74 (1).ppt
PPTX
Funtions of c programming. the functions of c helps to clarify all the tops
PPTX
pythontraining-201jn026043638.pptx
PDF
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
PPTX
Python training
PPT
Oop(object oriented programming)
PPTX
object oriented programming part inheritance.pptx
PDF
Functions
PDF
ceng2404314334535365_hgf66353week_07-08_v0.8.pdf
PPTX
Introduction to C ++.pptx
PDF
VIT351 Software Development VI Unit1
PPTX
Function oneshot with python programming .pptx
PPTX
Different paradigms for problem solving.pptx
Chapter One Function.pptx
Booting into functional programming
Mastering Python lesson 4_functions_parameters_arguments
U19CS101 - PPS Unit 4 PPT (1).ppt
5. Functions in C.pdf
C Interview Questions PDF By Scholarhat.pdf
chapterintroductiontomodularprogramming-230112092330-e3eb5a74 (1).ppt
Funtions of c programming. the functions of c helps to clarify all the tops
pythontraining-201jn026043638.pptx
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Python training
Oop(object oriented programming)
object oriented programming part inheritance.pptx
Functions
ceng2404314334535365_hgf66353week_07-08_v0.8.pdf
Introduction to C ++.pptx
VIT351 Software Development VI Unit1
Function oneshot with python programming .pptx
Different paradigms for problem solving.pptx

Recently uploaded (20)

PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
UNIT 4 Total Quality Management .pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Welding lecture in detail for understanding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Well-logging-methods_new................
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
web development for engineering and engineering
PPT
Project quality management in manufacturing
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Construction Project Organization Group 2.pptx
PPTX
Sustainable Sites - Green Building Construction
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
UNIT 4 Total Quality Management .pptx
573137875-Attendance-Management-System-original
Lesson 3_Tessellation.pptx finite Mathematics
Welding lecture in detail for understanding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Well-logging-methods_new................
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Internet of Things (IOT) - A guide to understanding
OOP with Java - Java Introduction (Basics)
Structs to JSON How Go Powers REST APIs.pdf
web development for engineering and engineering
Project quality management in manufacturing
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Construction Project Organization Group 2.pptx
Sustainable Sites - Green Building Construction

Modular programming

  • 1. LOGO 11 MODULAR PROGRAMMINGMODULAR PROGRAMMING Submitted to: Submitted by:Submitted to: Submitted by: Mrs. Priyanka Soni Krati KatyalMrs. Priyanka Soni Krati Katyal MCA 1MCA 1stst SemSem
  • 2. Topics Covered • Modular Programing • Need of Modular Programming • Why Modular Programming?? • Modularity • Elements of Modular Programming • Modular Programming Example • Advantages of Modular Programming • Disadvantages of Modular Programming • Reference
  • 3. Modular ProgrammingModular Programming Modular programmingModular programming is a software designis a software design technique that emphasizes separating thetechnique that emphasizes separating the functionality of afunctionality of a programprogram into independent,into independent, interchangeable modules, such that each containsinterchangeable modules, such that each contains everything necessary to execute only one aspect ofeverything necessary to execute only one aspect of the desired functionality.the desired functionality.
  • 4. Need for Modular ProgrammingNeed for Modular Programming • When a program becomes very large andWhen a program becomes very large and complex, it becomes very difficult task for thecomplex, it becomes very difficult task for the programmers to design, test and debug such aprogrammers to design, test and debug such a program.program. • Therefore a long program can be divided into aTherefore a long program can be divided into a smaller program called modules as the modulessmaller program called modules as the modules can be designed, tested and debugged separately,can be designed, tested and debugged separately, the task of programmer becomes easy andthe task of programmer becomes easy and convenient.convenient. • It makes your program easy to understand.It makes your program easy to understand.
  • 5. • Helps manage complexityHelps manage complexity o Smaller blocks of codeSmaller blocks of code o Easier to readEasier to read • Encourages re-use of codeEncourages re-use of code Within a particular program or acrossWithin a particular program or across different programsdifferent programs • Allows independent development of codeAllows independent development of code Why Modular Programming??Why Modular Programming??
  • 6. ModularityModularity • How do you solve a big/complexHow do you solve a big/complex problem?problem? • Divide it into small tasks and solve eachDivide it into small tasks and solve each task. Then combine these solutions.task. Then combine these solutions. Divide and ConquerDivide and Conquer
  • 7. • In C we useIn C we use functionsfunctions also referred to asalso referred to as modulesmodules to perform specific tasks that weto perform specific tasks that we determined in our solutiondetermined in our solution • This strategy is essentially based on theThis strategy is essentially based on the divide-and-conquer approach to problemdivide-and-conquer approach to problem solving and has many advantages oversolving and has many advantages over developing a program for the entire problem.developing a program for the entire problem. • We will assign a name to each module andWe will assign a name to each module and combine the named modules in a programcombine the named modules in a program structure under the control of a mainstructure under the control of a main program.program.
  • 8. • Such a program structure consists of aSuch a program structure consists of a set of modules and an order ofset of modules and an order of execution.execution.
  • 9. Elements of Modular ProgrammingElements of Modular Programming • C requires that function names be unique in aC requires that function names be unique in a source program file.source program file. • Program execution always begins and eventuallyProgram execution always begins and eventually terminates in the main function.terminates in the main function. • Additional functions are called or invoked whenAdditional functions are called or invoked when the program encounters function namesthe program encounters function names • Functions could beFunctions could be Pre-defined library functions (e.g., printf, sin, tan)Pre-defined library functions (e.g., printf, sin, tan) oror Programmer-defined functions (e.g., my_printf,Programmer-defined functions (e.g., my_printf, area)area)
  • 10. • FunctionsFunctions Perform a specific taskPerform a specific task  Arguments with no return typeArguments with no return type void fun(int x, int y)void fun(int x, int y) {{ //statement//statement }}  Arguments with return typeArguments with return type int fun(int x, int y)int fun(int x, int y) {{ //statement//statement return 0;return 0; }}
  • 11.  No arguments with no return typeNo arguments with no return type void fun( )void fun( ) {{ //statement//statement }}  No Arguments with return typeNo Arguments with return type int fun( )int fun( ) {{ //statement//statement return 0;return 0; }}
  • 12. These functions require three elements:These functions require three elements: 1.1.Function declaration: In this only theFunction declaration: In this only the name and the syntax of the function willname and the syntax of the function will written.written. 2.2. Function calls: In this program will callFunction calls: In this program will call the functionthe function 3. Function definition: In this program3. Function definition: In this program will defines that how the function willwill defines that how the function will perform there task.perform there task.
  • 13. A function definition consists ofA function definition consists of 1. A function type1. A function type 2. A function name2. A function name 3. An optional list of formal parameters enclosed in3. An optional list of formal parameters enclosed in parenthesesparentheses 4. A compound statement.4. A compound statement. Ex : Void start(int a)Ex : Void start(int a) {{ …….statement…...statement….. }}
  • 14. #include <stdio.h>#include <stdio.h> int max(int num1, int num2);int max(int num1, int num2); int main ()int main () {{ int a = 100;int a = 100; int b = 200;int b = 200; int ret;int ret; ret = max(a, b);ret = max(a, b); printf( "Max value is : %dn", ret );printf( "Max value is : %dn", ret ); Modular Programming ExampleModular Programming Example
  • 15. return 0;return 0; }} int max(int num1, int num2)int max(int num1, int num2) {{ int result;int result; if (num1 > num2)if (num1 > num2) result = num1;result = num1; elseelse result = num2;result = num2; return result;return result; }}
  • 16. OutputOutput Max value is : 200Max value is : 200
  • 17. Advantages of using modulesAdvantages of using modules • Modules can be written and testedModules can be written and tested separatelyseparately • Modules can be reusedModules can be reused • Large projects can be developed inLarge projects can be developed in parallelparallel • Reduces length of program, making itReduces length of program, making it more readablemore readable • Promotes the concept ofPromotes the concept of abstractionabstraction  A module hides details of a taskA module hides details of a task  We just need to know what this moduleWe just need to know what this module doesdoes  We don’t need to know how it does itWe don’t need to know how it does it
  • 18. Disadvantages of using modulesDisadvantages of using modules • means documentation of modules must bemeans documentation of modules must be systematicsystematic • can lead to problems when modules are linkedcan lead to problems when modules are linked because link must thoroughly testedbecause link must thoroughly tested • Since separate modules map repeat certainSince separate modules map repeat certain functions, the modular programming oftenfunctions, the modular programming often need extra time and memory.need extra time and memory.