How tavish108/hotel_booking works
Purpose and Entry Points
This is a Ruby object-oriented hotel booking system for managing hotels, rooms, guests, bookings, reviews, and payments. The likely executable entry points are main.rb and hotel_booking_system.rb; persistent hotel data is supplied through hotels.json.
Application Orchestration
hotel_booking_system.rb appears to be the top-level domain/application coordinator, while main.rb likely starts the program and drives its interaction flow. These files form the boundary between user-facing execution and domain services:
• main.rb
• hotel_booking_system.rb
Booking Workflow
Booking is represented as a first-class domain entity and coordinated through a dedicated service. BookingService.rb is the likely transaction/workflow layer: it should validate room availability, connect a guest and room/hotel, create a Booking, and trigger payment handling.
• BookingService.rb
• Booking.rb
• payment.rb
Hotel and Room Inventory
Hotel inventory is modeled separately from reservation activity. Hotel.rb likely owns hotel metadata and its available rooms, while Room.rb defines individual bookable units and their availability/rate state. This separation allows booking logic to operate on room inventory without embedding it in guest records.
• Hotel.rb
• Room.rb
• hotels.json
Guest and Booking Records
Guests are modeled independently and linked to bookings rather than embedded in hotel inventory. Guest.rb likely holds guest identity/contact information; Booking.rb captures the reservation relationship among guest, hotel or room, dates, and booking status.
• Guest.rb
• Booking.rb
• BookingService.rb
Reviews and Payments
Reviews and payments are distinct post- or alongside-booking concerns. Review.rb provides a feedback record associated with hotel stays, while payment.rb encapsulates payment-related state or processing. These should remain downstream of successful booking creation rather than being part of room inventory management.
• Review.rb
• payment.rb
• Booking.rb
Persistence and Runtime Boundaries
The runtime is Ruby, using local JSON storage rather than an external database or web service. hotels.json is the material persistence boundary indicated by the repository; loading and saving are expected to occur from the application coordinator or hotel-management flow. No external infrastructure, API integration, or deployment runtime is evidenced by the supplied repository tree.
• hotels.json
• hotel_booking_system.rb
• main.rb
Main entry points: BookingService.rb Booking service · Booking.rb Booking · hotel_booking_system.rb Booking system · Hotel.rb Hotel
Components 10
Runtime
- Program entry
main.rb - Booking system · Coordinates runtime flow and local hotel data.
hotel_booking_system.rb - Hotel data · Local persistence boundary for hotel inventory.
hotels.json
Booking workflow
- Booking service · Validates availability and creates reservations.
BookingService.rb - Booking
Booking.rb - Payment
payment.rb
Connections 15
- Program entry → Booking system: starts
- Booking system → Hotel data: loads and saves
- Booking system → Booking service: coordinates bookings
- Booking system → Hotel: manages inventory
- Hotel data → Hotel: supplies hotel data
- Hotel → Room: contains
- Booking service → Room: checks availability
- Booking service → Guest: uses guest
- Booking service → Booking: creates
- Booking service → Payment: triggers
- Booking → Guest: belongs to
- Booking → Room: reserves
- Booking → Payment: has payment
- Review → Booking: follows stay
- Review → Hotel: rates