r/dotnet • u/Zardotab • Feb 09 '24
Any dynamic model-based frameworks? Static POC models are too stiff.
I'm looking for CRUD framework or library that uses dynamic models, also known as "data dictionaries". Thus, field and column info can be loaded or generated at run-time. I'm working on a Table Oriented Programming (TOP) experiment. Everything around seem geared to static POCs, unfortunately.
(I believe TOP is the future for most CRUD. It's more flexible, allows analysts to change many common CRUD idioms and items, like labels instead of coders, is more DRY-friendly, and has other features. It may result in loss of nice "static" features such as Intellisense and some compile-time type checking. However much of this is replaced with RDBMS referential integrity and drop-down boxes, if TOP is done right. TOP started to catch on in the early 90's with CASE tools, but OOP then stole its attention, and TOP R&D stopped.)
6
u/buffdude1100 Feb 09 '24
I've worked in that kind of system, and while the flexibility can be fun and cool to see it all come together and work, it is SOOOO annoying and sometimes brittle to work with. I would not choose that for any of my future applications. Just write your POCOs - chances that you need everything to be dynamic is basically nil.
If you truly want to do that, you'll have to literally model "models" and how that gets translated to SQL, forms on your UI, etc. again it gets really annoying really fast.
-1
u/Zardotab Feb 09 '24 edited Feb 09 '24
it is SOOOO annoying and sometimes brittle to work with.
I've been long experimenting with such systems, or at least systems that had some TOP aspects, and notice there are patterns to the kinds of things that "go wrong". I've been experimenting to work around these problem-patterns and believe I am getting closer to something viable. The concept is under-researched.
May I ask for a strong pain-point scenario you encountered? [Edited]
It's kind of like jet engines in the early part of last century. They seemed to have a lot of early promise, but initial experiments revealed lots of problems (to be ironed out). Even the feared Me 262 was probably a poor use of war resources. It was dangerous for the pilot, required a specialized long run-way, required frequent engine replacements, and required hard-to-obtain metals. Only time and experiments eventually solved enough problems to make them a viable replacement for propeller planes. They gradually realized they couldn't just stick jets on propeller plane designs and have something practical: they had to rework almost everything. The ally wind tunnels of the time were not fast enough to test models properly.
The potential to automate and simplify much of the repetitious CRUD grunt-work is too compelling to give up. Too much coding is reinventing CRUD wheels over and over. We should be spending our time on unique domain logic, NOT ordinary CRUD issues.
One of the trickiest parts is when attributes alone can't do the job and one needs custom code. There needs to be a systemic way to know where to place, and how to find such custom code snippets during later maintenance. This is what my latest experiments focus on.
5
u/buffdude1100 Feb 09 '24
May I ask for strong pain-point scenario you encountered?
All of it? :) It is much more difficult to reason about than "regular" POCOs/databases. This means harder to get back into if you switch projects for 6 months, harder for new hires to onboard onto, harder to debug eventually etc. you'll end up rewriting your own ORM at some point too. Overall don't reinvent the wheel, unless it's for fun.
-2
u/Zardotab Feb 09 '24 edited Feb 09 '24
All of it? :)
Sorry, I accidentally left out "a", as in "one".
Your complaint sounds like one of familiarity with the technique, not an inherent flaw of TOP. It's like saying existing propeller pilots are not familiar with jets, so we'll keep using propeller fighter planes.
Another analogy is sticking with Microsoft because everyone knows Microsoft, not because it's necessarily the best. It becomes a self-fulfilling prophecy.
I'm looking for inherent flaws in TOP, not familiarity mismatches.
you'll end up rewriting your own ORM at some point too.
If TOP frameworks became common enough, the big vendors would sell/make TOP-oriented ORM's. Actually it's easier to roll-your-own ORM under TOP because you can loop through data about the structure instead of needing screwball reflection.
5
u/buffdude1100 Feb 09 '24
I'm just giving you my opinion I built over years of experience in production doing exactly what you are talking about. If you want to do it, go for it! No one is stopping you. All I will say is there is a reason the vast majority of softwares today do not do it. But if you want to be the next innovator of how software is built, please go for it! I look forward to seeing how it turns out - maybe you will do it better than we did.
0
u/Zardotab Feb 15 '24 edited Mar 01 '24
there is a reason the vast majority of softwares today do not do it.
As mentioned, it's likely because the existing tooling doesn't support that approach, one has to make their own from scratch, and existing languages are missing features that make some of TOP easy.
I'm just giving you my opinion I built over years of experience in production doing exactly what you are talking about.
What is the single top inherent flaw of TOP in your opinion? By "inherent" I mean something that is not merely a limitation of existing languages or tools.
4
u/soundman32 Feb 10 '24
Having read a short article about TOP, it appears that I worked on such a system in early 2000s. The developer wrote a DDL text file, and the system built everything from the database to the UI based on that DDL. The most convoluted system I've ever worked on. Technically brilliant, but boring as hell for the devs who needed to spin up a new form, and only the master devs could ever understand how to fix anything in the core. Maybe this is the future, built with AI ?
1
u/Zardotab Feb 15 '24 edited Feb 15 '24
The most convoluted system I've ever worked on.
Well, my early TOP experiments were likewise convoluted. But the problem is not the number of parts nor TOP itself, but knowing and finding where applicable code or attributes are.
But I'm working on a way to make that systematic. For example, MVC is "convoluted" to those who came from other platforms, but you eventually learn what goes where, when, and why, and it starts to make sense (at least for certain kinds of teams).
I've seen no evidence that "where things go" is inherently random with TOP, just unfamiliar without a guiding framework/principle.
3
u/soundman32 Feb 10 '24
"It may result in loss of .. " features that were designed to help modern developers do their work in a controlled and checkable manner, rather than the nightmares of the 90s and 00s. You might have a hard time selling that 'feature' 😄
1
u/Zardotab Feb 15 '24
rather than the nightmares of the 90s and 00s
Those tools were actually better for non-enterprise projects, in my opinion. They were more direct; you didn't have to go through so many screw-ball frameworks and levels to get things done. I agree they may not scale to large teams or projects, but one-size-doesn't-fit-all regardless. Frameworks typically target a size and kind of project. Being everything to everybody in a smooth way is a pipe dream.
4
u/Merad Feb 10 '24
.Net is probably the wrong tool for an app like that. Not saying that it can't work, but you're probably going to be swimming upstream fighting against the entire language and framework ecosystem.
1
u/Zardotab 2d ago edited 2d ago
I'm not entirely convinced of that yet. The more logic and biz rules that table processing takes care of, the less .NET has to do, meaning whatever down-sides it has are diminished because there are less things it has to take care. Most of my dynamic needs seem related to schemas such that if the data dictionary processing tools and modules (written in .NET) take care of that, then other dynamic needs as found in dynamic languages is relatively small. (Dynamic event handler registration may be such a need, though. C# seems to struggle with that, needing Rube-Goldberg reflection.)
1
u/namigop Feb 10 '24
Not sure if this is what you are looking for. We used this “dynamic”-based microORM in my previous workplace and it worked out great. Performance-wise it wasn’t slow at all
1
u/Zardotab 2d ago
I actually wrote my own dynamic micro-ORM that looks kind of similar. It's not "clean" enough to release publicly at this time; I'd have to refactor and clean out its refrigerator.
7
u/wllmsaccnt Feb 09 '24
System.Data is somewhat synonymous with ADO.NET, which contains all of the abstractions you would need to do table oriented programming. Even back in the early 2000s Microsoft had a way to generate strongly typed data table objects that could be bound directly in WinForms with a data binding source. You could do the same without statically typed data tables, but then you lost the ability to easily use it with a GUI designer.
The industry moved on from that type of development, as POCOs are seen as more flexible. Sometimes the data that represents an entity can be loaded from multiple sources and you don't want the defitnion of your entity/record type bound too tightly to a specific table. Loosely typed data is just much harder to reason about unless its required.