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

Introduce Null Object pattern #714

Open
TheAssassin opened this issue Mar 8, 2024 · 1 comment
Open

Introduce Null Object pattern #714

TheAssassin opened this issue Mar 8, 2024 · 1 comment

Comments

@TheAssassin
Copy link
Contributor

There are various locations within the code where a == null check is needed. For instance, when querying the bed width or originBottomLeft properties, default values need to be used if no device has been selected most of the time.

The Null Object pattern fills such attributes with sensible "default" values. For instance, a null LaserDevice might have a bed width of 600mm, a bed height of 300mm and a top left origin. This would replace the many duplicate default values scattered across the whole code base.

There might be other use cases as well. I'll first add it to LaserDevice in preparation for my work on #713.

@TheAssassin
Copy link
Contributor Author

I've worked with the codebase for a few days now and given the number of occurrences and the less-than-ideal interface design (many interfaces are quite bloated), I've come to the conclusion that this pattern won't solve any actual problems, at least for now. Some refactoring is required beforehand, namely reorganizing LaserDevice and LaserCutter and related classes. I'll continue with the existing codebase for now, #713 is a bigger priority.

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