I have a conceptual problem here. When i query my database, i often do so with joins. So a result set row might look like
+------------+--------------+------------+-------+----------+----------+---------+
| CustomerId | CustomerName | MaterialId | Sales | Quantity | Salesman | Manager |
+------------+--------------+------------+-------+----------+----------+---------+
This result contains properties that would appear in certain objects, like Customer
, Material
, Invoice
, and Salesman
. It wouldn’t make sense to put all these properties into any one of the above objects. For example, having a sales
property in an Material
object breaks object cohesion in my opinion. A material’s (in this context it’s a mechanical/plastic part) properties should list its id, its manufacturer, which machine it’s applicable to, etc. To have a sales property is unrelated, because sales only makes sense when you’re talking about a customer.
Another caveat of my data is that I never work with individual invoices, but rather aggregated invoices over some period of time, grouping the invoices by customer and material. So even the keyword Invoice
seems incorrect, because an invoice represents a specific point in time where a sale was made.
My problem is that I would like to have 1 object that has all these properties, but don’t know how to give it an accurate name. What then, should this object be called? Something generic like AggregateInvoice
? How do i accurately represent all these different properties as a noun?
7