D
D
Drunya20182020-01-15 20:47:19
Java
Drunya2018, 2020-01-15 20:47:19

Where is the best place to put a Java static method?

If I have class User and App(launch cli app). There is a static function with random user generation. It will be more correct to shove it into the user class or can it be left in the App?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-01-15
@Drunya2018

IMHO, it's more correct to introduce another class, UserFactory, which will do this. I disagree with Sergey, user generation is not behavior.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question