A factory is an implementation of a factory pattern . This is a way to create objects.
A service is a class that manages the problems of a particular aspect of your application. For example, if the application runs on People objects, you may have some kind of PersonService to manage all problems when creating, editing, deleting, etc. Several services can be used by other services to achieve goals that affect more than one area of ββyour application. For example, if a Person can be added to Company , PersonService and CompanyService can work together to perform the necessary operations. There will usually be another service, such as YourAppService , which coordinates the two services. When you do this, it is called "Facade . "
A utility class is a class that contains operations common to your application. For example, let's say you need to use some regular expressions throughout the application. You may have a TextUtil that works with Strings and nowhere else. In Java projects, I usually create the TestUtil class, which has methods for creating objects that I will use in unit tests (the test itself is also checked). You can consider this use case as an implementation of a factory pattern.
Some people think that if you have utility classes that you use in your application, this is a sign of poor design.
source share