The device I'm working on, as well as other devices, have bits which can be set, cleared and tested. For this we need three different methods (could be two). The question is on how to name them:
opt. 1: isOwnedByHost (test) beOwnedByHost (set) beOwnedByCard (clear)
opt. 2: ownedByHost (test) etc.
opt. 3: isEndOfPacket (test) beEndOfPacket (set) dontBeEndOfPacket (clear)
opt. 4: isEndOfPacket (test) endOfPacketSet endOfPacketClear
or any mix, or anything else. Right now I have a mixture, like opt1 and opt4. I'm not sure if this is the best thing to do (mix the flavors) or stick to a more strict naming convention and leave the English semantic aside. Remember English is not my native tongue, so I may as well misjudge what's sounds better.
Uses of this would be, for example
receiveRing isOwnedByHost ifTrue: [queue add: (EthernetPacket bytes: receiveRing message)]
transmitRing beEndOfPacket. transmitRing dontBeEndOfPacket
or
transmitRing endOfPacketSet transmitRing endOfPacketClear
thoughts? thanks! gera.
I like option 4 as it matches in my mind what I am picturing the device/method to be doing at the time. Opt 3 is also good as it matches more closely typical Squeak method naming semantics.
Johnathon
----- Original Message ----- From: "Gerardo Richarte" gera@corest.com To: squeaknos@lists.squeakfoundation.org Sent: Thursday, July 13, 2006 2:36 PM Subject: [SqNOS] Another aesthetic question
The device I'm working on, as well as other devices, have bits which can be set, cleared and tested. For this we need three different methods (could be two). The question is on how to name them:
opt. 1: isOwnedByHost (test) beOwnedByHost (set) beOwnedByCard (clear)
opt. 2: ownedByHost (test) etc.
opt. 3: isEndOfPacket (test) beEndOfPacket (set) dontBeEndOfPacket (clear)
opt. 4: isEndOfPacket (test) endOfPacketSet endOfPacketClear
or any mix, or anything else. Right now I have a mixture, like opt1 and opt4. I'm not sure if this is the best thing to do (mix the flavors) or stick to a more strict naming convention and leave the English semantic aside. Remember English is not my native tongue, so I may as well misjudge what's sounds better.
Uses of this would be, for example
receiveRing isOwnedByHost ifTrue: [queue add: (EthernetPacket bytes: receiveRing message)]
transmitRing beEndOfPacket. transmitRing dontBeEndOfPacket
or
transmitRing endOfPacketSet transmitRing endOfPacketClear
thoughts? thanks! gera. _______________________________________________ SqueakNOS mailing list SqueakNOS@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/squeaknos
"Gerardo Richarte" gera@corest.com asks:
The device I'm working on, as well as other devices, have bits which can be set, cleared and tested. For this we need three different methods (could be two). The question is on how to name them:
opt. 1: isOwnedByHost (test) beOwnedByHost (set) beOwnedByCard (clear)
opt. 2: ownedByHost (test) etc.
opt. 3: isEndOfPacket (test) beEndOfPacket (set) dontBeEndOfPacket (clear)
opt. 4: isEndOfPacket (test) endOfPacketSet endOfPacketClear
or any mix, or anything else. Right now I have a mixture, like opt1
and opt4. I'm not sure if this is the best thing to do (mix the flavors) or stick to a more strict naming convention and leave the English semantic aside. Remember English is not my native tongue, so I may as well misjudge what's sounds better.
Uses of this would be, for example receiveRing isOwnedByHost ifTrue: [queue add: (EthernetPacket bytes:
receiveRing message)]
transmitRing beEndOfPacket. transmitRing dontBeEndOfPacket or transmitRing endOfPacketSet transmitRing endOfPacketClear thoughts? thanks! gera.
I like, as you do, #isFoo (#isEndOfPacket) for the test method.
For setting/unsetting, typically I (in Delphi, admittedly) have a property to which I assign a value. Translated into Smalltalk, that gives #isEndOfPacket: aBoolean. An alternative might be #setEndOfPacket/#unsetEndOfPacket.
I had a stroll around Squeak 3.8, and HaloMorph for instance has a #isMagicHalo/#isMagicHalo: aBoolean pair. Several other classes use that pattern, so ja, I'd vote for
isEndOfPacket (test) isEndOfPacket: true (set) isEndOfPacket: false (clear)
frank
squeaknos@lists.squeakfoundation.org