Professional Documents
Culture Documents
Real-World Modularity: Eample 1
Real-World Modularity: Eample 1
Real-World Modularity: Eample 1
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...
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.
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
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