There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton
Naming things seems so trivial, before I read this quote, I would have thought this whole question to be off topic here. However, a well chosen name can make such a huge difference in readability that I consider a thesaurus a basic coding tool. Naming is indeed very important for writing readable code.
The app I'm working with is for selling stuff, e.g. carpets. Although being about carpets, I have no class
Carpet in my code. The reason is that there are several contenders, which all end up being named as
- A controller for a 3D mesh - suffix: Actor
- A UI part - suffix: View
- Product specifications for a type of carpet, e.g. name, cost per m2 etc - suffix: Dbo (for DataBaseObject)
- The apps current selection, including a specific product (the previous point), an amount of products, a total price etc - suffix: CartItem (shortened from ShoppingCartItem)
So I have a CarpetActor, CarpetView, CarpetDbo and CarpetCartItem. It works, but to be honest, "View" is the only one of those I am content with. For this question I want to focus on the last two. Considering how much code has been written for ecommerce, I would expect for some convention for naming these things to exist. However, my searches only turned up marketing centered results.
Are there established conventions for naming the thing that contains all the specifications of a product and the thing that keeps track of product data in the current order?