Improbable Icon

Naming Trends & Habits

general

#1

Hi there!

I’m interested in hearing what other devs are naming their components, commands, events, etc… in their SpatialOS projects and in general. Do you have guidelines? Strict Naming Standards? Names you use just because it sounds cool?

I’ll start with commands. egg.

type TravelRequest {}

type TravelResponse {}

component Transform {
id = 3000;

command TravelRequest travel_requested returns TravelResponse;
}

I always name the command something_requested because the command receiver will be, for example OnTravelRequested, which in my opinion sounds good. It’s a detail I know…


#2

I prefer to use the naming conventions from the Domain Driven Design principles and event sourcing. So that means to me that I try to name my commands as close as possible to the business language as I can and use the Active Simple Perfect tense. For events I use the Active Simple Past Tense; using these two tenses makes it clear when and how the actions should take place.

Frequently I try to make my commands also reflect how the arguments are used.

So, to take your example (as far as I understand it; I don’t quite get what you mean by travel_requested):

type TravelToRequest {}

type TravelToResponse {}

component Transform {
   id = 3000;
   command TravelToRequest travel_to returns TravelToResponse;
}

#3

Yes! I can see why sticking to business terms instead of technical ones can improve readability.

Very interesting thanks for sharing!