Skip to content

Refactor: replace isNilNode with polymorphic#43

Merged
jordanmontt merged 1 commit intopharo-containers:mainfrom
HossamSaberr:refactor-nil-pattern
Mar 10, 2026
Merged

Refactor: replace isNilNode with polymorphic#43
jordanmontt merged 1 commit intopharo-containers:mainfrom
HossamSaberr:refactor-nil-pattern

Conversation

@HossamSaberr
Copy link
Contributor

This fixes the Null Object Pattern implementation that we talked about in #40.

Instead of manually checking isNilNode everywhere, the code now relies on proper polymorphism:

  • CTAVLNode >> children: Now filters valid children using isEmpty instead of checking for nil.
  • CTAVLTree >> allChildren: Removed the manual left/right nil checks during BFS.
  • CTAVLNode >> postCopy: Removed isNilNode checks since copy on a nil node safely returns a new nil node anyway.
  • Deleted isNilNode from the node classes entirely since there are no senders left.

All tests are green!
image
Let me know if everything looks good

@jordanmontt
Copy link
Member

Yes, great work!

@jordanmontt jordanmontt merged commit 28d1263 into pharo-containers:main Mar 10, 2026
11 of 15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants