A tool for creating a GUI (WinForms or WPF) from a class

Say we have a class like

public class Doer { public int Timeout {get;set;} public string DoIt(string input) { string toReturn; // Do something that involves a Timeout return toReturn; } } 

Is there a tool that would create Form or Control to prototype this class? The GUI can have a NumericUpDown element labeled โ€œTimeoutโ€ and a GroupBox with a TextBox for โ€œinputโ€ and a button labeled โ€œDoItโ€ with an event handler that calls Doer.DoIt with the Text property of the input text block and puts the response in another TextBox.

GUI with a NumericUpDown control with a label of "Timeout" and a GroupBox with a TextBox for "input" and a button labeled "DoIt" with an eventhandler that calls Doer.DoIt with the Text property of the input TextBox and puts the response in another TextBox.

+4
source share
2 answers

Looks like Nudes are a good way to explore. ( Hanselminutes podcast .)

Briefly :

The pattern of bare objects is determined according to three principles:

  • All business logic must be encapsulated on domain objects. This principle is not unique to bare objects: it is just a strong commitment to encapsulation.
  • The user interface should be a direct representation of the domain of objects with all user actions consisting, explicitly, in creating or retrieving domain objects and / or calling methods for these objects. This principle is also not unique to bare objects: it is just a specific interpretation of an object-oriented user interface (OOUI). The original idea in the pattern of naked objects arises from a combination of these two to form the third principle:
  • The user interface must be created 100% automatically from the definition of domain objects. This can be done using several technologies, including source code generation; Today, the implementation of the model of naked objects favors reflection technology. First there was a nude pattern formally described in Richard Pawson's book Candidate dissertation 1 , which includes a thorough study of various antecedents and inspirations for including, for example, the Morphic user interface. Bare objects are usually contrasted with a model-view-controller. However, the published version of Pawson's Thesis (see References) contains a preface by Trygwe Reenskaug, who first formulated the model-view-controller, assuming that the nudity is closer to the original model-view-controller than many of the subsequent interpretations and implementations.
0
source

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


All Articles