A module is a part of a program. Programs are composed of one or more independently developed modules. A single module can contain one or several statements closely related each other. Modules work perfectly on individual level and can be integrated with other modules. A software program can be divided into modules to ease the job of programming and debugging as well. A program can be divided into small functional modules that work together to get the output. The process of subdividing a computer program into separate sub-programs is called Modular programming. Modular programming enables programmers to divide up the work and debug pieces of the program independently. The examples of modules are procedures, subroutines, and functions.
The following are the desirable characteristics of a module.
1. Modules contain instructions, processing logic, and data.
2. Modules can be separately compiled and stored in a library.
3. Modules can be included in a program.
4. Module segments can be used by invoking a name and some parameters.
5. Module segments can be used by other modules.
· Less code to be written.
· A single procedure can be developed for reuse, eliminating the need to retype the code many times.
· Programs can be designed more easily because a small team deals with only a small part of the entire code.
· Modular programming allows many programmers to collaborate on the same application.
· The code is stored across multiple files.
· Code is short, simple and easy to understand.
· Errors can easily be identified, as they are localized to a subroutine or function.
· The same code can be used in many applications.
· The scoping of variables can easily be controlled. Less code to be written.
Access control is a security technique that regulates who or what can view or use resources in a computing environment. It is a fundamental concept in security that minimizes risk to the object. In other words access control is a selective restriction of access to data. IN Object oriented programming languages it is implemented through access modifiers. Classical object- oriented languages, such as C++ and Java, control the access to class members by public, private and protected keywords. Private members of a class are denied access from the outside the class. They can be handled only from within the class.
Public members (generally methods declared in a class) are accessible from outside the class. The object of the same class is required to invoke a public method. This arrangement of private instance variables and public methods ensures the principle of data encapsulation.
Protected members of a class are accessible from within the class and are also available to its sub-classes. No other process is permitted access to it. This enables specific resources of the parent class to be inherited by the child class.
Python doesn't have any mechanism that effectively restricts access to any instance variable or method. Python prescribes a convention of prefixing the name of the variable or method with single or double underscore to emulate the behaviour of protected and private access specifiers.
All members in a Python class are public by default, whereas by default in C++ and java they are private. Any member can be accessed from outside the class environment in Python which is not possible in C++ and java.