locked
Complexity of generated XAML for WPF desktop applications RRS feed

  • Question

  • If you could, please, indulge me - asking this question without having spent much time researching Expression Blend - but I am hoping you could easily save me that effort. I am a software developer with emphasis on high-performance, real-time, embedded, low-level, distributed processing, etc., who also has to, eventually, add some user interface on his projects. I have chosen the route of adopting WPF as the UI technology, replacing Windows Forms in a project that replaces another, which used MFC and LabVIEW UI. I like the flexibility of WPF - something very useful, given the complexity of the UI requirements:  highly dynamic, user driven, think LabVIEW, or for those who are not familiar - PowerPoint, but with user-supplied plug-in components.

    My plan is to lay down the UI base design (which involves a lot of custom controls and extensive use of XAML, as opposed to C# code), not worrying about the look, and at one point have a UI specialist make it all nice and pretty. Now, my question is: after someone like that, presumably using Expression Blend, is done with it, how much more complex will the XAML end up being? Because, inevitably, there will be cases when something is not working very well - for example, not quite agreeing with the code model - and I will have to go in and debug it. If I have to then face a forest of unintelligible XAML code, that would be quite disastrous.

    One reason to have such thoughts was my first experience with HTML tools. In the mid-'90s I made some websites using text editors only. This has never been the focus of my work, so at one point I tried to use some tools to update some pages. I tried MS Word (just for kicks) and also Front Page, but what was my surprise when I took my old 50-line page, made a small change, saved it and then looked at the code and saw it was now like 1000 lines of completely unintelligible HTML! This was a personal web page, so it wasn't a big deal (needless to say, my personal website is still quite prehistoric-looking), but I can't have something like that happen with my work. Any thoughts?

    Kamen

     


    Just jumped from VS 2005 SP1 to VS 2010, native C++ and C#, transitioning from 32-bit Windows XP to 64-bit Windows 7; Mountain time zone.
    Thursday, July 14, 2011 6:19 PM

Answers

  • The honest answer is "it depends." If you hire an amateur who's using Blend strictly as a WYSIWYG, you could very well end up with a giant wad of terrible code that will absolutely slow down your project at run time. It won't be nearly as bad as some of the stuff Dreamweaver and FrontPage used to generate, and it shouldn't actually break your project unless the designer switches to code view and starts monkeying around.

    If you hire someone who knows what they're about and has several years of experience, you'll be much better off. Instead of the look and feel living in the window/page/whatever, it will all be designed in resource dictionaries and referenced with a simple Stye="MyStyle" on the page (or not at all if you want the look of a control replaced everywhere). You'll also run faster, jump higher, and always get the girl :)

    Long story short, don't hire a hack. You'll get what you pay for.


    Leon Terry
    Blog | TFK Labs | Twitter
    • Proposed as answer by VLTII Thursday, July 14, 2011 7:06 PM
    • Marked as answer by Kamen Monday, July 18, 2011 9:11 PM
    Thursday, July 14, 2011 7:06 PM

All replies

  • The honest answer is "it depends." If you hire an amateur who's using Blend strictly as a WYSIWYG, you could very well end up with a giant wad of terrible code that will absolutely slow down your project at run time. It won't be nearly as bad as some of the stuff Dreamweaver and FrontPage used to generate, and it shouldn't actually break your project unless the designer switches to code view and starts monkeying around.

    If you hire someone who knows what they're about and has several years of experience, you'll be much better off. Instead of the look and feel living in the window/page/whatever, it will all be designed in resource dictionaries and referenced with a simple Stye="MyStyle" on the page (or not at all if you want the look of a control replaced everywhere). You'll also run faster, jump higher, and always get the girl :)

    Long story short, don't hire a hack. You'll get what you pay for.


    Leon Terry
    Blog | TFK Labs | Twitter
    • Proposed as answer by VLTII Thursday, July 14, 2011 7:06 PM
    • Marked as answer by Kamen Monday, July 18, 2011 9:11 PM
    Thursday, July 14, 2011 7:06 PM
  • Thank you , Leon, your explanations (and recommendations) seem reasonable. I will mark your post as an answer but I'd like to give others a chance to comment on this before it's closed.

    Kamen


    Just jumped from VS 2005 SP1 to VS 2010, native C++ and C#, transitioning from 32-bit Windows XP to 64-bit Windows 7; Mountain time zone.
    Friday, July 15, 2011 3:39 PM
  • I've accepted an answer, assuming many people have seen it and their silence indicates agreement, but I do have one more question: assuming an experienced designer is hired (isn't that a no-brainer?), and the new XAML is neatly tucked in external resource dictionaries, can that XAML be freely edited by hand in Visual Studio, or is there a restriction on that, like if Expression Blend would put some meta-code structures in the XAML that can't be edited manually, or something? As, for example, like it used to be the case with the source.Designer.cs code for Windows Forms (and with the MFC code before that), where code generated by the VS designer could generally not be edited manually without risking to break the ability of the designer to pick it up later on (and, boy, was that VS designer touchy)? Because, if I wanted to make a simple change and I didn't have Expression Blend, could I do that without messing it up? I just wish the VS designer was able to design XAML (including custom control templates) and not have to use external tools, but I guess, there are always trade-offs.

    Kamen

     


    Just jumped from VS 2005 SP1 to VS 2010, native C++ and C#, transitioning from 32-bit Windows XP to 64-bit Windows 7; Mountain time zone.
    Monday, July 18, 2011 9:42 PM
  • Speaking as a designer, you would be surprised at how rare it is for a company to bring one of us on board for a project. Usually we don't get called until it's past due, the customer hates it, and at least 3 devs have tried their hands at design :)

    As for editing, I actually edit quite a bit of XAML in Visual Studio. If you're doing something that isn't visual (eg managing a resource dictionary of images, changing a brush value, etc), it tends to be much quicker because you don't have to deal with Blend trying to render things.

    When you get down to it, XAML is just a fluffed up version of XML and can be edited as such. Notepad can open/edit it just fine, and there are a few other code editors out there that will handle it as well (Kaxaml is probably the best of these).


    Leon Terry
    Blog | TFK Labs | Twitter
    Tuesday, July 19, 2011 2:06 PM