Real-World Modularity: Eample 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Abstraction: Abstraction means showing essential features and hiding non-essential

features to the user.

For Eg. Yahoo Mail...

When you provide the user name and password and click on submit button..It will show
Compose,Inbox,Outbox,Sent mails...so and so when you click on compose it will
open...but user doesn't
know what are the actions performed internally....It just Opens....that is essential; User
doesn't know internal actions ...that is non-essential things...

For Eg. TV Remote..


Remote is a interface between user and tv..right. which has buttons like 0 to 10 ,on /of
etc but we don’t know circuits inside remote...User does not need to know..Just he is
using essential thing that is remote.

Encapsulation: Encapsulation means which binds the data and code (or) writing
operations and methods in single unit (class).

For Example:
A car is having multiple parts..like steering,wheels,engine...etc..which binds together to
form a single object that is car. So, Here multiple parts of cars encapsulates itself
together to form a single object that is Car.

In real time we are using Encapsulation for security purpose...

Encapsulation = Abstraction + Data Hiding.

A Computer's Cabinet cause all the essential components like hard disk, CPU, mother
board etc are inside. But can you access them directly ? No, you can't but definitely via
I/O ports. ( Protect everything and expose only those parts which are essentially
required)

Real-world modularity

Eample 1 :

The real world of design…is full of examples of modularity.…As an exercise, let's apply
these pillars…to the automobile industry, and see…how cars are designed to be very
modular.…Let's focus on just one part of the car, the wheels.…Wheels can be seen as
delivering…the functionality of movement and grip on the pavement.…The driver has
some control on…movement of the wheels, but it's indirect…through the gas pedal, fuel
injection, engine,…transmission, axle, rims, and finally to the tires.…
The driver has no control over grip,…as this is largely a function…of tire specifications
and design.…The wheels' functionality is encapsulated,…in that it has total control over
what it does,…but gives external components, in this case…the gas pedal, fuel
injection,…engine, transmission, axle, and rim,…some control over how fast it
spins.…There's no way to externally control…how to offer movement and grip.…The
car's system just asks for it.…Wheels are also interoperable, they can
be…manufactured by many different vendors,…

Example 2 :

Let's consider a familiar modular system. You are most likely reading this book in a place that
has electricity and there are many electric outlets in the walls surrounding you. This system
enables you to plug in various electrical devices into the outlets and each one of these
devices is designed to do a very specific task.

Consider the electrical devices that are plugged into some of these outlets: microwaves,
electric kettles, washers, dryers, and so on.

None of these devices care if they are plugged into the electrical outlet in your house or your
neighbor's house. They are designed to do their specific task and functionality when they are
plugged in and when the power is on, regardless of whose house they are in.

Our application modules should follow the same philosophy. This means, regardless of where
in the application they are plugged in and even regardless of what application they are
plugged into, they should do their specific task and only their specific task.

Also, in exactly the same way that an electrical device can easily be unplugged from the wall
outlet, a code module should be designed...
Example of a Concurrent, Real-time System: An Elevator System

As an example to illustrate the concepts to be discussed, we will use an elevator


system. More precisely, we mean a computer system designed to control a group of
elevators at one location in a building. Obviously there may be many things going on
concurrently within a group of elevators—or nothing at all! At any point in time
someone on any floor may request an elevator, and other requests may be pending.
Some of the elevators may be idle, while others are either carrying passengers, or
going to answer a call, or both. Doors must open and close at appropriate times.
Passengers may be obstructing the doors, or pressing door open or close buttons, or
selecting floors—then changing their minds. Displays need to be updated, motors
need to be controlled, and so on, all under the supervision of the elevator control
system. Overall, it’s a good model for exploring concurrency concepts, and one for
which we share a reasonably common degree of understanding and a working
vocabulary.

 Railway Networks (note shared sections of track)


 Gardening (people rake, sweep, mow, plant, etc.)
 Machines in a factory
 Banking systems
 Travel reservation systems
 Multiplayer games

Hardware examples:

 A single processor can have multiple execution pipelines (but only one set
of registers)
 A processor can have multiple cores (multicore)
 A computer can have multiple processors
 A network can have multiple computers (Grid computing happens on
these)
 An internet has multiple networks

You might also like