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

Separate widgets from core framework #10557

Closed
leandrogehlen opened this issue Jan 12, 2016 · 13 comments
Closed

Separate widgets from core framework #10557

leandrogehlen opened this issue Jan 12, 2016 · 13 comments

Comments

@leandrogehlen
Copy link
Contributor

I think necessary to separate, widgets, assets and grid to an extension.
the name can be yii2-widgets.

@tom--
Copy link
Contributor

tom-- commented Jan 15, 2016

So ActiveForm, for example, would not be part of the framework? It would be in an ext?

@SilverFire
Copy link
Member

The rules of separating are not obvious because of coupling.

@klimov-paul
Copy link
Member

Relates #8452

@dynasource
Copy link
Member

it depends on how you look at widgets. Recently, I am starting to see Yii's widgets as something to extend more and more often. From this perspective, I am seeing it as a core functionality. When these Widgets keep on behaving as abstracts, it could still be logical to keep it in core.

With respect to grid, as it is a Widget, I would expect his under widgets. The current location in /root/grid is not intuitive.

@leandrogehlen
Copy link
Contributor Author

@dynasource, there are projects that, don't use view layer provides by yii. (like AngularJS).
Because of this is better separate this part of framewor into another extension

@dynasource
Copy link
Member

well, if thats the criterium, than IMHO all the folders in the Yii root can be put in separate extensions.

But, this would be logical from a fundamental point of view, put not from a optimal point of view. This would mean I have to fill my composer.json with more and more basic Yii functionalities, making my deploys slower and slower.

I definately prefer speed above core-size.

With respect to this, I would redirect this discussion towards the right criterium. What is most important in this matter. I would say the 'mass'. For instance, by using a 80-20 rule. What is used by 80% of all the users, must be put in core. The rest in seperate extensions.

@samdark
Copy link
Member

samdark commented Feb 2, 2016

Deploys won't be slower. If the version is fixed, packages will be loaded from cache.

@leandrogehlen
Copy link
Contributor Author

@samdark 👍

@dynasource
Copy link
Member

if thats the case, I think @leandrogehlen suggestion is practical and detangle wherever possible

@tom--
Copy link
Contributor

tom-- commented Feb 2, 2016

There are a lot of Yii class files my project doesn't need. But I'm not trying to save disk space on my servers by proposing that Yii remove them into separate repos. If I needed to optimize disk space use for some reason, I'd be looking at big things to get rid of or shorten first (Pareto analysis) and not at PHP source code files. And if the time it takes to copy these files to the server is a serious problem for someone, I'd be surprised.

So I don't think Yii-core's overall byte count should be the reason to remove certain files to separate repos.

Additionally "tangle" isn't the right word here. Yii's code is well organized. If you don't want the \widgets or \grid classes, it's easy to delete them in your deployment if you really want to.

Finally, grid is a widget and it is fairly intuitive to find it in \widgets. But for any competent programmer it's trivially easy to find it in \grid. So I don't think the problems caused by its current location justify the BC issues caused by moving it from its current location.

@klimov-paul
Copy link
Member

The problem with the widgets in the core is they have the asset dependencies, which should be loaded by bower/npm. All (or almost all) existing widgets depends on 'jquery', which should be fetched from bower.
Thus, if for example I use AngularJs I will have to install JQuery (which I don't need) just to get Yii core installed.
I suppose it is a noble goal to separate all asset-dependent stuff into a separated repositoy(ies), which can be omitted by will.

@dynasource
Copy link
Member

@tom, Yii is small. Its not necessarily about size. Its about breaking down a software package.

You can benefit from:

  • less code = less hacking risk
  • less code = speed of installation by composer (apart from the caching)
  • less code = less bandwidth (greener for the environment)
  • less code = faster local file transfers (for whatever reason someone can think this is useful)
  • etc etc.

You can argue if one of these arguments is important enough, but overall it would be more logical to separate than to combine, especially in emerging new ways of using Yii (like @leandrogehlen arguments).

About the Grid widgets. Its not about being 'competent' or whatsoever. Its about consistency and convention. When somebody creates his own framework on top of Yii2 (like I did), then you are questioning where to put your GridView overriding. Its a widget. But its not within Widgets. Whatever logic you put into your software, this has to take into account that GridView is an exception. So your software has to be 'competent' also.

@klimov-paul
Copy link
Member

Merged into #8452

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

No branches or pull requests

7 participants