Avoid typep
(if (typep x 'rectangle) …) ; bad
(if (rectangle-p x) …) ; good
(defmethod rectangle-p ((object t)) nil)
(defmethod rectangle-p ((object rectangle)) t)
Resulting code makes it easier to later adapt the code to new classes
Previous slide
Next slide
Back to first slide
View graphic version