Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use interface for DI, and else.. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antoniodefazio
Copy link

  • .gitignore: added entries for .gitignore file for Eclipse projects to ensure temporary files, build files and project settings are not added to repository commits.
    About x1 project:
  • callerpage.html added to test and call the APIs after run on localhost
  • Constants(class to interface) file needs, to be completed, a private constructor to hide the implicit public one so in general for this use case is better using an interface which fields are all implicitly "public static final", and no impact on callers
  • Previous LockManager contructor seemed ignoring the field permitCount, it was not assigned to instance field permitCount
  • moved the configuration beans from LockManagerApplication to VirtualThreadsConfiguration so if the app is launched with any other profile different from "default" it does not use Virtual Threads so the same app can be used easily to compare performances and differences between platform and Virtual threads
  • to LockManagerController was added the @crossorigin(origins = "*") and the API acquireTest, to permit HTML/Js test
  • LockManagerService became an interface and LockManagerServiceImpl its concrete class, this for many reasons: Abstraction and Decoupling, Flexibility and Switching Implementations, Mocking and Testing, Dependency Inversion Principle, Encourages Single Responsibility Principle, AOP (Aspect-Oriented Programming, Better Collaboration Between Teams, Enhanced Code Readability. By injecting interfaces instead of classes, the design is modular, flexible, and adherent to key software design principles, contributing to a more maintainable and scalable codebase, Reducing the visibility of classes and exposing only necessary interfaces, interface proxy uses Java Proxy Creation so this is supported by the Java platform while concrete class uses an external library for ByteCode which is highly dependent on the version of the Java, the UML Component Diagram are much clearer because they place a lot of emphasis on the concept of interface .
  • Utils class chenged to interface as Utility classes need, to be completed, a private constructor to hide the implicit public one so in general for this use case is better using an interface with static methods. A logger is better than System.out for many reasons and no impact on callers
  • Multistage DockerFile added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant