ISISComputingGroup / IBEX

Top level repository for IBEX stories
4 stars 2 forks source link

Refactor IBEXButtonBuilder #8311

Closed zsoltkebel closed 2 months ago

zsoltkebel commented 2 months ago

We explored different strategies, including the use of a factory and a builder pattern inheriting from SWTButton (although this required overriding checkSubclass). Ultimately, we chose a composition approach, where the button is configured using chainable methods. Each method returns the class instance, enabling fluent method chaining. Instead of a .build() method, we implemented a .get() method to retrieve the SWT button directly.

This decision, among others, was discussed for refactoring the IBEXButtonBuilder. Each option was evaluated based on its ability to support method chaining, the number of necessary methods (particularly those returning an SWT button), the simplicity in standardizing the new button class, and the overall code style and clarity.

isaachilly commented 2 months ago

PRs:

To test:

  1. Checkout to ibex_gui branch.
  2. Check code for each button makes logical sense.
  3. Check each button works on the GUI.