|
+5 dev-points for the very nice and succinct example.
Does it get crazy when things get more complicated?
Are there places where you have had extended challenges that make the binding more difficult or where the binding fails?
Just curious.
|
|
|
|
|
raddevus wrote: Does it get crazy when things get more complicated?
Of course.
But I don't think it would be any less crazy if I was trying to manually update the UI.
raddevus wrote: Are there places where you have had extended challenges that make the binding more difficult or where the binding fails?
Very rarely. But you can always fall back to writing code in the code-behind if absolutely necessary.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The problem with data binding is that you think you can bind to any public property, but that's not true. Some are read-only of course, but many don't implement the event firing mechanism that says "I've changed". Doing that requires discipline on the part of the developer. At some point, the developer will say, "WTF, I have a hundred properties for this UI control, and I'm supposed to write a "PropertyChanged" setter call for each one?"
What Microsoft should do is create a special PropertyWithChangeEvent syntactical sugar that creates the call for you.
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Marc Clifton wrote: Doing that requires discipline on the part of the developer.
well, we know that is an unreasonable expectation. The best devs are lazy. I hope to be as good as Wally (Dilbert) some day.
|
|
|
|
|
Marc Clifton wrote: WTF, I have a hundred properties for this UI control, and I'm supposed to write a "PropertyChanged" setter call for each one
Your kidding right, I have not coded one of them in years, that is what snippets are for. Even for automatic properties there is a snippet.
OPC tab tab type name and I'm done! And yeah I will do that a 100 times if required but then I'm definitely annaly retentive about it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
raddevus wrote: I've found this to be true on Win Forms I happen to like it on WinForms.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: I happen to like it on WinForms
Well, I'm trying to be controversial.
I will continue that here.
I've found it to be quite buggy. I think that problem where if you set the datasource and displayname and displayvalue in the wrong order then your form crashes.
Also, I do have some droplist controls that are bound to data that comes back from sql queries and they get filled, but it is not a very elegant solution. but I guess it works.
The last thing though is...it's winforms. WinForms are dead. These controls were last updated in Win95 (maybe WinNT 4) Stop developing them.
I'm just joking around, but I'm kind of serious too.
Plus, I'm just saying that databinding hasn't been solved anywhere (except maybe Angular -- two-way binding is very smooth) very nicely.
I'm sure I've convinced you now that databinding is garbage and you'll join the movement, right?
|
|
|
|
|
raddevus wrote: I've found it to be quite buggy. I think that problem where if you set the datasource and displayname and displayvalue in the wrong order then your form crashes. I have that with ADO. Put the ExecuteNonQuery before the addition of the parameters, and it won't even crash.
raddevus wrote: The last thing though is...it's winforms. WinForms are dead. These controls were last updated in Win95 (maybe WinNT 4) Stop developing them. It's not dead where I'm standing; WPF is not available on Linux, and there's no other rich GUI to equal it. The common controls have been updated in every version of Windows, which is why the common controls do not show the big fat bevel we had in Win3.0.
raddevus wrote: I'm just joking around, but I'm kind of serious too. Lots of people came with expressions that X is dead and being seriously jokers.
raddevus wrote: I'm sure I've convinced you now that databinding is garbage and you'll join the movement, right? Except in WinForms and Angular. Which are the only places that matter
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I've been using data binding on web forms for a dozen years or so. Works perfectly fine for me.
So no, I won't join your movement. I wouldn't join any club that would accept me as a member.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
I upvoted you, because if you're talking about ASP.NET MVC you are right.
Model binding does work quite well.
If you're not talking about that, let me know and I will mark your message as spam.
|
|
|
|
|
Do I lose points if I'm talking about web forms, not MVC?
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
TNCaver wrote: Do I lose points if I'm talking about web forms, not MVC?
Yes, in that case, you lose major points.
Better just keep it quiet.
|
|
|
|
|
Buggy? Not at all. I'm sure it's a feature, whatever you may have seen.
Like a checkbox not being bound when you initialy have set Visible to false and not being able to bind the same flag in the data to visible to make the checkbox reappear for old datarows that have this checkmark set. I'm sure this behavior has some useful purpose, even if I can't really say which.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Works well enough in Xaml!
|
|
|
|
|
I've used it with WinForms, Knockout.js, AngularJS, and Vue.js.
It works fine most of the time.
Sure beats having to do everything manually!
Maybe you're the problem?
|
|
|
|
|
Sander Rossel wrote: I've used it
Sander Rossel wrote: It works fine
Yes, yes, for the cookie cutter basics of amateur code it does seem to work fine. I agree.
It's the professional code that is a bit more than copy/paste that I'm talking about.
Maybe you haven't experienced any of that?
Am I funny yet?
|
|
|
|
|
raddevus wrote: Am I funny yet? "Sad" is the word you're looking for...
Seriously though, data binding isn't some magic bullet that solves all your problems, but it's a lot better, in WinForms and HTML, to have your input data being synced with your back-end "automagically" rather than having to do it all by hand.
And yes, there are rules, and in some edge cases you're better off not data binding at all.
If used wrong your application can turn into a binding mess that forces your application to a grinding halt.
But once you've got it down it's really not that difficult and it can really save you a lot of time and effort.
Especially in the easy forms it's a must-have.
|
|
|
|
|
Sander Rossel wrote: Seriously though, data binding isn't some magic bullet that solves all your problems
Oh, but it is sold that way by every framework.
Sander Rossel wrote: but it's a lot better, in WinForms
And that's not saying much. But it's just kind'a ugly.
Sander Rossel wrote: And yes, there are rules, and in some edge cases you're better off not data binding at all.
That's a very good point and actually one I was attempting to point out that most of the frameworks and training related to binding does not point out. They generally pass the knowledge like it is a panacea.
Sander Rossel wrote: But once you've got it down it's really not that difficult and it can really save you a lot of time and effort.
I do agree with that. I just wished it worked a bit better and was implemented a bit better in most places.
Maybe I got spoiled from the way two-way binding works so well in Angular?? Probably.
|
|
|
|
|
|
I knew there was somebody out there!! I knew it!!!
My real point is that every (so many) framework acts like databinding works perfectly, but then it doesn't.
|
|
|
|
|
My problem with Angular is that I don't know why they call it Angular since it is something entirely different and how long it will last until the next ground-breaking roll out. Emphasis on breaking.
modified 20-Oct-19 21:02pm.
|
|
|
|
|
Yeah, we were getting very close to doing angular when it was at rev 1.x or 2.x or whatever. Then they had that "4.x Will Change Everything" announcement and we left it behind.
|
|
|
|
|
We have today discovered that there are three well-known bit positions within any binary value:
LSB - Least Significant Bit
MSB - Most Significant Bit
RSB - Random Sh<nobr>it Bit
Software Zen: delete this;
|
|
|
|
|
My eyes are playing tricks on me! I read that last one as Random Shift Bit! Now it makes sense!
"Go forth into the source" - Neal Morse
|
|
|
|
|
kmoorevs wrote: Random Shift Bit That one works too at times.
Software Zen: delete this;
|
|
|
|