Skip to content

Improve Encapsulation and Method Design in Booking Class #63

Open
@Mykyta-Panchenko

Description

@Mykyta-Panchenko

Problem:
The Booking class has several issues related to encapsulation and method structure:

Lack of Public Properties:

The class does not expose its internal fields through properties, making it difficult to retrieve booking details.
Non-Static Utility Method (IsBetween)

The IsBetween() method does not depend on instance state and should be marked as static.
Missing Validation for Constructor Parameters

The constructor does not check for null values for key fields, which could lead to runtime exceptions.
Fixes:
Add public properties for id, dateRange, customer, bookingType, discount, and tax.
Make IsBetween() static since it does not use instance-specific data.
Add null checks in the constructor to enforce data integrity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions