News for hackers. Stuff that matters.
Re:Digital Audio Workstation Front End Development Struggles by zerr on Tuesday May 16, 2023 @03:36AM (#35958739)
Declarative UI, even when implemented coherently within the same langauge like in Flutter and MAUI/Xamarin, so there is no need for an ugly bridge between two worlds, still leads to an unreadable nested hell.

Surprisingly, an imperative GUI creation code is much more easier to read and modify.

Re:Digital Audio Workstation Front End Development Struggles by mort96 on Tuesday May 16, 2023 @04:04AM (#35958897)
Hmm? I've written a fair bit of React, which I assume fits the declarative description, and I never got the impression that it leads to an "unreadable nested hell". You split up your big functions into smaller reusable functions, just like in all other forms of programming.
Re:Digital Audio Workstation Front End Development Struggles by akdor1154 on Tuesday May 16, 2023 @07:16AM (#35960202)
By the traditions of desktop ui, React is imperative: it's written in a declarative style, but ultimately jsx is just JavaScript.

The best analogue to "declarative" in desktop ui terms would be to have your dom templates in separate files that you don't manipulate the structure of in code.

I honestly have an overall negative view of react, but its method for letting you declare ui structure is really fantastic.

Re:Digital Audio Workstation Front End Development Struggles by ogoffart on Tuesday May 16, 2023 @04:34AM (#35959068)
I respectfully disagree. In my experience, Declarative UI is more concise, making development and changes easier. It enhances productivity and allows for a clear separation of concerns, which is beneficial.

Moreover, Declarative UI enables the development of powerful tooling and visual editors. For instance, in Slint, we have an extension that provides live UI preview and code transformation capabilities. We are also actively working on a visual editor that lets users drag and drop widgets. Such capabilities are difficult or impossible to achieve with imperative APIs.

Re:Digital Audio Workstation Front End Development Struggles by pkphilip on Tuesday May 16, 2023 @12:10PM (#35963862)
Have you looked at tools such as Delphi, Lazarus etc and the approach used to build GUI components which can be added at build time or at runtime?

If you are interested in talking about this, do let me know.

Re:Digital Audio Workstation Front End Development Struggles by lelanthran on Tuesday May 16, 2023 @02:20PM (#35965662)
> We are also actively working on a visual editor that lets users drag and drop widgets. Such capabilities are difficult or impossible to achieve with imperative APIs

I don't think you have ever used an imperative API, have you?

I used VB, then Delphi, then C++ builder and now use Lazarus, and there's no declarative equivalent that is easier or faster than those.

Re:Digital Audio Workstation Front End Development Struggles by ogoffart on Wednesday May 17, 2023 @03:58AM (#35972443)
In the examples you mentioned, the UI is typically described in XML or form files (.dfm), which is essentially a declarative approach, and clearly not described in imperative code. Although they may not be intended to be edited by hand, the underlying representation is still declarative in nature.
Re:Digital Audio Workstation Front End Development Struggles by lelanthran on Wednesday May 17, 2023 @04:28AM (#35972611)
Agreed, but they were easily achieved with imperative APIs.

This is the statement I was contending:

> We are also actively working on a visual editor that lets users drag and drop widgets. Such capabilities are difficult or impossible to achieve with imperative APIs

Maybe I should have said "there's no declarative-only equivalents that's easier or faster".

As someone else pointed out elsethread, declarative is a subset of imperative, so it's easy to produce an imperative API that consumes machine-generated declarations, but not so easy to use a declarative-only framework to reproduce the ease and speed of Delphi, Lazarus, etc.

Re:Digital Audio Workstation Front End Development Struggles by pkphilip on Tuesday May 16, 2023 @12:08PM (#35963847)
Absolutely. I actually prefer a combination of declarative + imperative code similar to how it is in Delphi/Lazarus.

The overall layout of the GUI is designed using a GUI designer and this gets saved as a "form" in a resource file which is loaded at run time and so the actual code does not have a lot of declaration of the GUI but it is read in as a stream from a separate resource file.

However, to this GUI, you can add event handlers, add or remove components at run time etc. All of this is quite clumsily done (IMHO) in frameworks such as flutter.