[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] Looking for additional reviewers - builder classes for SWT
|
Hi,
Am 23.10.2018 um 10:20 schrieb Andrey Loskutov:
If I would see that code in the review, I would immediately ask to
rework this. It is not maintainable, not debuggable, and the formatter
will re-format the nice indents by the next possible occasion.
I find that a rather unsubstatiated reasoning.
There are many ways in which code can be "not maintainable". I think the
builder pattern's intention is to increase "maintainability" by
increasing the expressiveness of code by making it as compact as
possible, removing any unnecessary "cruft".
Why such code would not be debuggable is not clear to me.
I am aware that auto-formatting can ruin the indentation which is
important for the expressiveness of the code. That seems to be a problem
of the tooling, though.
Best regards,
-Stephan
Am 23.10.2018 um 10:17 schrieb Stephan Aßmus:
Hi,
Am 23.10.2018 um 09:40 schrieb Eric Williams:
We have a patch in gerrit to add support for builder/factory classes
into SWT: https://git.eclipse.org/r/#/c/131348/
Please take a look if you have a moment!
I think the setters should be named set*().
And perhaps it isn't as nice as it could be. There is no way to switch
from one type of builder to another, and to express the layout of the
UI in the code. Something like this would be nice:
void createUI(Composite parent) {
WidgetBuilder.startVGroup(parent)
.startHGroup()
.addLabel()
.setText("Text:")
.end()
.addText()
.setLimit(10)
.end()
.end()
.startHGroup()
.addGlue()
.addButton()
.setText("OK")
.end()
.end()
.end();
}
There are of course numerous alternative ways for the above, of which
the pros and cons can be discussed. But if the end result is the
possibility for such a construct, it would be nice.
Best regards,
-Stephan
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev