#oop question for seat entity in concert question

3 messages · Page 1 of 1 (latest)

neon nacelle
#

what is the point of id here? I suppose seatNumber could be a unique identifier. So why need to design an extra field called id here?
'''

type Seat struct {
ID string
SeatNumber string
Type SeatType
Price float64
status SeatStatus
mu sync.Mutex
}

func NewSeat(id, seatNumber string, seatType SeatType, price float64) *Seat {
return &Seat{
ID: id,
SeatNumber: seatNumber,
Type: seatType,
Price: price,
status: StatusAvailable,
}
}
'''

frigid bolt
#

This question has no answer, it depends fully on the context of what you're making
If seat number and Id have the same purpose then yeah unnecessary
Also unrelated to oop

delicate gyro
#

Is Seat number unique? What if there are multiple stadiums with the same numbers? Or the same seat but different shows