php-kitchen / yii2-domain

DDD for Yii2 [In active development - early alpha]
MIT License
35 stars 6 forks source link

Can I use this library in my project? #6

Closed Veitor closed 6 years ago

Veitor commented 7 years ago

hello. My project now is difficult to maintain and develop, so i want to find solution that can change this. I recently found DDD is suitable for me, so i decide to try it in my project with DDD pattern

I also found your notice in README.md, is it means not recommend use this library?

prowwid commented 7 years ago

Hello @Veitor,

First of all, do you have an existing project with a large code-base developed on Yii2? Or you planning to start a new project?

If you want to start a new big project then do not use this library and go to Symfony Framework or even change the language to a more suited one (Like Groovy with GRails framework or Kotlin). The only goal of this library is to help poor people who choose Yii2 for their application and then realize that it's not suited for enterprise development and for large, complex code bases.

I'm developing large projects on Yii and Yii2 and use this library to make things a bit better. You can join Discord chat to discuss any questions you have. I can consult you if I would understand what kind of situation you are in.

Right now Yii2 Domain doesn't have a stable version so if you would choose to use Yii2 Domain you would need to keep in mind that there would be several releases that can break backward compatibility and change concepts before the first stable version.

With best regards, Dmitry

Veitor commented 7 years ago

My old project was quite large, it developed on Yii1 and has just MVC layer what i think is not enough. Maybe i decide to refactor it with Yii2.

Thaks for your answer my doubt. I would learn more about software design

prowwid commented 7 years ago

Hello @Veitor ,

I understand the situation you are in. I had projects with the same problem you have right now.

First of all, you can inject Yii2 directly into your Yii 1 application. I've done it several times and it's not a complicated task to run two frameworks together, but still would be better to have two entry points:

  1. for old code that doesn't use Yii2
  2. for pure Yii2 code and for code with mixed Yii2 and Yii1

First and the most important advise - start refactoring from controllers. If you would upgrade all of the controllers to Yii2, you would be able to implement new features using all Yii2 features and old actions still would be able to use Yii2 models and services. Yet, I don't know how your app looks like so this advice might not be really accurate. But for my use-cases starting from controllers would have saved a lot of time as models were a lot more complicated.

And if you would integrate Yii2 to your project, you would be able to use this library with old models(with several changes in the base ActiveRecord class) - I've done this too.

And if you are interested in software design articles and books, here are some good ones: https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html https://www.entropywins.wtf/blog/2016/11/24/implementing-the-clean-architecture/ https://msdn.microsoft.com/en-us/library/ee658090.aspx?f=255&MSPPError=-2147217396 https://code.tutsplus.com/tutorials/3-key-software-principles-you-must-understand--net-25161 https://www.codeproject.com/Articles/768052/Golden-Rules-Of-Good-OOP https://qafoo.com/blog/098_extract_method.html https://ocramius.github.io/blog/on-aggregates-and-external-context-interactions/ http://fabien.potencier.org/symfony4-monolith-vs-micro.html https://www.madetech.com/blog/hierarchical-model-view-controller-pattern

Books: https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=sr_1_1?s=books&ie=UTF8&qid=1508145594&sr=1-1&keywords=domain+driven+design+eric+evans

If you would have more questions, please join Discord sever - GitHub isn't suited for chatting.

With best regards, Dmitry