HIT-ReFreSH / JMobileSuit

Light weight Mobile Suit for Java.
MIT License
6 stars 42 forks source link

Dependency Injection #3

Closed FerdinandSu closed 12 months ago

FerdinandSu commented 1 year ago

Hi, I'm the developer of this Program, but I don't have enough time to make my program perfect. I'll appreciate it if you can help me improve it and become a contributor. Here is an existing issue:

This project lacks support for Dependency Injection, please help me add it. 本项目目前缺乏依赖注入支持。

Thanks to the great contributions made by @yrris at #21 , now we have a real Dependency Injection system based on Spring Framework.The next steps are:

  1. Publish release 1.2.0-alpha1, with recent contributors’ name added.
  2. Make refactors to the core components, to sync with MobileSuit and PyMobileSuit. As I’m too busy, this may need quite long. I do wish someone can help me! 感谢来自 @yrris 在 #21 的巨大贡献,我们拥有了基于Spring框架的真正的依赖注入系统,后续会有两件事要做
  3. 把最近新的贡献者名字加进去,然后发布1.2-alpha1
  4. 利用依赖注入重构核心组件,实现和MoblieSuit和PyMobileSuit的同步。因为我本人时间有限,这可能需要花很久。非常希望有人能够加入作为本项目的维护者,帮帮我!
yrris commented 1 year ago

Hello,I want to learn more about the potential need for dependency injection in specific classes. For example, do class like IOServer requires DI? Could you please provide more details on the specific components or classes of the project where dependency injection is needed?

FerdinandSu commented 1 year ago

Hi @yrris

Yes, basic components also needs DI. The SuitClient class and similar types shall be removed, and all dependencies should be injected instead of initialized manually.

MobileSuit has already adapted to DI fully, so you can take a reference at https://github.com/Plastic-Metal/MobileSuit/blob/main/src/SuitHostBuilder.cs line 119.

However, the two projects are now very different, and you may not be able to find suitable counterparts for some types in MobileSuit. At the same time, implementing full dependency injection support can require considerable work.

I think we can start small and only consider basic component injection of the IOServer and the centralized types it depends on, so that you can raise your first PR and complete your homework.

If you need further help, please let me know. However, I’m not familiar with Java, so you may need to refer to the internet for technological support.

Please note that the ownership of this repo has been changed.

FerdinandSu commented 1 year ago

Please don't hesitate to ask me questions; also, leave comments before you start your work to avoid duplicated work.

如果你有任何疑问,欢迎留言询问我;请在开始前在此留言,防止他人进行重复的工作。