What is major characteristic of modular programming ? How is it similar to procedural
programming ?
Answers
Answer:
Modular programs are usually easier to code, debug, and change than monolithic programs. The modular approach to programming is similar to the design of hardware that contains numerous circuits. The device or program is logically divided into "black boxes" with specific inputs and outputs.
Modularity is a question of defining functions and grouping them in ways that avoid unnecessary coupling between components. You isolate parts of your code to make it easier to manage, and you don’t have to keep all the details in your head at once.
You can write modular code in procedural languages like C. In some sense, “good C” means writing good modules so you can manage the complexity of your program as it gets larger. If you write a library which manages a data structure, e.g. a linked list, then you can call it linked_list.c, and have functions that all take a linked_list_t as the structure that they are working on.
The next step is to formalize that in something like C++, which has types and conventions to build modules. This is separate from the question of whether you should be using inheritance to model your data. It’s just a better form of modularity.
Procedural code is a term that is mostly used in relation to ancient programming styles which use global variables and goto. It means breaking up your code into functions. That’s at a lower level than modularity, but it’s similar. It replaces global variables with local variables.
More modern is functional programming, which uses types to define programming interfaces and standard higher-order programming concepts like map/reduce to manipulate data. These tools provide a level of productivity and safety that go beyond procedural and object oriented code.
Answer:
Characteristics of procedural programming
A large program is broken down into small manageable procedures or functions. ...
Different functions can share data via global variables. ...
Functions can change global data. ...
Top-down methodology.
Hope it helps you