Animal
deferred class ANIMAL
inherit
ANY
redefine
default_create
end
feature
creator: like Current
guts: GUTS
default_create
do
create guts
end
make_malformed
do
default_create
end
end --class
PIG
class PIG
inherit
ANIMAL
redefine
make_malformed
end
create
default_create,
make_malformed,
make_from_insemination
feature
guts: GUTS
make_malformed
do
Precursor
set_left_eye (create {MALFORMED_EYE})
end
make_from_insemination (some_humain: HUMAIN)
do
default_create
creator := some_humain
end
end --class
Into my vision of best practices, I'll say that
- If there is no particular sense of making a creation procedure (like my
make_malformed
example) redefine thedefault_create
- All creation procedure should call
default_create
and add specific behavior (like mymake_from_db
example) - So what is the purpose of many libraries in Eiffel which are adding a
make
likecreate {LINKED_LIST}.make
Correct me if I'm wrong. Thanks in advance!