Hi Niclas!
On 01.01.2025 04:31,
nic...@hedhman.org wrote:
> On 2024-12-30 22:36, 'Jan' via OpenPnP wrote:
>> Do you think it would be possible to eg. automatically try to load a
>> backup machine.xml in case the current one has issues?
>
> I can't fully answer that, since I have no experience running an actual
> machine (I gave up on my build and bought a Siplace 80 F3).
>
Oh! That's a beast compared to the home-brewed machines most of us use.
How fast is it on average?
>
>> Do you have any other ideas?
> Well, personally, I would choose to move away from XML and go with YAML
> (and probably allow JSON), and break the single file into a smaller
> number of independent files, also to promote modularity, for instance,
> any plugin (say, Z- and C-axes handling) would come with its own default
> configuration in a file that is installed together with a jar file (long
> way to get there).
>
That sounds like a good idea!
> Capable serialization frameworks, such as Jackson, have heaps of
> features on how "extra" and "missing" entries should be handled, and one
> can plug in custom (de)serialization for any type in a quite straight
> forward way.
>
> The downside of such approach is of course the pain of transition and it
> has been expressed many times that such change is unacceptable...
>
Yes, an easy upgrade path is considered mandatory here... Just counted
134 occurrences of "@Deprecated" which indicates to me a big bag of
historic stuff still carried around.
Anyhow, if Jackson could be extended by a custom deserializer, couldn't
we use that to import the machine.xml and later serialize it into
something new? That would break the downgrade path, but that's broken
anyhow with any new attribute/tag added. If Jackson imports a single
machine.xml and writes multiple new files, we'd get closes to the
modularity to talked about. This process could likely be repeated in a
later state to split off more stuff into individual modules. (I remember
you mentioned, that I&S is a problem because it's everywhere.)
> If staying with machine.xml, I would probably look into a process of
> "read old machine.xml, then apply overrides from X" (where X could be
> another file, a database, many source even online). As people do more
> and more overrides, eventually the machine.xml will be irrelevant to
> each individual. For that to work, the tight coupling between actual
> Java types and XML tags need to be broken, and that is a big undertaking.
>
I've implemented that a few times. Works very well and is easy to
maintain. Downside it, that you need a copy of the default data to
compare against to only write changes back.
Something like that has probably been done already: vision, parts,
packages and panels are already separate files, but I'm not sure if they
where ever actually part of machine.xml.
Personally I'd love to see that machine.xml would be split into machine
configuration and run-time data. At present it contains things like
feedcount which generates a new version on every feed action.
> I am first and foremost a professional Java programmer, so perhaps this
> is "doable" from my PoV, but might not be reasonable if you are just an
> enthusiast programmer.
>
That's what I remembered and what made me hope that something would
change... I'm an embedded programmer which by nature tries to avoid
"objects", "inheritance" and any kind of dynamic memory where ever
possible. Even printf() with it's "excessive" stack usage is something I
try to avoid. Anyhow, I made my self comfortable modifying, adjusting
and enhancing the existing code but I'm fare away from being an expert
that could restructure the project. I understand in which direction it
shall go to but I'm not enough of a Java expert to see the language
features that are most promising for that.
Jan