<https://github.com/luser-dr00g/luser-dr00g.github.io>
The code is organized (loosely) around the MVVC design.
A few global variables hold the "Model" data. The output()
function renders this data into HTML structures populated
with event handlers. Any event handler which wants to alter the
model has to call one of the Model's interface functions
which first creates an Undo/Redo record for the change
and then does a Redo (albeit for the first time this time).
So, it's my attempt to do an MVC design
Any critique or other comments welcome, even from Julio.
On Monday, 9 October 2023 at 03:15:41 UTC+2, luserdroog wrote:
<snip>
<https://github.com/luser-dr00g/luser-dr00g.github.io>
The code is organized (loosely) around the MVVC design.Which suggests you are rather lumping model an controller.
A few global variables hold the "Model" data. The output()
function renders this data into HTML structures populated
with event handlers. Any event handler which wants to alter the
model has to call one of the Model's interface functions
which first creates an Undo/Redo record for the change
and then does a Redo (albeit for the first time this time).
But the code is too unstructured to look at (unless you pay
me for a couple of days of re-engineering): 2K+ lines of
lumped HTML+CSS+JS is simply not good enough. I'd
advise you to start by separating things... and while you
are at it, review all naming and code structure.
So, it's my attempt to do an MVC designIt isn't: indeed nobody can understand MVC who has not
actually tried to build a project with explicit model, view
and controller components.
On Sunday, October 8, 2023 at 9:53:58 PM UTC-5, Julio Di Egidio wrote:
Sigh. I suppose you're right. It kind of has these components
"spiritually" but not explicitly.
[...]
The code is viewable from github.
The html/css/javascript is in one file: https://github.com/luser-dr00g/luser-dr00g.github.io/blob/ebe90e12ce13df2ffd96385552f744dc9430d7c7/cm-pc.html
and the separate components: https://github.com/luser-dr00g/luser-dr00g.github.io/blob/ebe90e12ce13df2ffd96385552f744dc9430d7c7/click.js
https://github.com/luser-dr00g/luser-dr00g.github.io/blob/ebe90e12ce13df2ffd96385552f744dc9430d7c7/more.js
https://github.com/luser-dr00g/luser-dr00g.github.io/blob/ebe90e12ce13df2ffd96385552f744dc9430d7c7/tabs.js
zip (whole project, more than these files): https://github.com/luser-dr00g/luser-dr00g.github.io/archive/ebe90e12ce13df2ffd96385552f744dc9430d7c7.zip
The code is organized (loosely) around the MVVC design.
A few global variables hold the "Model" data. The output()
function renders this data into HTML structures populated
with event handlers. Any event handler which wants to alter the
model has to call one of the Model's interface functions
which first creates an Undo/Redo record for the change
and then does a Redo (albeit for the first time this time).
So, it's my attempt to do an MVC design but with all Procedural
Programming. There's barely any OO except for using a class
to make a web component like you have to do. I have a sense
that maybe I've been avoiding OO too much and judicious
sprinkling of it might help.
Any critique or other comments welcome, even from Julio.
Earlier versions of the web components have been
discussed in previous threads started by me.
On Sunday, October 8, 2023 at 8:15:41 PM UTC-5, luserdroog wrote:[snip]
This is a very impressionistic set of suggestions and is a variant of what is referred to as "Clean Architecture" which unifies the "Hexagonal" and "Onion" architectures:
<https://www.plainionist.net/Implementing-Clean-Architecture/>
As a start, and because my bias is typically from the low-level view,
I've tried to carve off a tiny component just to deal with saving and loading user preferences tied to a control like a checkbox.
As a start, and because my bias is typically from the low-level view,
I've tried to carve off a tiny component just to deal with saving and loading user preferences tied to a control like a checkbox.
For the larger task, I'm finding it very difficult to imagine the thing
from a top-down Object Oriented view ignoring concerns about
the representation. But I expect this will become easier after more
reading about these patterns (searching like "repository vanilla js", "usecase presentation vanilla js", etc). Again, thank you. I feel like
I've caught the scent.
On Wednesday, October 18, 2023 at 9:47:49 AM UTC-5, luserdroog wrote:
As a start, and because my bias is typically from the low-level view,Try to think in terms of "what" you're doing instead of "how". What you've presented are implementation details of storage and presentation, but what's the reason for them?
I've tried to carve off a tiny component just to deal with saving and loading user preferences tied to a control like a checkbox.
// usecases
LoadFilters
ApplyFilters
ChangeTheme
LoadTheme
etc.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 04:01:57 |
Calls: | 10,386 |
Calls today: | 1 |
Files: | 14,057 |
Messages: | 6,416,603 |