Introduction to System.Data.Bindings and Gtk.DataBindings >> |
Introduction into System.Data.Bindings and
Gtk#DataBindings
|
Q&A Personal notes for introduction Q) Why reinventing new data binding stack? A) For more reasons... but let me first tell you one fact... I am completely AGAINST reinventing the wheel, I always try to find FOSS solution before doing that. If I find one, I try to build on it. But FOSS databinding solution pluggable in Gtk simply didn't exist 1)
First and most imporatant reason is the fact I'm listening the same
fraze "FOSS doesn't know how to
invent anything, FOSS just copies" for more than 12 years now,
so I created complete data binding stack which is completely based on
my personal code and design except maybe 300 lines (which were copied
out of other FOSS or provided as they are). Complete project consist
out of 250000 lines
2) The more I watched other data binding frameworks, the more I saw flaws they present with their design. And the fact that they all break the rule no.1 of MVC (code separation for data and form) is no helper either. Main guiding rule for me to create data binding was simply complete abstraction of data. If you follow this book and its examples one thing will be clear. GUI doesn't ever need to be referenced to data. The only common point of their existance is being referenced by dependancies of main assembly. Just as I always code my applications with "being pleasant and easy to use as much as possible" same rule was applied to my databinding code stack, except... user here is developer instead of end user. 3) Every single data binding requires one to study complex book and even more complex class hierarchy. And achieving exact opposite was my design guideline. Beside few methods, few completely basic classes (most of which are just incarnations of classes everyone already knows) and knowing how to write mapping string (which is as simple as one command with few parameters in .Net) there is no strain to coder. All users following my guidelines practically mastered whole thing in 5-10 hours. And since I can't personalize my time to teach everyone... well, this is why this book is being written 4) Has to be highly pluggable... Nicest example is Gtk.DataBindings. Gtk.DataBindings is NOT data binding solution but rather plugin to System.Data.Bindings. Plugin concept enables it to handle everything "Gtk way" and takes out every single strain away from developer. You don't care if you use zillion threads, there is no need for Application.Invoke and more... you don't even care if your thread is blockable or not. You don't care about the fact if you provide same classes to TreeView, SDB simply makes it compatible as much as it can. And list could go on and on Q) Why even write data binding? A) Well, my first MVC kind of data binding solution was written in '94 in freepascal. Even then, I was a real sucker for providing self aware desktop software. That stack never saw the light of the day although I think I could still find it somewhere. Reason why it simply got burried in pile of junk was simple. My love/hate relationship with pascal, I created patch for freepascal which was completely addin preprocessor feature which was only in effect if enabled with conditional directive or automatically if unit started with definitions as specified in preprocessor. Patch enabled interface multiple inheritance, code templating, template classes, inclusion classes, got rid of need for Interface/Implementation and with that enabled same kind of class writing like .Net (code inside class declaration), turn on/off relaxed synthax in the middle of the method, provided per class type and per reference and per property method connectable triggers, type descriptions (something like attributes, but less advanced), even more advanced properties than anything else (.Net only has get and set, with mine one can easily create whole stack of trigger events). The only trouble with my patch was introducing it. It didn't even matter if patch didn't break anything, I still constantly got 2 repeated answers "Borland won't do that" and "This will break"... No one even tried to compile anything ever. Which is kinda sad... I tried every source example I found to be really sure I didn't break anything, even freepascal it self. Everything worked and not even one single thing was broken. Patch only provided additions which were turned off by default... but since god Borland didn't come up with that... no way. No wonder FOSS is not getting more respect. Blindly following commercial solutions without one single try to improve things. So I left "Fellowship of Borland" looking for something which would enable me to do my things and simply avoided coding anything until I find one language which is "has to run equally anywhere, readable, well structured, has everything I need by default". So, finally came .Net, and it was like a god send (ok,... I terribly miss template classes, inclusion classes and my flexible properties with trigger definition, but it is simply near enough). After almost 10 years of zero lines produced, I started coding again and even more... I enjoyed it. So I was again facing decision... Find a free stack which is cross platform and works well. Qt was out of question (commercial), anything else was more or less morbidly supported. Winforms were out of question with less than adequate Linux performance (comparing it to same application on Windows. Running Winforms on Ms.Net or running it with Mono on Linux. Simply incomparable. Don't know the state of it now, it simply falls in "AVOID: blindly following other closed implementation" category). Which led to obvious choice of Gtk-sharp (which I loved even before for its container based approach). Except,... writing self aware software is not really sensible if you don't have data binding and even if it would have I would still probably wanted to work on free stack instead of closed solution which is just tracking original... So... here is your answer. Q) Doesn't Mono fall into "AVOID: blindly following other closed implementation" category? A) No, at least I don't feel like it. Mono and Gtk namespace are not implemented in Ms.Net. Which shows their intentions on doing it them selves in their own way. Beside the fact there is a big difference between CLR and API following. As I said... I waited 10 years for something to pop up which has at least basic features I need ALREADY covered, which means at least those basic features are already present in current CLR Q) Why do you write if ((A == true) || (B == false)) if you could simply write if (A || !B)? A) Simply... I want my conditions to be clear and readable even after I forget why I wrote that (and higher the number of conditions there is, the more unreadable shorthand becomes). I really hate when I need to figure out meaning of condition when people don't even use basic (). This is my personal quirk, but I like it like it is. Ohh,... I got a lot of those;) |
INotifyPropertyChanged, BaseNotifyPropertyChanged
and Notificator >> |