4 ms·
Heh. I feel ya. -- My first real gigs were CAD/CAM based. I really thought both constraint and parametric programming were the future. Finally gave up on con
by specialist 8y ago
Heh. I feel ya.
--
My first real gigs were CAD/CAM based. I really thought both constraint and parametric programming were the future.
Finally gave up on constraints for UI layout. My alternative was to hand code the heuristics, esthetics. I created DesignGridLayout (for Java), based on canonical grids (a graphic design notion). It's now defunct, but if I ever circle back to UI work, that's where I'll resume.
--
That impedance mismatch has tripped me up my entire career.
I forfeited in a different way. I inverted the work flow.
I now use working examples to generate the code.
In the case of databases: instead of an ORM to generate SQL, I use SQL to generate the JDBC/ODBC wrappers.
I can't speak to implementing a query planner (way beyond my intellect), or your notion of starting with a different mental model, but it's food for thought.
- marmaduke 8y ago> SQL to generate the JDBC/ODBC wrapper SQLAlchemy has an ORM but it has a neat feature to exactly this: it can take a DB connection and build ORM objects from the schéma metadata.
- phaedrus 8y agoFor my GUI layout library I decided "snaplines" could be a more fundamental concept than grids (because a grid can be defined with horizontal and vertical snaplines). Essentially it's just a linear constraint like "there exists a variable X_snap1, such that box1.right <= X_snap1 and box2.left >= X_snap1." The key is that if you re-use the same snapline variable for subsequent rows, it aligns a column. Another key idea was that the snaplines are completely independent from the logical (hierarchical, tree) structure of the "document" (aka form). So like if you wanted controls above and below something to be horizontally aligned with each other, but not affect content in the middle, you could do that by just only associating some controls with those snaplines; the fact that the snapline cuts across the middle content need not affect it because it's an abstract "membership" in a group not a physical barrier. How I came to this design was I had done XAML layouts with WPF on Windows, and while I preferred to use the Grid tag to solve most layout problems, I was also frustrated with its limitations: you kind of have to plan ahead, if you discover you need another alignment line you have to renumber things, or maybe you need to fuse certain cells, etc. I realized that I was using the grid to get alignment lines, but didn't (necessarily) want all of the other behaviors which come with it.
- phaedrus 8y agoDefinitely agree about using the SQL to generate the code and not the other way around. For simple cases that's what I now do. For complex cases, I've grown to accept the idea that the translation between in-memory (in-program) representation and in-file representation is an important translation layer and actually should be hand-coded to a moderate extent.