Is this MVC? What "design template" did I use?

There is a lot of confusion compared to MVC, but after you scroll through the book “Head First patterns” (as a side note, I hate this brand, although this example was not bad), it claims that MVC or Model View Controller is a hybrid several patterns - intermediary, observer, etc.

In a recent prototype, I did the following, it is C #, but should be simple.

Person : IPerson {
    public Name { get; set;}
    public Age  { get; set;}
}

IPerson is just an interface defining the above - I left it for simplicity.

PersonController : IPersonController {
    public event DetailsUpdated;
    public void SetAge(int age);
    public int GetAge();
    public void SetName(string name);
    public string GetName();
}

I know that the foregoing may be property - but this is just a simple example. An event is fired every time some data changes - for example, in SetAge / SetName.

interface IView {
    void Initialize();
    void SetAgeClicked(object sender, EventArgs e);
    void SetNameClicked(object sender, EventArgs e);
}

- . . SetAge/SetName - , / .. .

Form : IView {

    // IView is implemented.
    // Form is wired up
    // Initialize is set etc...
}

, MVC - , - - , . , MVC? - ?

/ . - , .

.

+3
3

, MVP (Model-View-Presenter), MVC. MVP... . , , , MVP, WebForms. MVP WebForms :

http://haacked.com/archive/2006/08/09/ASP.NETSupervisingControllerModelViewPresenterFromSchematicToUnitTestsToCode.aspx

Windows Forms.

+2

- .

, , , MVC.

. ?

+2

MVC , Microsoft, . Scott Gutherie, . MVP, Controller Presenter, - .

+1
source

Source: https://habr.com/ru/post/1709109/


All Articles