Question: I have multiple service classes `ServiceTest1`, `ServiceTest2`, `SeviceTest3`

I have a factory class `UserFactory`, which creates a new `User` instance on every request

UserFactory has a method `createUser()` which gets called for every request

Currently, `createUser` looks something like this

```
public User createUser(){

   return new User(new ServiceTest1(), new ServiceTest2(), new SeviceTest3());
}

```

1. These `Service` classes are stateless though, so I want to avoid creating a new instance on every request,
2. There might be more `Sevice` classes in future, I want to avoid cluttering the constructor with too many parameters

What would be the good practice to fix this?

Is it good if I let these `Service` classes be singleton classes? and have a new class named `ServiceFactory`, which provides these singleton services

and then, I can just place the ServiceFactory instance in the constructor `new User(ServiceFactoy.getInstance())`

Answer: 
`Option`s [can be compared directly](https://doc.rust-lang.org/std/option/enum.Option.html#impl-Eq), so you can [simply return `a == b`](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=993156749b137711b81e7256a2538ba4).
Actually, if `T: PartialEq`, `Option<T>: PartialEq` and if `T: Eq`, `Option<T>: Eq`. See this example ([Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=53daa36619dbdf5fe977c91dbf894b42)):

```rust
fn main() {
    assert_eq!(Some(3), Some(3));
    assert_ne!(Some(3), None);
    assert_eq!(None, None);
    assert_ne!(Some(3), Some(4));
}

```