0% found this document useful (0 votes)
78 views4 pages

Program Design With Modules and Oops

Modular programming involves breaking down program functions into separate, interchangeable components called modules. Each module accomplishes one function and contains everything needed to do so. Modules are incorporated through interfaces that define their required and provided elements. Object-oriented programming uses objects that contain data fields and methods. Key concepts include abstraction of data and actions, encapsulation of an object's internal representation, message passing between objects, modularity through modules, polymorphism through common interfaces, and inheritance where classes can inherit attributes from other classes.

Uploaded by

Rohith Bhaskaran
Copyright
© Attribution Non-Commercial (BY-NC)
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)
78 views4 pages

Program Design With Modules and Oops

Modular programming involves breaking down program functions into separate, interchangeable components called modules. Each module accomplishes one function and contains everything needed to do so. Modules are incorporated through interfaces that define their required and provided elements. Object-oriented programming uses objects that contain data fields and methods. Key concepts include abstraction of data and actions, encapsulation of an object's internal representation, message passing between objects, modularity through modules, polymorphism through common interfaces, and inheritance where classes can inherit attributes from other classes.

Uploaded by

Rohith Bhaskaran
Copyright
© Attribution Non-Commercial (BY-NC)
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
You are on page 1/ 4

Program design with modules

Modular programming is a software design technique that increases the extent to which software is
composed of separate, interchangeable components, called modules by breaking down program
functions into modules, each of which accomplishes one function and contains everything necessary to
accomplish this. Conceptually, modules represent a separation of concerns, and improve maintainability
by enforcing logical boundaries between components. Modules are typically incorporated into the
program through interfaces. A module interface expresses the elements that are provided and required
by the module. The elements defined in the interface are detectable by other modules. The
implementation contains the working code that corresponds to the elements declared in the interface

The basic idea underlying modular design is to organize a complex system as a set of distinct
components that can be developed independently and then plugged together. Although this may appear
a simple idea, experience shows that the effectiveness of the technique depends critically on the
manner in which systems are divided into components and the mechanisms used to plug components
together. The following design principles are particularly relevant to parallel programming.

Provide simple interfaces.

Simple interfaces reduce the number of interactions that must be considered when verifying
that a system performs its intended function. Simple interfaces also make it easier to reuse
components in different circumstances. Reuse is a major cost saver. Not only does it reduce
time spent in coding, design, and testing, but it also allows development costs to be amortized
over many projects. Numerous studies have shown that reusing software is by far the most
effective technique for reducing software development costs.

Ensure that modules hide information.

The benefits of modularity do not follow automatically from the act of subdividing a program.
The way in which a program is decomposed can make an enormous difference to how easily the
program can be implemented and modified. Experience shows that each module should
encapsulate information that is not available to the rest of a   program.
Use appropriate tools.

While modular designs can in principle be implemented in any programming language,


implementation is easier if the language supports information hiding by permitting the
encapsulation of code and data structures. Fundamental mechanisms in this regard include the
procedure (or subroutine or function) with its locally scoped variables and argument list, used
to encapsulate code; the user-defined data type, used to encapsulate data; and dynamic
memory allocation, which allows subprograms to acquire storage without the involvement of
the calling program. These features are supported by most modern languages (e.g., C++ ,
Fortran 90 etc.).

Object-oriented programming

Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures


consisting of data fields and methods together with their interactions – to design applications and
computer programs. Programming techniques may include features such as data abstraction,
encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming
languages now support OOP.

Abstraction

In computer science, abstraction is the process by which data and programs are defined with a
representation similar to its meaning (semantics), while hiding away the implementation details.
Abstraction tries to reduce and factor out details so that the programmer can focus on a few concepts at
a time. A system can have several abstraction layers whereby different meanings and amounts of detail
are exposed to the programmer. For example, low-level abstraction layers expose details of the
hardware where the program is run, while high-level layers deal with the business logic of the program.
In computer programming, abstraction can apply to control or to data: Control abstraction is the
abstraction of actions while data abstraction is that of data structures.
Encapsulation

Encapsulation means that the internal representation of an object is generally hidden from view outside
of the object's definition. Hiding the internals of the object protects its integrity by preventing users
from setting the internal data of the component into an invalid or inconsistent state. A benefit of
encapsulation is that it can reduce system complexity, and thus increases robustness, by allowing the
developer to limit the interdependencies between software components.

Message passing

Message passing in computer science is a form of communication used in parallel computing, object-
oriented programming, and inter process communication. In this model, processes or objects can send
and receive messages to other processes. By waiting for messages, processes can also synchronize.
Message passing is the paradigm of communication where messages are sent from a sender to one or
more recipients. Forms of messages include method invocation, signals, and data packets.

Modularity
Modular programming is a software design technique that increases the extent to which software is
composed of separate, interchangeable components, called modules by breaking down program
functions into modules, each of which accomplishes one function and contains everything necessary to
accomplish this.[1] Conceptually, modules represent a separation of concerns, and improve
maintainability by enforcing logical boundaries between components. Modules are typically
incorporated into the program through interfaces.[2] A module interface expresses the elements that are
provided and required by the module. The elements defined in the interface are detectable by other
modules. The implementation contains the working code that corresponds to the elements declared in
the interface.

Polymorphism

Polymorphism is the ability to create a variable, a function, or an object that has more than one form.
The purpose of polymorphism is to implement a style of programming called message-passing in the
literature in which objects of various types define a common interface of operations for users. Operator
overloading of the numeric operators (+, -, *, and /) allows polymorphic treatment of the various
numerical types: integer, unsigned integer, float, decimal, etc; each of which have different ranges, bit
patterns, and representations. Another common example is the use of the "+" operator which allows
similar or polymorphic treatment of numbers (addition), strings (concatenation), and lists (attachment).
This is a lesser used feature of polymorphism.

Inheritance

In object-oriented programming (OOP), inheritance is a way to compartmentalize and reuse code by


creating collections of attributes and behaviors called objects which can be based on previously created
objects. In classical inheritance where objects are defined by classes, classes can inherit other classes.
The new classes, known as sub classes , inherit attributes and behavior of the pre-existing classes, which
are referred to as super classes . The inheritance relationships of classes give rise to a hierarchy. In
prototype-based programming, objects can be defined directly from other objects without the need to
define any classes, in which case this feature is called differential inheritance. Inheritance is used to co-
relate two or more classes to each other. With the use of inheritance we can use the methods and the
instance variables of other classes in any other classes.

You might also like