This is a bit experimentation from my part because I had written a lot of procedural code back in my school days hence I have trouble in thinking in OOP way i.e. to find proper classes and relationship between them. I know I cannot do this every time but I need to create some kind of correlation which may help me understand if I am thinking in right direction or not.Below is the code of a parking lot allocation problem:/* A parking lot can have many slots which has different size.A slot can be occupied by at most two vehicles.Checkin: * Find the slot for the vehicle based on sizeCheckout: * Calculate total fare based on vehicle size and durationQuestions:  * Design bottom up or top down i.e. Vehicle, Slot or ParkingLot */ // Slot details, 3 slotscapacity = [4, 2, 2];// Vehicle details, 4 vehiclessizes  = [2, 1, 2, 2];parked = [1, 0, 1, 1];start  = ['001', nil, '002', '003'];end    = ['005', nil, '006', '008'];// slot vehicle relationvehicleSlot = [0, nil, 0, 1];function checkin (vehicle) {  for slot, size in capacity:    if capacity[slot] >= size[vehicle]:      start[vehicle]  = currentTimestamp;      vehicleSlot[vehicle] = slot;      capacity[slot] -= size[vehicle];      return true;  return 'No slot empty'}function checkout (vehicle) {  if (vehicleSlot[vehicle] == nil):    return 'Invalid checkout'  slot = vehicleSlot[vehicle];  capacity[slot] += size[vehicle];  end[vehicle] = currentTimestamp;  vehicleSlot[vehicle] = nil;  return pricingAlgo(vehicle);}function pricingAlgo (vehicle) {  // size * duration  var duration = (end[vehicle] - start[vehicle]);  return sizes[vehicle] * duration;}The code may not be completely correct but it shows what I am trying to do at least. I need to know if there is a way to evolve this code to a good OOP program?
Turning structural code into object oriented code
object oriented;programming practices;object oriented design;domain driven design