1

My goal is speed and immutability of the value. Which is better if I pass the values as a method parameter or put the values in a set method and retrieve it via a get method. Let's say I'm using a factory method. I pass my three values as parameter , now for the rest should I also pass them in the parameter or should I use getter setter methods. Let's say I have 20 users, the end result of the factory method would be selecting thousands of records. Which would be better or is there no difference?

A_H
  • 121
  • 1
  • 6
  • 1
    If you're going to be selecting thousands of records, that's going to be what takes the most time, not some decision between parameters or getters. Use what looks like the best design. – Kayaman Mar 06 '17 at 14:00
  • If you want immutability why would there be a setter? – Andrew S Mar 06 '17 at 14:14
  • I think this below link might help you. http://stackoverflow.com/questions/1568091/why-use-getters-and-setters – Himanshu Shrimali Mar 06 '17 at 14:20

0 Answers0