answersLogoWhite

0

What is modularity in computer programming?

Updated: 8/10/2023
User Avatar

Manjunathsvit

Lvl 1
14y ago

Best Answer

Every program requires at least one module. While it is possible to write an entire program in just one module, the larger the program becomes the greater the cost in maintenance. That is, whenever we make any changes to that module, the entire program has to be recompiled. By splitting the program into modules, only those modules that have changed need to be recompiled.

Modular code also makes it easier to organise code because each module represents a particular aspect of the program. Ideally each module should be self-contained but there will inevitably be cases where one module is dependant upon another. Indeed, there may be several modules dependant upon the same module. However, this is an advantage rather than a disadvantage because modular code makes it much easier to write re-usable code; code that can be used in more than one program. In this way we do not have to re-invent wheels writing duplicate code, we only need to write the code once and use it wherever and whenever it is required.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Modularity is important, code should be proceedurised by splitting complex algorithms into self contained parts which have conceptual relevance. This aids with program understanding. Also, write functions for pieces which can be re-used in several places, this will reduce both the total quantity of software and the possibility of bugs (LESS CODE LESS BUGS). This (when done properly) should result in small numbers of function parameters. If a large number seem to be required consider whether they are really necessary of if they would be sensibly encapsulated in a data structure (see below).

Always name functions so that their names bear more than just a passing resembelance to their task, but avoid long function names. Function names should follow a naming convention where possible, in C this can be used as a primitive form of ``namespacing''.

Declare functions as static if they are not intended to be accessed by other parts of the system.

Functions should not be overlong. A good (understandable ) length for a function is around 40 to 80 lines. Any longer than this and it becomes difficult for other programmers to understand exactly what it does (simply limitations of human short term memory) any shorter than this and you may be needlessly introducing levels of indirection into program flow which is difficult to track.

Associated functions should be stored in the same C file. Hierachal splitting of functions is considered good programming style but it is useful for other programmers to be able to follow the flow of a program around the minimum number of files. Up to 10 associated function declarations within a single file is acceptable. An acceptable length for a C file is 250-500 lines, any longer than this and you should serously start considering common data flow and organisation to see if the routines would not be better split up. The main reason for having separate files is development flexibility. If two programmers need to simultaneously modify the same file then this will make integrating their efforts more complicated. You can thus make decisions on which functions to group together on the basis of considering which functions are likely to require joint modification.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

Designing the software as a collection of modules (e.g. subroutines, tasks, coroutines, objects) having well defined purposes and boundaries that only communicate between each other via narrow well defined local interfaces (no global data pools used).

This is a general concept of software engineering developed in the early 1960s and gradually refined over time. Its latest and most refined form is Object Oriented Programming, wherein modules have been replaced with objects and the local interfaces with message transfers.

This answer is:
User Avatar

User Avatar

vchan

Lvl 2
1y ago

Modular programming is a software design technique that involves separating a computer program into distinct, independent modules or components. Each module contains a specific set of related functions and data and can be reused in different parts of the program. This approach allows for easier maintenance, testing, and modification of the code, as well as better scalability and flexibility. Modular programming also promotes code reusability and separation of concerns by separating different functionality into different modules. This can make the code more organized and easier to understand.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Modularity is a general systems concept, typically defined as a continuum describing the degree to which a system's components may be separated and recombined.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

java is a purely platform independent

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Modular programming

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

english

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is modularity in computer programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is an aspect-oriented programming language?

An aspect-oriented programming language is another name for an aspect-oriented language - a computer programming language which aims to increase modularity by allowing the separation of crosscutting concerns.


What is an aspect-oriented language?

An aspect-oriented language is a computer programming language which aims to increase modularity by allowing the separation of crosscutting concerns.


What are the four pillars object oriented programming?

1.Abstraction 2.Encapsulation 3.Modularity 4.Hierarchy


What is AOP?

AOP or Aspect oriented Programming is A paradigm in Computer Science. In traditional object-oriented programming, common code like logging, exception handling scattered all across method, classes, object hierarchies, or even entire object models. so Aspect oriented programming is a technique to separate these concerns from real problem domain and increase modularity and reusability of program


How is computer programming used in computer programming?

Parallax is used in computer programming by using a computer and a USB connection. They have been popular in robotics because of their easiness to program.


Advantages of computer programming?

The advantages of computer programming is that it pays well since programming is a creative task. Computer programming helps human beings solve problems on a regular basis.


What is the diffirence of computer programming and computer science?

Computer science is a more abstract study of computing techniques; which will include computer programming. Computer programming, as it implies, is the practise of writing programs for computers.


How many pages does The Art of Computer Programming have?

The Art of Computer Programming has 634 pages.


How is writing is somewhat like computer programming?

writing and computer programming are basically the same!


How do you remove the governor on a 1992 dodge stealth rt tt?

It is part of the computer programming and can not be removed.It is part of the computer programming and can not be removed.


Where did IBM get their programming language?

Computer programming language


3 pillars of object oriented programming?

abstraction, inheritance, encapsulation, and polymorphism.