If xaml is so easy, why is code so hard?
Charles Petzold has written a couple good posts about the relationship between code and xaml, and asks, "Why is something that is so easy to do in XAML so clumsy to do in code?"
Obviously, WPF code is not always clumsy. But where it is, there's usually three factors at play. The first is that some scenarios we think are more likely to be used from code, and some scenarios we think are more likely to be used in markup, and we tune the API accordingly. Charles uses the example of defining a paragraph of rich text -- we think far more people will do that in markup than in code, so we've spent far more time tuning the markup. Other scenarios are the opposite -- for instance, much of hwnd interop is best done from code because we think more people will want to do this from code than from markup.
The second factor is that we've put more emphasis on getting the functionality & core APIs right than on adding convenience APIs. Convenience APIs are important, but the nice thing about them is that people can still get their job done without them, and we can add them later without breaking anyone. We'll add some between now and when we ship, and we'll add some more after the first version.
Which leads into the third factor -- we're not perfect! So if you see a place where you think we really need more convenience APIs, please let us now so we can make sure we address the ones people hit the most, we really appreciate the feedback!
Comments
- Anonymous
December 09, 2005
The issues I have been having go to learning to code. With every CTP there have been significant changes, even such that code samples between versions that everyone puts out (and there is a new must have one with every CTP), the code won't recompile without a rewrite.
Figuring out what changes are made why etc. seem to take a long time and not all the changes that are mentioned seem to make sense as to why they have changed (into purpituoity).
You have to just about do your own version tracking to get an idea why something changes, etc. It's hard to learn when syntax and everything changes.
I wanted to look for instance at the source to some code called "BackRow", but the final VS came out and now there is a new CTP, but where is the Indigo stuff that was with the previous?? No CTP for that yet?
I wish someone would BOTHER to actually write a coding changes guide to the different CTPs that was updated to each CTP and if some function or feature was changed or removed it would get an example so we'd know how to update or at least tell us syntactically what to do.
Now if someone wrote a tool that would do the updates automatically on code samples based on some sort of translator dictionary file that would help us automagically update samples make the changes for us on code samples and tell us what the differences were, that would be amazing and cool.