Reconciliation, diffing algorithm and functional approach to Model-View-Controller pattern
- Date: Sun, 14 Jan 2018 18:55:05 +0100
- From: Amirouche Boubekki <amirouche@xxxxxxxxxxxxx>
- Subject: Reconciliation, diffing algorithm and functional approach to Model-View-Controller pattern
td;dr: What do you think of ReactJS (native)? How can this be applied to
First, I'd like to thank you as whole for what you've done as a
for your very existence and making possible what I am today. You sparked
in me the passion of programming and the idea that together we write
software when it's free software. Sadly, I never got into programming in
C. Our roads have forked 10 years ago, because and thanks to you, to
into Python language which was a tremendous enabler for me. Also, I see
don't feel comfortable with static typing and manual memory management.
Even if today, I know better, I know GNU Guile Scheme.
Guile is a lisp functional language with OOP library called GOOPS
that is dynamically typed and mostly rocks, see https://gnu.org/s/guile.
That being said, I am not here to promote Guile in any way or ask people
to write GNOME apps using Guile.
I'd like to discuss Graphical User Interface programming.
Nowdays GUIs are mostly written using the web stack
Among the various frameworks for doing GUIs in this stack, there is
a constant that is the use of virtual DOM and diff + patch algorithms
also known as reconciliation . Please do not flee, I will mention
AFAIK it takes in roots in windows 3.1 API and was made popular
recently by ReactJS view library.
Last year, while trying to figure out what all this stuff was about
I created bindings of snabbdom  in scheme to experiment with it.
I implemented a prototype framework for doing web apps in scheme.
You can find a demo at  see also a small introduction at .
Simply said, my prototype framework takes its ideas from Redux
state management  library and somewhat Elm .
I tried to simplify the design of Redux + ReactJS without loosing its
benefits. The main benefits are:
- Declarative API for the rendering part (somewhat like glade)
- Predictable state
- Truly single way data flow (no two-way bindings or other magic, events
always have to go through a controller, generate a new state).
Also, I removed the action creator and dispatcher to make the MVC
much more obvious.
Using scheme is makes things much simpler because scheme expressions can
easily describe html (or xml) through sxml syntax . So there is no
need for a preprocessor like babel for JSX and the magic resides in
basic things like quote, quasiquote and unquote (and sometime
Immutable datastructures are first class in scheme, so there is no need
for things like immutablejs.
Also, there is no need to learn OOP, it only use functions aka.
It relies on lexical scoping and a closure (and a function returning a
returning a function). Those are details.
Basically, I think it lowers the bar to get started to do frontends.
For various reasons, I am considering building a desktop application in
But I don't like the OOP approach and I really find the declarative
approach of ReactJS and in particular I think forward.scm is a very
As GTK+ and desktop application developpers, what do you think of
the approach taken by ReactJS + Redux and forward.scm to do GUI
Did anyone experiment porting those ideas (diff+patch / reconciliation
to do desktop development?
Thanks for reading!
Amirouche ~ amz3 ~ http://www.hyperdev.fr
gtk-list mailing list