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

Review our approach to MVVM #5225

Closed
Reinmar opened this issue May 17, 2016 · 5 comments · Fixed by ckeditor/ckeditor5-ui#41
Closed

Review our approach to MVVM #5225

Reinmar opened this issue May 17, 2016 · 5 comments · Fixed by ckeditor/ckeditor5-ui#41
Assignees
Labels
package:ui type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented May 17, 2016

Currently, we've implemented MVC or MV(C)VM, depending on a component. There's been ongoing discussion between us on which approach is better and we couldn't make a final decision, so the code isn't very consistent at the moment.

We need to verify which pattern better fit into our lib. So far we think that MV(C)VM will do best, however, we need to improve the initialisation of such components.

Currently, there's an issue with how view model can be created by a controller (and then passed to view), while controller should also be given its view in its constructor. This means initialisation like this:

const model = new Model();
const controller = new Controller( model );
const view = new View( controller.viewModel );

controller.view = view;

This is obviously ugly. Fortunately, we seem to agree that since view model is very tightly bound to the view, it can be instantiated by that view, to be later retrieved and controlled by the controller:

const model = new Model();
const view = new View(); // it creates view.model
const controller = new Controller( model, view ); // controller reads view.model
@Reinmar
Copy link
Member Author

Reinmar commented May 17, 2016

One of the things that needs to be fixed is: ckeditor/ckeditor5-ui-default#11 (comment)

@Reinmar
Copy link
Member Author

Reinmar commented May 19, 2016

One of the things that would need to be standardized is where we keep docs for the model and view model interfaces. View models can be documented inside views I guess and model perhaps inside controllers.

@Reinmar
Copy link
Member Author

Reinmar commented May 24, 2016

@Reinmar
Copy link
Member Author

Reinmar commented May 30, 2016

While refactoring pieces of this code I noticed that many models lack documentation. This needs to be fixed as part of this ticket.

@Reinmar
Copy link
Member Author

Reinmar commented Jun 1, 2016

Related issue ckeditor/ckeditor5-ui-default#13.

@oleq oleq self-assigned this Jun 22, 2016
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-ui Oct 9, 2019
@mlewand mlewand added this to the v0.1.0 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:improvement This issue reports a possible enhancement of an existing feature. package:ui labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:ui type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants