encyclopegia.org

Magic pushbutton

The magic pushbutton is a common anti-pattern in graphical user interfaces. At its core, the anti-pattern consists of a system partitioned into two parts: user interface and business logic, that are coupled through a single point, clicking the "magic pushbutton" or submitting a form of data. As it is a single point interface, this interface becomes over-complicated to implement. The temporal coupling of these units is a major problem: every interaction in the user interface must happen before the pushbutton is pressed, business logic can only be applied after the button was pressed. Cohesion of each unit also tends to be poor: features are bundled together whether they warrant this or not, simply because there is no other structured place in which to put them.

The magic pushbutton is a common anti-pattern in graphical user interfaces. At its core, the anti-pattern consists of a system partitioned into two parts: user interface and business logic, that are coupled through a single point, clicking the "magic pushbutton" or submitting a form of data. As it is a single point interface, this interface becomes over-complicated to implement. The temporal coupling of these units is a major problem: every interaction in the user interface must happen before the pushbutton is pressed, business logic can only be applied after the button was pressed. Cohesion of each unit also tends to be poor: features are bundled together whether they warrant this or not, simply because there is no other structured place in which to put them. procedure TForm1.Button1Click(Sender: TObject); var reg: TRegistry; begin reg := TRegistry.Create; try reg.RootKey := HKey_Current_User; if reg.OpenKey('\Software\MyCompany', true) then begin reg.WriteString('Filename', Edit1.Text); end; finally reg.Free; end; end; A better way to do this is to refactor the business logic (in this example storing the filename to the registry) into a separate class. type TPreferences = class private FFilename: String; procedure SetFilename(const Value: String); public property Filename: String read FFilename write SetFilename; procedure Load; procedure Save; end; and call this class Save method from the Click handler: procedure TForm1.Button1Click(Sender: TObject); begin Preferences.Save; end; procedure TForm1.Edit1Change(Sender: TObject); begin Preferences.Filename := Edit1.Text; end; ==References==

References

No reference rows published for this article.

Cite this article

MLA

"Magic pushbutton." encyclopegia.org, 2024, https://encyclopegia.org/wiki/magic-pushbutton. Accessed 24 November 2026.

Chicago

"Magic pushbutton." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/magic-pushbutton.

APA

encyclopegia.org. (2024). Magic pushbutton. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/magic-pushbutton

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Music of the United Kingdom (1980s)

enwiki · references available

Formica

enwiki · references available

99 Ranch Market

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1211627866 · 0.5 · snapshot enwiki-001211627866

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.