Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Encapsulation and Method Design in Booking Class #63

Open
Mykyta-Panchenko opened this issue Feb 7, 2025 · 0 comments
Open

Comments

@Mykyta-Panchenko
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant