I am reading a book on WPF (“Programming WPF” by Chris Sells if you want to know), and it says that storing “behavior” and “look” in two different places is a good idea, and this is where XAML files come in. It is a little funny how an idea of having a “graphical resources” file comes on and off with a period of several years
Disclaimer: the history below is limited to the IBM PC/Microsoft planet where I grew up and it ignores such outer space phenomena as X-Window, Mac, or Silicon Graphics.
Old DOS-based graphics systems, of course, did not have resource files. They did not even have windows. If you had to draw pixels, you drew them by hand, calling primitives like “Ellipse” in your code. Anyone remembers egavga.bgi
? 🙂 That was iteration zero.
Then came along Win16 API where dialogs could be built using special resource language. We were told that .rc
files are THE GOOD THING. With resource files came graphical resource editors that allowed to drag-and-drop controls on the dialog surface. They automatically supported multiple languages, and the like. The trouble was, resource files could contain only dialogs, while “normal” windows were still created in code. That was iteration one.
Then came .NET. In .NET all windows became dialogs (or “forms”) that could be edited via graphical editor. The subtle distinction between “dialogs” and “normal windows” was gone. Also gone were the resource files. The .NET team decided that all windows should be created in code, and that the graphical editor should be able to understand and manipulate that code. No special resource language or resource file. I am sure there were very convincing arguments for that decision (not inventing superfluous entities like special resource language probably was one of them). Incidentally, the automatic support for multiple UI languages was gone. You needed to manually load strings from a “satellite assembly” and put them in the UI. This was iteration two.
Now we have WPF and XAML – back to the resource file: iteration three.
So, the pattern is clear – even-numbered iteration don’t have resource files, odd-numbered iterations do. So, if the past is any indication of the future, in a couple of years we will be told that XAML is not cool, has steep learning curve, et cetera, et cetera, and everything should be done in code again, using new shiny language that is so easy to use, that even artists and designers can program in it directly. 🙂