Applications of MVC in the real world - Example Car

Let me exemplify the same using the example of a system like a CAR.

Can you think as to why the structural parts of the car like engine, transmission derive, gear box, filters etc are arranged either in the front or the back bonnet of your car , they are never situated or accessed from the passenger section of the car ?

Also think as to why the wheels (the structural parts of the car ) kept open although we know every well designed system should be black box to the end user?

Ideally wheels are the structural part of the car and hence should not be exposed to the user , the way other structural parts are hidden from the user.

We can get the answers to these questions if we try to study car as a system using the principles that we have learnt in this chapter.

There are three actors for a system like a Car viz..

  • Driver
  • Passenger
  • Mechanic

Lets take the first actor as the Driver.

Car from a Drivers Perspective

I hope you will agree that on the drivers seat, the driver will see interfaces like the steering wheel, gear stick, clutch, brake, accelerator, hand brakes etc. or very simply can say on a drivers seat we will see all the interfaces which a driver needs to drive a car.

Have you ever seen a driver having access to interfaces to behaviors meant for the passenger or the mechanic?

Have you ever seen driver been able to change the reclining seat of the passenger or the adjust his TV channel of access the luxuries meant for the passenger?

Car from a Passengers Perspective

On the passengers seat you will see interfaces to change the angle of the passengers seat, seat belts, TV, Refrigerator etc. or On the passengers seat you will see interfaces to behaviors which a passenger is supposed to use. Don't you think it's a better to have a set of brakes with the passenger as well?

Car from a mechanics Perspective

The mechanic is an actor who is supposed to access and modify the structural components of a car in case it breaks down and he should be able to do his job without getting access to the interfaces of the driver as well as the passenger.

The reason the structural parts of the car are placed in the front or the back bonnet is because in this configuration the mechanic can do his job without accessing or knowing about the interfaces meant for the Driver and the Passenger.

In a system like car the structural parts of your car like Engine, Gear Box, Transmission Drive, head lights , wheels etc are the Domain Entities of the system.

The Boundary Entities are the interfaces like Steering wheels , Accelerator, Clutch , Brake etc for driver.

The Control Entities are the microprocessor chips which gets the signals from the boundary entities(user interfaces) and these chips internally make the structural parts of the car intercommunicate in a way so as to deliver the behavior that's needed.

This architectural style will also explain why wheels are left open?

If wheels were always supposed to be replaced by a mechanic in a work shop , then it would have been covered like every other part of a car. Actually to a passenger or a driver it doesn't really matter as to whether the car moves using a chain drive or a sledge internally till it moves at 100kmph with 4 passengers.

But as we know wheels are a part of the car which sometimes needs to be accessed by the driver or the passenger and hence they are kept open.

We can define every other system which we land up using like Television, Microwave, Refrigerator etc using Domain, Control and Boundary entities.

Using these above examples I want to show how every well designed system is incorporating this architectural style.

I will leave it to the reader to decide the name of this architectural style.

The principles discussed in this chapter are so fundamental that most of the systems, patterns , programming languages , frameworks and technologies will be designed using the same.

Hemant Jha
Founder - VPlanSolutions
Researcher, Trainer