Penguins can't fly.

78 views
Skip to first unread message

Brother Bill

unread,
Jun 7, 2024, 7:39:26 PMJun 7
to Eiffel Users
Created a toy program where BIRD has a name, can speak and fly.
Other than manually raising an exception, is there a way to have PENGUIN not be able to fly, either at compile-time or run-time.
penguins_cant_fly.zip

Ian Joyner

unread,
Jun 7, 2024, 8:52:57 PMJun 7
to Eiffel Users
If fly in BIRD is deferred
Define fly in PENGUIN
To do nothuin'
Since PENGUIN can’t fly
I must fly now goodbye!

On 8 Jun 2024, at 09:39, Brother Bill <brother...@gmail.com> wrote:

Created a toy program where BIRD has a name, can speak and fly.
Other than manually raising an exception, is there a way to have PENGUIN not be able to fly, either at compile-time or run-time.

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/3b871ec3-b0ba-4e9c-89d2-8deadbd539fan%40googlegroups.com.
<penguins_cant_fly.zip>

rfo amalasoft.com

unread,
Jun 7, 2024, 9:58:39 PMJun 7
to eiffel...@googlegroups.com
Or define bird as more generic, and have it parent flightless_bird and flighting_bird, with the species inheriting the proper ancestor a la Linnaeus (vs Linus).  Either way works, but the ability to fly is also not unique to birds, so ....  Eiffel's super power is its ability to support, and implement a model that applies well to the problem.  A model of convenience is sometimes good enough, a model with some legs enables future models with minimal reinvention
R

From: eiffel...@googlegroups.com <eiffel...@googlegroups.com> on behalf of Ian Joyner <joyne...@gmail.com>
Sent: Friday, June 7, 2024 8:52 PM
To: Eiffel Users <eiffel...@googlegroups.com>
Subject: Re: [eiffel-users] Penguins can't fly.
 

Ulrich Windl

unread,
Jun 8, 2024, 2:26:50 AMJun 8
to eiffel...@googlegroups.com
Hi!

The actual problem is that your BIRD is wrong if a PENGUIN is a bird.
Maybe has_wings (being constantly true) would be the better property. Also the can_speak seems problematic to me. That shows the essence of the problem IMHO: If you start with poor modeling, you'll run into problems sooner or later. While developing you'd typically adjust the model to fix the problems.

Ulrich

08.06.2024 02:39:25 Brother Bill <brother...@gmail.com>:

