ActionScript: Constructor for Value Object classes
-
31-10-2019 - |
题
Is it OK to use the constructor to set properties for a value object class or must I use dot notation and set each one, one-by-one?
I recently read an article that was saying I should do it one-by-one as value objects should only contain properties and went on to say using the constructor is not OK (best-practice wise).
Code:
("not OK")
var employee=new Employee(firstName,lastName,age);
("OK")
var employee=new Employee();
employee.firstName=firstName;
employee.lastName=lastName;
employee.age=age;
What's your take on this?
Thank you.
没有正确的解决方案
不隶属于 StackOverflow