DEV Community

Discussion on: Code Smell 109 - Automatic Properties

 
mcsee profile image
Maxi Contieri

Hi

Thank you for advice
Your "correct" solutions has a getter which is another code smell, IMHO

So. I will stick to mine until I find a better one (without getters)

And records are yet another code smell

I think the problem is you care too much on the (accidental) data. I chose to care on (essential) behavior

But it is just my opinion

Thread Thread
 
jayjeckel profile image
Jay Jeckel

No, I care about behavior. The point is that a class with only private variables doesn't support any behavior.

Your "correct" solutions has a getter which is another code smell, IMHO

You're welcome to your opinion, but I categorically disagree with it. The smell would be having an object that doesn't allow you to retrieve data you put into it.

And records are yet another code smell

I'm not sure how to respond to that. Using a language feature that standardizes a way to enforce immutability and the handling of immutable objects is not a smell.

Thread Thread
 
mcsee profile image
Maxi Contieri

I think the problem is that Person protocol is incomplete. I will change that to clarify.
More behavior, no getters

I don't think they should be different kind of objects. Those with behavior and those for data transportation.

I honor the bijection. One Person in real world one person class