> Created a toy program where BIRD has a name, can speak and fly.
> Other than manually raising an exception, is there a way to have PENGUIN not be able to fly, either at compile-time or run-time.
>
> --
> You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/3b871ec3-b0ba-4e9c-89d2-8deadbd539fan%40googlegroups.com[https://groups.google.com/d/msgid/eiffel-users/3b871ec3-b0ba-4e9c-89d2-8deadbd539fan%40googlegroups.com?utm_medium=email&utm_source=footer].

Ian Joyner

unread,
Jun 8, 2024, 3:44:03 AMJun 8
to Eiffel Users
Well, the Queen Mary in Long Beach California does not sail. Does that mean it is not a ship?

People have two legs.

But someone who has stepped on a land mine, might be without one or both legs. Does that mean they are not human?

Often these kinds of things need defining in the context of the current problem.

Ian
> To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/b0c4bdce-31a7-4d15-9b4f-4f37feebb559%40gmail.com.

Bertrand Meyer

unread,
Jun 8, 2024, 8:12:38 AMJun 8
to eiffel...@googlegroups.com, me...@inf.ethz.ch

Procedure fly in BIRD has a precondition is_flight_enabled, using a boolean-valued function with result True (if flight should be enabled by default – design decision that can be made one way or the other – can also be deferred to avoid taking a stand, then each class is responsible for its own choice).

 

In PENGUIN, redefine or effect that function so that it returns False.

 

With best regards,

 

-- Bertrand Meyer

Latest book: Handbook of Requirements and Business Analysis, Springer, 2022

A treatise and textbook on requirements, see https://se.ethz.ch/requirements

 

From: eiffel...@googlegroups.com <eiffel...@googlegroups.com> On Behalf Of Brother Bill
Sent: Saturday, 8 June, 2024 1:39
To: Eiffel Users <eiffel...@googlegroups.com>

--

You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.

Ulrich Windl

unread,
Jun 8, 2024, 8:55:16 AMJun 8
to eiffel...@googlegroups.com
Yes, defining a BIRD out of the context of an ANIMAL makes little sense unless knowing more of the details.

08.06.2024 10:43:56 Ian Joyner <joyne...@gmail.com>:

>

Ian Joyner

unread,
Jun 8, 2024, 9:52:49 AMJun 8
to Eiffel Users
Right! Some ANIMALs (BIRDs and BATs) can fly. But class ANIMAL should have nothing that suggests that. The absence of anything just means it is not precluded.

But for BIRD, most can fly, but some have lost that ability.

Ian

> On 8 Jun 2024, at 22:55, Ulrich Windl <u202...@gmail.com> wrote:
>
> Yes, defining a BIRD out of the context of an ANIMAL makes little sense unless knowing more of the details.
>
> 08.06.2024 10:43:56 Ian Joyner <joyne...@gmail.com>:
>
>>
>
> --
> You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/b5678968-217f-4ac4-a2e7-685720df0f53%40gmail.com.

Brother Bill

unread,
Jun 8, 2024, 4:17:46 PMJun 8
to Eiffel Users
Thanks all for these great responses!

Ian Joyner

unread,
Jun 8, 2024, 9:04:56 PMJun 8
to Eiffel Users
Great. Some more thoughts. This is a little circular.

As I said, the absence of a capability in parent classes does not mean a subclass can’t do something. The decision of whether something can or can’t is deferred (but not in the explicitly declared sense as deferred feature).

But then when fly is introduced in BIRD as deferred features, a further subclass PENGUIN can implement fly as can’t fly. And DODO can’t fly for several reasons — like it can’t get out of the glass display at the Natural History Museum (while there go next door to the Science Museum to see Babbage's Difference Engine which was built on the inspiration of Alan Bromley, but it can’t fly out of the glass case either).

Ian

wolandscat

unread,
Jun 9, 2024, 5:27:06 PMJun 9
to eiffel...@googlegroups.com

For the potential amusement of some, an ontology-oriented discussion of this exact problem.

Alejandro Garcia

unread,
Jun 10, 2024, 12:38:16 PMJun 10
to Eiffel Users
I think this "ontology approach to software analysis and design"... has merits. Do you have other reading material I can look at?

Thank you.

Davide Grandi

unread,
Jun 10, 2024, 1:02:55 PMJun 10
to eiffel...@googlegroups.com

Just a moment: penguins CAN fly.
But they fly underwater.
I've just remembered a documentary about South Pole.
And what I've seen is NOT "swimming": it's really "flying" underwater.

    Davide

On 09/06/2024 23:26, wolandscat wrote:

For the potential amusement of some, an ontology-oriented discussion of this exact problem.

On 08/06/2024 00:26, Ulrich Windl wrote:
Hi!

The actual problem is that your BIRD is wrong if a PENGUIN is a bird.
Maybe has_wings (being constantly true) would be the better property. Also the can_speak seems problematic to me. That shows the essence of the problem IMHO: If you start with poor modeling, you'll run into problems sooner or later. While developing you'd typically adjust the model to fix the problems.

Ulrich

08.06.2024 02:39:25 Brother Bill <brother...@gmail.com>:

Created a toy program where BIRD has a name, can speak and fly.
Other than manually raising an exception, is there a way to have PENGUIN not be able to fly, either at compile-time or run-time.

-- 


-- 
ing. Davide Grandi
linkedin : http://linkedin.com/in/davidegrandi

wolandscat

unread,
Jun 10, 2024, 9:23:31 PMJun 10
to eiffel...@googlegroups.com

You may find the book 'Basic Formal Ontology' instructive. It's about ontology building not information modelling. I have known the main author (Prof Barry Smith) for many years, and his way of thinking completely changed mine (and made me realise that almost the entire canon of 'information modelling' is in worse darkness than Plato's cave.)

https://www.amazon.com/Building-Ontologies-Basic-Formal-Ontology/dp/0262527812

thomas

Ulrich Windl

unread,
Jun 11, 2024, 3:58:38 AMJun 11
to 'Davide Grandi' via Eiffel Users
So submarines do fly also?

--

Kind regards,
Ulrich Windl

10.06.2024 20:02:50 'Davide Grandi' via Eiffel Users <eiffel...@googlegroups.com>:

> Just a moment: penguins CAN fly.
> But they fly underwater.
> I've just remembered a documentary about South Pole.
> And what I've seen is NOT "swimming": it's really "flying" underwater.
>
>     Davide
>
> On 09/06/2024 23:26, wolandscat wrote:
>>
>> For the potential amusement of some, an ontology-oriented discussion of this exact problem[https://wolandscat.net/2011/05/24/ontologies-and-information-models-a-uniting-principle/].
>>
>> On 08/06/2024 00:26, Ulrich Windl wrote:
>>> Hi!
>>>
>>> The actual problem is that your BIRD is wrong if a PENGUIN is a bird.
>>> Maybe has_wings (being constantly true) would be the better property. Also the can_speak seems problematic to me. That shows the essence of the problem IMHO: If you start with poor modeling, you'll run into problems sooner or later. While developing you'd typically adjust the model to fix the problems.
>>>
>>> Ulrich
>>>
>>> 08.06.2024 02:39:25 Brother Bill <brother...@gmail.com>:
>>>
>>>> Created a toy program where BIRD has a name, can speak and fly.
>>>> Other than manually raising an exception, is there a way to have PENGUIN not be able to fly, either at compile-time or run-time.
>>>>
>>>> --
>>>>
>>>>
> --
> ing. Davide Grandi
> linkedin : http://linkedin.com/in/davidegrandi
>
> --
> You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/b64c766a-72d1-43b8-93d1-42e8215fb9a2%40email.it[https://groups.google.com/d/msgid/eiffel-users/b64c766a-72d1-43b8-93d1-42e8215fb9a2%40email.it?utm_medium=email&utm_source=footer].

javier...@gmail.com

unread,
Jun 11, 2024, 9:10:12 AMJun 11
to Eiffel Users

Davide Grandi

unread,
Jun 11, 2024, 9:44:57 AMJun 11
to eiffel...@googlegroups.com
... veeery slowly, like a Zeppelin, maybe, not like underwater swifts
like penguins do ...

On 11/06/2024 09:58, Ulrich Windl wrote:
> So submarines do fly also?
>
--

Ian Joyner

unread,
Jun 11, 2024, 9:51:32 AMJun 11
to Eiffel Users
That’s nice to know, that I can fly because I can swim!
I swim, therefore I fly.
Or maybe that calls into question I think therefore I am?
Or I sink, therefore I swim?

Ian

Davide Grandi

unread,
Jun 11, 2024, 10:03:35 AMJun 11
to eiffel...@googlegroups.com

At zero g, weightless, flying should be like swimming.
Asimov, maybe, wrote something about it.

    Davide

Ian Joyner

unread,
Jun 11, 2024, 7:53:15 PMJun 11
to Eiffel Users
It begs the question, what do we mean by swimming, what do we mean by flying or by freefall? How are they related? That philosophical consideration is built into our software. Software and computing is philosophy! (Many C and C++ people are upset by that thought, but they don’t understand abstraction either.)

Ian

Ulrich Windl

unread,
Jun 12, 2024, 2:24:09 AMJun 12
to eiffel...@googlegroups.com
Wouldn't the UNIX virtual filesystem be a counter-example (for C people having no idea what abstraction is)?

Ian Joyner

unread,
Jun 12, 2024, 5:07:31 AMJun 12
to Eiffel Users
They might use it, but many still say they don’t believe in abstraction. So they don’t know what they are talking about.

> On 12 Jun 2024, at 16:24, Ulrich Windl <u202...@gmail.com> wrote:
>
> Wouldn't the UNIX virtual filesystem be a counter-example (for C people having no idea what abstraction is)?
>
> --
> You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/a07b0fa2-f668-4053-8763-33c98a83dd73%40gmail.com.

Reply all
Reply to author
Forward
0 new messages