The problem is not with naming, the problem is with OOP, specifically inheritance and encapsulation. You could have separate entities for horses, donkeys, mules, zebras and functions that work on them. Maybe less code reuse but state is kept separately, code is very easy to understand, modify and implement. And also is faster to implement. If you have too many ifs in some functions you have to ask yourself if you arc…
Donkey code
21–30 of 64 posts
Re: Donkey code
#22This is why I'm a big fan of "name it Steve" philosophy. When we create a new service many people are inclined to call it something like "rhombus keyboard fibriculator" or "octatonic runner". Usually it's of the form "{verb}er" or "{noun} {verb}er" or "{adj} {noun} {verb}er" or whatever. It's never accurate, and it's super confusing because chances are there is some other "{x} {y} {verb}er" with the same "verb". Not…
I don't think your comparison makes sense. The power of the "name it Steve" philosophy is the same rationale behind adopting codename for projects: it helps create a context to disambiguate discussions. As part of Steve, you work on the Steve web app and on the Steve service. The Steve service later can be refactored to peel out one of Steve's microservices listening to Steve's message broker.
Later if Steve needs to consume data from Pluto, you know that Steve's service will chat with Pluto's service, and perhaps have Steve's message broker listen to some channels in Pluto's message broker, etc etc. Zero ambiguity.
Moreover, monoliths have a propensity to outgrow responsibility-driven names. With a monolith you might start with a widget service, which then handles transactions, inventory, and order history. Once any of those responsibilities is peeled off to a microservice, do you still have a widget service along with a widget inventory service? Is it ok to keep calling widget service the widget service if it only handles widget order history?
Re: Donkey code
#23This is why I'm a big fan of "name it Steve" philosophy. When we create a new service many people are inclined to call it something like "rhombus keyboard fibriculator" or "octatonic runner". Usually it's of the form "{verb}er" or "{noun} {verb}er" or "{adj} {noun} {verb}er" or whatever. It's never accurate, and it's super confusing because chances are there is some other "{x} {y} {verb}er" with the same "verb". Not…
It becomes a problem though when you want to publish open source tools or libraries. These days it becomes very hard to find a name that isn't already attached to a Github repo. Finding a name that is googlable, unique, somewhat intuitive and descriptive is a problem that does not scale at all.
I'm not surprised the NSA ended up generating names for their tools. At least that's what they seem to do judging by names like Eternal Blue, Double Pulsar, Dander Spritz and the like. (https://en.wikipedia.org/wiki/The_Shadow_Brokers#Fifth_leak:...)
Re: Donkey code
#24While I agree with much of the sentiment about clear naming, I think that many languages with OO capabilities fail to provide easy to use role based composition at their peril. It is a big challenge to do wrestle real code and we need all the tools we can get.
Here's how it could look with roles at a coarse grain level:
---
role Breedable { ... }
role Feedable { method eat-carrot { ... } }
role Trainable { ... }
class Horse does Breedable does Feedable does Trainable { has $.sound = 'neigh'; ... }
class Donkey does Breedable does Feedable does Trainable { has $.sound = 'heehaw'; ... }
my $h = Horse.new(); $h.eat-carrot();
---
The benefit of roles is that they let you apply your human language skills (English, French, etc) to combine words as in natural languages - so roles are akin to Adjectives and classes to Nouns, and method names to Verbs.
With roles, you can avoid the temptation to hardwire inheritance:
---
class Donkey is Horse { ... }
---
And it leaves open the option for layers of specialization of roles like this:
---
role DonkeyTrainable does Trainable { ... }
class Donkey does Breedable does Feedable does DonkeyTrainable { ... }
---
And you can use inheritance and role composition side by side:
---
class Beast Breedable does Feedable does Trainable { ... }
class Horse is Beast { ... }
class Donkey is Beast { ... }
---
Here's what it says in the docs: _Roles are a collection of attributes and methods; however, unlike classes, roles are meant for describing only parts of an object's behavior; this is why, in general, roles are intended to be mixed in classes and objects. In general, classes are meant for managing objects and roles are meant for managing behavior and code reuse within objects._
btw these examples are in raku ... https://docs.raku.org/language/objects#Roles
Re: Donkey code
#25This is why I'm a big fan of "name it Steve" philosophy. When we create a new service many people are inclined to call it something like "rhombus keyboard fibriculator" or "octatonic runner". Usually it's of the form "{verb}er" or "{noun} {verb}er" or "{adj} {noun} {verb}er" or whatever. It's never accurate, and it's super confusing because chances are there is some other "{x} {y} {verb}er" with the same "verb". Not…
SEND
HAVE ISOLATED ORGANISM WISH CODING
MESSAGE FROM CENTRAL CODES FOLLOWS
OPENING NEW CATEGORY
CODE FOR YOUR ORGANISM WILL BE ANDROMEDA
CODE WILL READ OUT ANDROMEDA STRAIN
END MESSAGERe: Donkey code
#26This is why I'm a big fan of "name it Steve" philosophy. When we create a new service many people are inclined to call it something like "rhombus keyboard fibriculator" or "octatonic runner". Usually it's of the form "{verb}er" or "{noun} {verb}er" or "{adj} {noun} {verb}er" or whatever. It's never accurate, and it's super confusing because chances are there is some other "{x} {y} {verb}er" with the same "verb". Not…
I think of these kinds of names as being like primary key fields in a database: Their main purpose is to distinguish the identities of various things, so it's better not to incorporate any functional/behavioural description into them because that way there's never a need to change the name in the future if the behaviour changes.
The downside is that the names become arbitrary lumps of data that you have to become familiar with by rote use.
Re: Donkey code
#27This is why I'm a big fan of "name it Steve" philosophy. When we create a new service many people are inclined to call it something like "rhombus keyboard fibriculator" or "octatonic runner". Usually it's of the form "{verb}er" or "{noun} {verb}er" or "{adj} {noun} {verb}er" or whatever. It's never accurate, and it's super confusing because chances are there is some other "{x} {y} {verb}er" with the same "verb". Not…
Re: Donkey code
#28This one's epic. I believe this is a fundamental aspect of OOP. Name different "things" differently!
Re: Donkey code
#29This is why I'm a big fan of "name it Steve" philosophy. When we create a new service many people are inclined to call it something like "rhombus keyboard fibriculator" or "octatonic runner". Usually it's of the form "{verb}er" or "{noun} {verb}er" or "{adj} {noun} {verb}er" or whatever. It's never accurate, and it's super confusing because chances are there is some other "{x} {y} {verb}er" with the same "verb". Not…
In my company we resorted to name many internal tools and libs after birds. It becomes a problem though when you want to publish open source tools or libraries. These days it becomes very hard to find a name that isn't already attached to a Github repo. Finding a name that is googlable, unique, somewhat intuitive and descriptive is a problem that does not scale at all. I'm not surprised the NSA ended up generating na…
https://en.wikipedia.org/wiki/Battle_of_the_Beams#Y-Ger%C3%A...
Re: Donkey code
#30.. there are fertile mules. Rare, but they exist.