Real world objects are handled very similarly to software object oriented design. Suppose
you are designing an object oriented design for a parking lot:
1. What are your goals? For example: !gure out if a parking spot is taken, !gure out how
many cars of each type are in the parking lot, look up handicapped spots, etc.
2. Now, think about the core objects (Car, ParkingSpot, ParkingLot, ParkingMeter, etc—
Car has di#erent subclasses, and ParkingSpot is also subclassed for handicapped spot).
3. Have we missed anything? How will we represent parking restrictions based on time
or payment? Perhaps, we’ll add a class called Permission which handles di#erent pay-
ment systems. Permission will be sub-classed into classes PaidPermission (fee to park)
and FreeParking (open parking). ParkingLot will have a method called GetPermission
which will return the current Permission object based on the time.
4. How will we know whether or not a car is in a spot? Think about how to represent the
data so that the methods are most e$cient.
you are designing an object oriented design for a parking lot:
1. What are your goals? For example: !gure out if a parking spot is taken, !gure out how
many cars of each type are in the parking lot, look up handicapped spots, etc.
2. Now, think about the core objects (Car, ParkingSpot, ParkingLot, ParkingMeter, etc—
Car has di#erent subclasses, and ParkingSpot is also subclassed for handicapped spot).
3. Have we missed anything? How will we represent parking restrictions based on time
or payment? Perhaps, we’ll add a class called Permission which handles di#erent pay-
ment systems. Permission will be sub-classed into classes PaidPermission (fee to park)
and FreeParking (open parking). ParkingLot will have a method called GetPermission
which will return the current Permission object based on the time.
4. How will we know whether or not a car is in a spot? Think about how to represent the
data so that the methods are most e$cient.