Roslyn
Wed, Apr 18 2012 9:43

I believe project Roslyn is a watershed moment. It will start a complete redefinition of what programming and being a computer programmer means.

But why? How could rewriting the Visual Basic and C# compilers be even a blip in the history of computer programming? At best it’s a sneeze!

Show me a computer program. Right now. Really. At least think through how you would show me.

OK, you just opened up an instance of Visual Studio and showed me Solution Explorer graph of a whole bunch of files. Text.

A small minority of you might have used a different approach –showing me functional tests, a user interface, a database or a dependency graph. An even smaller minority might have shown me a UML diagram, DSL, or other code generation metadata. Six or seven of you might have even opened a decompilation tool or showed me some IL. Two or three of you might have discussed semantics. One of you, just maybe, opened a workflow designer (ah, the sad story of Workflow is for another day).

The line between these realities has been stark. You’re writing code or your ditzing around with the tools that support you writing code. Text. Text. Text.

A computer program has always been all of these things and something else. Something ethereal that existed between your ears and my ears. As programs have become more complex, we become increasingly desperate to live in the ecosystem of our application instead of in the code. That’s what agile was all about. Agile makes our application into an ecosystem of players. So does DSL. But in both cases we’re blind and playing with only parts of the elephant.

Wait, code matters. Of course code matters! It is one expression of abstraction along the pipeline from idea to electrons moving in silicon. Code is the last thing that normal humans will comprehend. It becomes IL that a platform specific compiler understands, and then some magic happens. That end works. With apologies for the analogy, we know how to take the elephants output and fertilize the garden. The apps work. We just feed the elephants badly because we do not understand them.

Oh, just forget that analogy, it was gross anyway.

What we need to understand is that no one today understands what an application is. We can’t. We can’t because the way we reason about anything is predetermined by the wiring of how we sense it. To understand what applications are in new ways, we need new ways to sense them, redefine what they are and place them in rich ecosystems with no rigid boundaries of definition between problem and solution. It’s easiest to visualize as no rigid boundaries between text and graphics, but that will feel like a very shallow distinction within five years.

While no one understands what an application is today, no one can stop us coming to a new understanding and a new relationship in the next five years. Roslyn is not birthing in a vacuum. We have relatively mature ecosystems in DSL and functional languages. We have an emerging (about to be exploding) work happening in composition and semantics. We have ongoing research in algorithms. We have a lot of work in the areas of agile, quality, reasoning/diagraming, requirements, human interfaces, etc. We are ready.

Roslyn, for us in the .NET world, is the snowball tossed to start the avalanche of change. It will do this because it will lead us to think of our code as a semantic tree. Such a tiny, tiny thing. And then we’ll have the most amazing array of IDE tools, and then new DSL/generation tools, and then amazing new composition reasoning, and then…, and then… , and then… , and then… , and then… Each will lead us to new thinking about the next and around the tenth or hundredth “and then” it will be obvious how seismic the shift.

by Kathleen | 3 comment(s)
Filed under:
Here’s what’s right with Windows 8
Fri, Mar 16 2012 14:22

Summary: Windows 8 is a massive gamble for Microsoft, and right now I can see the potential for it to be one of the most successful operating system releases ever.

A friend of mine pointed me to this article by Adrian Kingsley-Hughes. He points out some issues about Windows 8 and comes to the summary: “Windows 8 is a massive gamble for Microsoft, and right now I can see the potential for it to fail harder than Windows Vista did.”

He’s right. It might fail massively. Vista was poorly executed and a forced undesired changes that annoyed a lot of people. It was forced at one point, which made people angry. People hated Vista. If Windows 8 is poorly executed, people won’t get the paradigm shift, they might hate it and it might fail.  If they are moronic enough to stop Windows 7 sales, they will probably make people angry.

But, assuming the final Windows 8 is well executed, I think it has the potential to be a massive success. Looking first at Adrian’s points:

"No method to make the Classic desktop the default"

Ok, Microsoft has not overcome its hubris. I’d love it if Microsoft simply offered the classic desktop as an option.  Point goes against  Windows 8.

"Metro doesn’t work for everything"

Of course Metro doesn’t work for everything. It shouldn’t.  As an application developer I’m looking closely at what apps should embrace Metro, what apps should shift to application specific chrome in HTML 5 browser apps, and what apps should stay in the classic desktop. It would be silly to think there is a single answer for all applications.  I have seen positively amazing Metro apps that may change the way you think about information.  I’ve also complained loudly about some Metro-like changes to the Visual Studio developer environment that still makes sense in classic Windows style. Windows 8 allows applications to live in the world that suits them best. Point goes to irrelevant.

"No apparent Kinect support"

Kudos to Adrian for seeing how important Kinect is in the long haul! I think it’s safe to see this as a figment of the fact we’re looking at a consumer preview. Exactly when Kinect support releases for Win 8 is unclear, but I’m not at all worried about its inclusion. Point goes to Win 8 because having Kinect support will be very cool.

"Inefficiencies everywhere"

Inefficiency and resulting discomfort is the heart of question with Win 8. But there are also improved efficiencies. It’s very fast to type part of an application name and there are scenarios where Win 8 is faster. Hopefully the consumer preview will let Microsoft tune these scenarios. Windows 8 is well executed if it is stable and has more efficiency gains than losses.  This is going to be one of two points that will decide the game.

"Live tiles may not be that live"

And they may be super live. Tiles are far more integrated at a software and a user experience level than gadgets.  Applications will be competing hard for the first page of your Metro start menu. They will have to add value to be there. The biggest different between gadgets and tiles is that applications important to you will be searching for value to add to their tiles. Applications will truly care about displaying information when they are not “open” and expect to see very cool stuff. Everyone will have a “dashboard” into their world. Point goes to Win 8.

And to look at other points I think are important regarding Win 8 success

Application development support

An operating system is like the theater, lighting, sound, and air conditioning system for a theatrical production. If it’s wrong, your experience will suck and you won’t suggest the play itself to your friends. Win 8 appears to be a good theater. This lays the groundwork for you to immerse yourself in the play itself – for you to interact with your applications on a richer level. This is why consumers have embraced smart phones – they allow fundamentally richer and more intimate applicatoin interactions. Microsoft has done a good, although imperfect, job of empowering developers with an exciting round of improved tools and technology access. The next phase is to get new thinking and new techniques embraced by a broad swath of developers so there are awesome Win 8 applications on the tablet, and Metro justifying tiles on the desktop.  This is the second point that will decide the game.

Tablet

What I’m not so sure of is Win 8’s success on the tablet. How many people want a full powered laptop replacement tablet with a short battery life? How many want a lower power long battery life inexpensive ARM based tablet? How well will Windows 8 on ARM tablets be executed and what apps will be available for it? How will the security model integrate with existing enterprise security models for that market? What do consumers ultimately want in this market sector? How well will the hardware vendors deliver? What will the pricing/bundling/carrier story for data plans be? There are boatloads of outstanding questions that will affect Win 8 success in the tablet market.

Final thougts

I agree with a lot of what Adrian said. I really felt that it was only part of the story. The gamble is not between ho-hum and a huge loss. It’s a gamble between a big win and a big loss from Microsoft’s perspective. This is anything but a ho-hum release. From the consumer perspective there’s not much of a gamble – you’ve got an awesome operating system in Win 7. With luck, Microsoft will carry this into a well-executed final release of Windows 8 that builds on the consumer preview and shaves off some of the previews warts. If not, wait for them to get it right in Win 9.

by Kathleen | 4 comment(s)
Filed under:
My girls built Lego furniture for their Barbie dolls
Sat, Mar 3 2012 13:16

The Women in Technology luncheon at the MVP summit included a discussion of gifts we give to girls.

During the conversation, Deborah Kurata said to me “my girls used Legos to build furniture for their Barbie dolls.”

Gifts are the opportunity to put into the hands of little women the things we want to have in their hands. It is easy to fall into giving them the gift they want and ask for. But those choices are heavily influenced by a feedback cycle that markets dolls to girls and building sets to boys, causing children to desire toys in these patterns, causing people to buy these kinds of gifts, causing these kinds of toys to be comfortable, causing next year’s marketing to be more effective.

There’s nothing wrong with giving a Barbie doll to a young girl, except that she probably as three of them.

Legos have undergone some annoying changes. I’ve been told that they now have sets marketed to girls. First, it’s an offensive notion that girls don’t want to build good stuff and like it better if it’s pink. Then in some bizarre twist, the pink sets are simpler. That’s dumb.

If they sell true building sets, at some point you have enough Legos. If they sell 3-D jigsaw puzzles, there’s an unending supply of movie branding to sell new Lego sets. This might help wire some spatial rendering in the brain, but it doesn’t spark much creativity. If you give any child Legos, sit down with them and ask “what else do you want to build?”

I’m not claiming that boys and girls on average are the same. Girls tend to more interest in human relationships. Play is always social and children intertwine different kinds of play where they practice different kinds of skills. And more girls are attuned to aesthetics – more easily drawn to pretty things and away from ugly things. If Legos are blocky, there are a lot of other kinds of spatial play.

I hope every child has a few dolls because fantasy play is a wonderful kind of play. Dolls aimed at boys could be hero focused (GI Joe, sports figures, etc.) if that makes it more interesting or comfortable for the particular boy. But I also hope every child has a wide variety of toys including card games, building sets, toys they make themselves, fantasy toys, computer games, and “educational” toys like microscopes. This year when you’re giving gifts to the little ones in your life, consider taking a risk, stepping outside the marketing driven box, and giving a kind of gift they don’t have much of.

by Kathleen | with no comments
Filed under:
Solution References, Dependency Inversion and Controlling Builds
Tue, Feb 28 2012 16:48

Here’s a trick for your medium to large Visual Studio projects. In Tools/Options/Projects, Solutions/Build, Run there’s an option “Only build startup projects and dependencies on Run.” If you check this, it will do what you expect when you hit F5 – Visual Studio will only build the startup project and any direct dependencies. This is an individual machine setting, not a project setting.

But what if you are using dependency injection though MEF or an Inversion of Control container? In these scenarios, the main application probably references only a common assembly(ies) that have interface declarations. Implementations are in other assemblies that are not directly referenced. So, does that mean that if you use dependency injection on any project you can’t use the build limitation on any other solution?

Enter Solution/Project Dependencies! You might not have heard of this feature because it’s very well hidden in Visual Studio. I have heard these referred to as Solution References because the option appears on the Solution right click. “Project Dependencies…” have nothing to do with usual project references. This is a new kind of dependency indicator which is used for the minimal build. Creating this dependency does not create a project reference.

In case the Solution References dialog doesn’t seem intuitive, you select the project you want to work with in the combo box (A). This displays a series of check boxes for other projects in the solution (B).

clip_image001

A normal project entry is:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Earth", "Earth\Earth.vbproj", "{8BFC7D54-B621-4E23-9CA9-101DDF9DFC79}"

EndProject

If you have a dependency, this entry looks something like:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HelloPlanet", "HelloPlanet\HelloPlanet.vbproj", "{D2CF0625-0549-49B4-99D5-C4CCC6068814}"

ProjectSection(ProjectDependencies) = postProject

{8BFC7D54-B621-4E23-9CA9-101DDF9DFC79} = {8BFC7D54-B621-4E23-9CA9-101DDF9DFC79}

EndProjectSection

EndProject

Now, your dependency will be built along with any referenced projects!

by Kathleen | with no comments
Nothing good to say since July, Kathleen? Really?
Sun, Feb 19 2012 11:47

Nothing good to say since July, Kathleen? Really?”

That’s part of a comment Jerry Nixon left on my blog. I need to get off my butt and give some explanation for my silence.

Life got in the way, then a break to figure out what I’m doing next.

Last July I took a job at Digital Folio. Startups are dynamic environments and this time the wind shifted such that my responsibilities were much different than I expected. This was not altogether bad. I really enjoyed leading a group and I was working with amazing folks. But it wasn’t what I wanted to do so I left just before the first of the year. Since I was also supporting a long term client, I was working two jobs, maintaining a speaking schedule, and committed to working out and taking better care of myself. I often felt I didn’t have time to breath.

But that changed in late December. It’s nearly March. Where did those two months go?

I’ve made a significant lifestyle change. I’ve given up having a home. Home-free is probably a better phrase than homeless, because I am embracing this by choice and it’s the culmination of a process that started two years ago. I sorted everything I owned to store, donate or keep with me. And then I went through the “keep with” stuff twice more the same way. Everything I now own is either in storage or fits in my car. And no, it’s not a van but my lovely 37 mpg Hyundai Veloster.

I suppose there is a blog post inside me somewhere on what I’ve learned about stuff, but I don’t think that processing is done.

I’ve always wanted to drive US 64 from end to end. I used to drive bits and pieces of it and thought they were the most beautiful pieces of highway. I wanted to keep going, so I did - well, at least half of it. The other half is scheduled for late June if all goes well. We’ve lost so much of the gracious old highways. It was nice to travel what is left of this one before the 4 lane expressways and semi-expressways eat all of it. My mother thinks I am silly and nostalgic (her home state Tennessee had done the most damage to US 64) because she says everyone other than me just wants to get where they are going. US 64 is probably a blog post too.

And where does a home-free person stay? Friends, family, house-sitting, hotels, monthly rentals, camping – although I’m waiting for summer for the camping part. At least that’s what I think will happen. I’ve only been at this for a little while and I may quickly grow weary of it. My theory is that there are things I can bring that are different for everyone that will have people look forward to me coming back. I hope so.

It does mean I’m available for on-site coaching and possibly other work. That’s a different blog post, but I want mid-term part time engagements where I can watch a team grow and help them meet technical, team and personal goals without disrupting ongoing projects or becoming dependent on my presence.

My tentative plans for the mid-term are to be in Colorado most of March, on the East Coast and traveling from there to Seattle in April, in Seattle during May, and spending June back in Colorado to see family, kayak and backpack. Next events are Wintergrass (Bellevue), the MVP Summit and DevConnections March 26-30. I’m speaking at the Northern Colorado .NET User Group March 12, Vermont .NET in Burlington April 9th, Great Lakes .NET User Group in Southfield, Michigan April 18th. I’m also trying to get in touch with the user group in Fargo, ND or in Illinois to see if I can set up a talk when I drive through April 23-26.

In addition to mentoring, I have an exciting project that I hope to be able to talk about next week and a boatload of blog posts in process on work my son and I have been doing looking for common themes between the many, many flavors of composition.

 

by Kathleen | with no comments
Filed under: ,
Women Should Go to Tech Conferences
Mon, Jul 25 2011 17:13

Am I naïve in hoping this will be just one of a hundred blog responses to Susannah Breslin’s blog post Why Women Shouldn’t Go to Tech Conferences?

I think women should go to tech conferences for reasons that are precisely the same as why I think guys should go to them. There’s a lot of information in sessions and on the show floor, great networking, and an amazing amount of cool discussions about topics you’d probably miss otherwise. Oh and did I mention they are a lot of fun?

I think a lot of value in tech conferences is reaching out; getting to know people that you might not otherwise meet. It’s rare that I don’t learn something in every three to five minute conversation. Maybe it’s a perspective, maybe it’s a question, but most often I’ve met someone that knows a lot more about something than I do. I’ve only done one conference I hated. It was a video conference where I flew to sit in a room alone without even an online audience. Blech!! I think I go to conferences for hugs and handshakes and mostly conversations. Well, hopefully to also teach people some stuff because I’m a speaker.

I think going to a conference is a slightly different experience for a woman, even though I think the goals and outcomes are the same. It’s harder for women to walk up to strangers and start a conversation. It’s also harder for people that are shy, uncertain of their English, non-white, handicapped, non-gender standard, from a different culture, tired, distracted by a crises back in the office, or ill.

The easy thing is to gravitate toward people that are like you – the same technical field, the same vertical or the same gender/race/age/whatever. Don’t get stuck only in that. Sure it’s great to find someone that understands some super geeky things coming in a product you care about, but you’ll eventually find out about that stuff through normal channels.

What you can’t do easily without going to a conference is to get outside those channels and outside your normal thinking with higher, more detailed, orthogonal, or completely unrelated views. And in the breadth of people at a big tech conference there are people everywhere from the cutting edge to legacy technology. That’s the magic of tech conferences.

It’s harder for women because if you don’t have your badge on and you walk up to a guy you saw in a session and introduce yourself, he might first wonder what’s going on. It’s just not in our habits to walk up to strange people and say “wow, that was an awesome talk, it made me think about…” Just do it (regardless of your gender).

Almost every person in this industry is fantastic and respectful (at least when they are sober) and they’ll probably be happy you started a conversation. If not, well try someone else. Wear your badge if you want to be associated with the conference – you can turn around the nametag in public. Talk to people before and after sessions. Talk to people in the hallway. Talk to people at lunch. Be smart, be safe, but reach out and you are almost certain to get more out of the conference.

Which, yes, of course, you should go to.

Personal News!
Mon, Jul 18 2011 16:15

I decided to wait until I was actually sitting at my new desk before writing to say that, well I have a new desk.

After 22 years independent I’ve got a real job. Naturally I would not have taken this job if I wasn’t lucky enough to have been offered a job even more fantastic than the jobs I could think up for myself.

I’ve joined Digital Folio. It’s a fantastic group of people using cutting edge technology to solve real world problems to make shopping easier and a lot more fun. As Technical Evangelist, my job includes new technology – including Azure and Windows Phone (of course with some Silverlight and MEF behind the scenes).

Digital Folio is based in Denver and my job will be based part time in Denver and part time in Seattle – current plans include moving to Seattle in November. Right - not Vermont. I love Vermont, had a fantastic time when I visited in February and May and really appreciate all the love I got from folks there. But this job offer was exciting enough to change plans – I’m going to miss living in Vermont, at least I can sea kayak both places.

I’m looking forward to so many things about my job with Digital Folio. I’ll have technical responsibilities for part of the product. I’ll interact with the BizSpark One team. I’ll spread my wings and moving into new Microsoft technical communities for Azure and Windows Phone. I’ll help Microsoft teams understand our needs and how they parallel needs of the broader community. I’ll be working with Digital Folio to identify how to best share our knowledge and experiences with the community, especially with Azure and Windows Phone. I wouldn’t be happy with a company that wasn’t committed to the health of the broader community and Digital Folio is committed to the success of technologies like Windows Phone 7 and Azure.

Digital Folio is a Denver-based customer experience innovation firm focused on leveraging new domain technology and a strong customer perspective to dramatically improve the shopping experience for consumers and retailers alike. Digital Folio, a cloud-based shopping tool powered by Microsoft Azure, offers the first seamless, multi-channel retail shopping experience that allows consumers to shop the entire web at home on a computer, anywhere on a mobile phone, or in-store on an interactive display. As the industry’s first “always with you” shopping resource, Digital Folio allows consumers to compare products and prices and receive dynamic money-saving offers from retailers -- all based on their own shopping behavior and in real-time.

by Kathleen | with no comments
In Praise of the Happy Face Button
Thu, Mar 31 2011 15:51

I love a lot of things in the Productivity Power Tools for Visual Studio. Read about them here: http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/ install through Extension Manager.

Hint: I’m guessing you’re looking at some key features in VNext of Visual Studio in the Productivity Power Pack – smoothed out and tested.

I’ll blog about a bunch of other cool things in this extension, but I really like the happy face button. The happy face button opens Outlook to send an email direct to the team. Yep, someone is looking at these as I’ve gotten feedback. These happy faces are several places in the Productivity Power Tools. This is really nice because I don’t have to tell them exactly where I was (the subject line changes). I’ve taken the liberty to use them to report features that were nearby as well. I want to make this quick direct feedback effective, so here are some hints:

- Be nice, or at least not rude

- One issue per email !!!

- Be clear – I did this, I thought this should happen, this is what actually happened

- Very specific and as short as possible but not too short

- If you can’t figure out how to do something, tell them, discoverability is a feature

- If you don’t want the team to have your email, use a special Live or Gmail account

- Be patient, if you want feedback and an issue tracked, use Connect

I’d like to see this evolve. There’s a dead web page that shows up and I’m not sure what that’s for. I’d like to access notes from the team on the specific feature. If they already know from 29 other reports, or they have already fixed it for the next drop, I’d like to know avoid re-reporting it.

I’m also willing, although it has to be an opt in, to install things on my machine to help Microsoft debug wacko problems if I have them (anyone else see failures in Ctl-Shift-V?). But historically these have been a pain to use. I’d like to see this simplified through a combination of extensions and a feedback system that runs inside VS (opt-in, disable easily, uninstall guarantee, all the caveats you can think of).

I guess what I’m most excited about is what this represents. It’s a way for them to get feedback on the little annoyances that affect the way we do our jobs every day. Sometimes it feels like the flashy new features eclipse work on just making our tools more solid. This feedback system is a way to concentrate on little details that you can report quickly and go on with your work.

My guess is that you’ll also be making the next version of Visual Studio better, without even running a beta.

Most features of the Productivity Power Tools can be turned off in Tools/Options. It’s granular so you can just turn off the features that you dislike while still being able to collapse all projects in Solution Navigator or some other small but dynamite feature.

So, if the Productivity Power Tools annoy you, send some feedback! And if you love them, well, it’s a happy face, so you can send that as well!

by Kathleen | with no comments
New Hampshire, Vermont, Rocky Mountain Tech Trifecta and New Mexico Sample Code
Wed, Mar 9 2011 16:44

I’m also uploading my “Step 6” sample. I am not uploading Step1 as that was just exploring the default internet project. As I said in the talk, the Step 6 sample will be a bit tricky to understand without some text. I still hope to write the e-book, but I’m going to try to get some blog posts up in the meantime. You can get the code here. It’s with no warranty of any kind. It’s a sample for goodness sakes.

One of the reasons I delayed is because I spent some time looking at the MVC Scaffolding project last week. I think that still has a ways to go. In particular, it creates too much code for my tastes, isn’t DI centric, and has the fatal flaw of not encouraging regeneration. At the end of the day I decided it’s just not that relevant to this work, although I’ll also try to find time to work on some scaffolding ideas within the NuGet/Scaffolding framework.

Enjoy!

by Kathleen | with no comments
Filed under: ,
New Hampshire, Vermont, Rocky Mountain Tech Trifecta and New Mexico User Group Slides
Wed, Mar 9 2011 16:30

I’m uploading a single deck that has the basic slide deck I showed in all these locations, except Nashua. Many of the slides overlap, but if you want that slide deck let me know. Note that the extensibility slides are preliminary, I haven’t figured out how to really express the complexity of the flow and this is my attempt to explain the functionality, and validation isn’t in the right place. I hope to update blog about this flow soon. You can get the slides here. They are my copyright and if you wish to use any of them, please ask.

At the end of this deck is a very rough draft of some slides on a debugging MEF talk. I haven’t had a chance to present this, these slides are very rough, and I pretty much hack my way through MEF debugging, but these notes might help someone. Another thing I should blog L

 

by Kathleen | with no comments
Filed under: ,
Creating a JavaScript Object as Name Value Pairs
Wed, Mar 9 2011 12:43

I thought describing how I solved an issue today might help someone else.

I’m working with JqGrid and needed to add a new row full of empty strings. I’ll actually make this more complex later based on the column attributes, but the simple version makes the point.

The documentation for adding a new row is:

clip_image001

Problem is that I’m creating empty data based on the columns – I don’t know what the columns are ahead of time.

I leveraged the fact that JavaScript objects are named value pairs for their properties. The code above creates an object with the properties defined, but you can also create an object with a dictionary style syntax:

clip_image002

This code returns an object which has properties for each column in the grid. Each column contains an empty string, except the key column.

With JQuery causing a resurgence in JavaScript, I suspect the different thinking required to solve a problem like this is going to trip up plenty of .NET coders.

Visual Studio Find in Files Overwhelmed With External JavaScript
Wed, Mar 9 2011 8:03

Maybe everyone else has already figured this out, but just in case…

I was going rather insane with the huge amount of results I got when I did a Find in Files in MVC projects that include a lot of JavaScript written and often minimized by someone else. I use Find in Files frequently and the large number of results made it useless.

The simple answer is to just remove the external JQuery and other external JavaScript files from your project. I had already moved them to a sub-folder so I could find my own JavaScript files more easily, so this involves just a couple of clicks.

I expect this to break deployment, so include them again before you deploy.

JQuery Append Failing to Add Elements from String
Tue, Mar 8 2011 8:31

I was building an HTML string and passing it to a JavaScript/JQuery method which appended the new HTML to an existing element. Pretty straightforward stuff, except it was not working. The HTML was created from a Razor View in MVC 3. There were no errors in the Razor View.

Frustrated I grabbed the HTML from the JavaScript debugger and pasted it into a new HTML page in Visual Studio. When I tried to reformat, I finally received errors that pointed me to some errant parentheses not found by Razor syntax checking.

In general, Visual Studio will not format anything it doesn’t like, so attempting to reformat can be a last ditch attempt to see whether the code, text, HTML or whatever is properly formed.

That’s not going to tell you whether the HTML is proper, because HTML issues generally come up as warnings. With the web page open though, you’ll get the warnings and you can explore how you messed up your HTML and confused JQuery. After I fixed the parens, I found that my logic for wrapping the form contents in a table was flawed.

by Kathleen | with no comments
T4 – Good, Bad and Ugly
Sun, Nov 14 2010 9:29

So, there’s a buzz on T4 and you’re trying to work out what it means to you?

But, first, what does it mean to me. Why do I spend more than half my time on unpaid research? The next generation of software development will have three legs to stand on: automation, composition, and development process. That’s the whole story. Code generation is the most accessible tool in the automation space – and that space is one-third of the future. I’m ready for that future. I believe technically the industry is ready to be there. I think we have a ways to go to actually get there together and currently my research is in the compositional architecture space.

Code generation is relatively mature. It’s entirely usable. You’re probably using it today. You can probably use it to make your applications better today. You can probably use it better today.

T4 (*) is a very sweet template language. Gareth Jones and the totally awesome DSL team at Microsoft brought you this tool. Its original purpose was to express DSL in 3GL code (VB/C#) but ultimately all transformations are just that, transformations. Generative transformations are almost always merge transformations – you’ve got something called metadata that describes aspects of your application, and you’ve got something called a template and running the template produces something – in our case code. Any transformation engine (XSLT, T4, VB literal XML, etc.) can produce code. T4 can produce any kind of text output (I want blog posts that people customized their Christmas letters by applying category metadata to people on their list and then ran T4 to produce a sensible letter, extra points for outputting Office XML in a pretty format instead of cutting and pasting the results).

This post is the overview of a four part series. Follow-on posts will cover the good, bad, and ugly of T4.

· The good is that it works. It’s a great opportunity.

· The bad is that the level of support for it is way below what we expect from our tools.

· The ugly is an attitude that generation templates are just some under the hood gunk that doesn’t matter. It’s code. You decide whether to write good code or bad code.

I believe we do our work on top of two sciences: The hard science of traditional Computer Science and a fluffy science that is the collision of economics, business and management engineering, human ergonomics, and Computer Science. CS offers the gears – the science of building the machine is more interesting. If there’s a science, we can discover (not invent) principles. I think the code generation principles I published in 2002 still stand:

1) The application remains the responsibility of and in the control of the end programmers

a. It’s that desk someone beats on

b. Primarily in the automation sense, this means they control templates

c. Templates must be in an accessible language

d. Templates must be of high quality to allow modification and reuse

e. Separation of concern applies to templates

2) Metadata is distinct, available and friendly to templates

a. Friendly is necessary to achieve the first principle (There is an approximate N^M ratio of template complexity where m is metadata friendliness factor – the exercise to prove this is creating templates directly with XSD metadata or slightly better EDMX, and treat yourself to something friendly)

b. Metadata is a major point of debugging, it must be viewable/reportable by humans

c. Metadata should come from many sources

d. Separation of concerns applies to metadata

e. Metadata is the business: it must be owned by it and morph between technology

3) Generation should be automatic and simple

a. Simple inclusion in development workflow is necessary to achieve the first principle

b. No checklists, it just happens, one click or no click

c. This means “no friction” in today’s parlance

4) Hand crafted code is sacred and protected

a. Handcrafted code is critical to achieving the first principle

b. Humans are creative, they don’t do things the same way twice

c. Handcrafted code must be embraced by code gen architectures

d. Handcrafted code must be physically protect from mistakes)

5) Generated applications are of equal or higher quality

a. High quality applications are consistent with the goals of the first principle

b. Higher quality code

c. Quality is a broad metric including economics

(*) T4 stands for Text-templating transformation toolkit. Amaze your friends at cocktail parties with that trivia

About a Dozen Things
Sat, Nov 13 2010 10:09

It’s very easy to believe that our code does a lot of different things – we live in a world of incredible complexity with well over 10,000 classes and 100,000 members in the .NET framework (1). We write code of great complexity – sometimes it’s amazing that it even works.

Take a minute to stand back from your code and consider what it actually does. I have the privilege of being part of the Northern Colorado Architects and we asked ourselves this question last spring. I’ve mentioned that we found about a dozen in several talks, and was asked to share the list. I’d like you to challenge this list if you think your code does anything else. Well, that and because I think I am forgetting at least one:

- Persistence

- Validation

- Authorization

- Localization

- Display/Edit

- Report

- Log/audit

- Test

- Exception avoidance and recovery

- Process

- Calculate

- Workflow (*)

The complexity of our world comes from the thousands of ways we can do each of these things and the billions of combinations. The complexity of a particular software application comes from tossing all of these concerns together along with a top- dressing of entropy and stirring vigorously.

The first three items on the list are pretty straight-forward. There is similarity between validation and authorization because they are both guards, but one focuses on who and the other on what, and we tend to use different techniques.

Localization may eventually fold into Display/Edit but today code on that front is rather different. Display/edit and reporting are also very similar. They differ because reporting is complex read-only analysis which might not be done over current data and may or may not ever appear on paper.

Three of the items on that list we do for internal purposes: logging/ auditing, testing, and exception management. Assertions and code contracts are part of exception management and what I mean by exception avoidance. Something is wrong and we’re responding to that, rather than crashing our systems – but it’s still a response to something being wrong. Logging and auditing covers all system health reporting and hopefully testing is a straightforward concept – even if it’s not straightforward in practice.

You might consider it cheating to have two buckets as big as “process” and “calculate.” Certainly they are critical and complex. But from a concerns point of view, it doesn’t really matter what you are doing – you’re doing it. I make a distinction between a process that changes the state of the universe (often by altering a database or an external system) and calculation which supplies information without altering the state of the universe.

Only three things (other than workflow) on this list should alter the state of the universe – persistence, logging, and process.

Workflow falls into a very special category. I mean a specific kind of workflow - the interaction between the application and the non-software business world it lives in. I don’t mean using workflow or business integration tools to do processing. I’m not actually sure workflow should be on the list, because in practice, it merely uses the other eleven kinds of code. At the end of my contemplation, I include it because I’d rather not spend time arguing about whether it should be there. I do believe that this sense of workflow is one of the most important perspectives we can have when we step back from our code and think as analysts. It’s a perspective that includes user stories as a subset.

There’s a lot of grey area where the things our code does overlaps. Is there any code in your space that does not fall into one of these buckets?

It’s a profound view. Everything is a cross cutting concern.

(1) Brad Abrams, Number of Types in the .NET Framework, http://blogs.msdn.com/b/brada/archive/2008/03/17/number-of-types-in-the-net-framework.aspx

by Kathleen | 3 comment(s)
Filed under:
Not Gonna’ Rebuild My Hard Disk This Time ‘Round
Thu, Apr 1 2010 9:10

As I face the upcoming release of Visual Studio 2010, I am contemplating a machine cleanup. It’s been six months, my drives tend to gather a lot of junk.

And I’ve rejected the notion of rebuilding my drive. It takes time I don’t have, and far worse, it’s scary and I’m trying to remove scary things from my life. It’s scary because it means I have to lean out on my safety line. My safety line is my backups, and yes I make sure the knot looks good. But my Dad once leaned out on a safety line in a tree stand and, well, let’s just say we’re glad he’s still here.

So, the options as I see it are what I really want – a new T400s, with dual monitor support, multi-touch, solid state 256Gb drive, etc. Well, OK, let’s get real I don’t have a spare 3 grand, and my mechanic says I need a new car – what’s with that?

The option I can live with is a new 320GB 7200RPM drive for my current T400. That’s $120 bucks. I’ll slide my current drive (same specs), into the ultra bay thingee where I yanked out the DVD (who needs a DVD?), slide the six month old drive into a SATA USB enclosure I also just ordered, and live happily ever after. When I did this six months ago, it was to finally move up from my 5400RPM drive. This time, it’s

just to save some time and hassle.

There’s a catch though. It’s a bigger waste/carbon load on the planet. Thus, I need to ride my bike to the gym every day (well, every day I go) from now until the snow flies to earn back my karma points.

Anyway, with the Visual Studio 2010 launch a few weeks away, you should decide now if you’re going to cycle drives or rebuild your drive in time to get it ordered.

And yes, I’m working on a bluegrass song with the title of this post.

The Problem with Immutability
Wed, Mar 31 2010 11:41

I’m writing this partly because I think there must be a happy solution and I just can’t find it.

I love immutability. Not all the time, but many times. I’d like to identify values which either because problems when they are changed, or they just do nothing. Of course reference variables generally need to be immutability, but they can also generally be initialized without any data – for example you can set a collection variable to an empty list in the declaration or the constructor.

The problem occurs with data happy classes – classes with strings or dates or integers or strings – where it is either dangerous or useless to set the values.

In traditional coding where you explicitly call a constructor, all is happy because you can create read only variables. You can assign to these variables in the constructor and they can’t be assigned to again.

But enter composition, MEF, IoC, whatever. Now, how do you manage those immutable values?

I’ve come up with four solutions:

a) Provide an Initialize method with positional parameters

b) Provide an Initialize method with optional named parameters

c) Write ugly code that tracks values and issues runtime errors

d) Provide a second interface that allows the sets

e) Use a singleton factory strongly bound to the actual class

f) Forget immutability

I’ll veto c for my work. Not only is it extra stupid code everywhere, but it throws runtime, not compile time errors.

If you need things to be “kind of, sort of” immutable, the interface trick would work. In some cases you might be able to limit visibility of the interface. But it’s not immutable.

I hate initialize methods. You have to remember to call them and its extra thinking. Without optional/named parameters they are extremely fragile to parameter list changes. And, it would be so weird to call Initialize twice on an object that I’m OK with the runtime error for that, and it can refuse to reset the values so you have nearly true immutability.

It’s not true immutability because the variables must be writable from within the class – for example, you could use private setters. This means within the class, the values can be changed rendering them less than fully immutable.

You could solve this problem if you created custom factories for every class you would instantiate items of. Instead of retrieving the new value via composition/MEF, retrieve the singleton factory. The factory could be hard wired to the actual class and thus directly call the constructor. A method like “Instantiate” could take as many parameters as needed, and could use optional and named parameters to avoid parameter list fragility issues.

This leaves me less than enamored with PartInitializer. It encourages us to skip immutability or to take shortcuts that leave our classes less than fully immutable. I’m not enamored with custom factories either. They are only a few lines of code, but they barf an implementation detail all over our code. Significant ceremony.

I’d beat up on the MEF team if I could figure out a way they could solve this with minimal ceremony.

Anyone have a great solution?

Silverlight Catastrophic Failure Message
Tue, Mar 9 2010 8:58

I’m not convinced this error is nearly as catastrophic as Silverlight made it out to be, but I thought I’d share anyway. I received the following error while working before breakfast, I’m blaming it on the lack of Wheaties in my system.

? e.ExceptionObject
{System.Exception}
    Data: {System.Collections.ListDictionaryInternal}
    InnerException: Nothing
    Message: "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
    StackTrace: "   at MS.Internal.XcpImports.GetClassFullName(String coreClassName)    at System.Windows.DependencyProperty.LookupAttachedCoreProperty(String propertyName)    at System.Windows.PropertyPathParser.GetDpFromName(String name, Boolean namespaceMappingAvailable)    at System.Windows.PropertyPathParser.ReadAttachedPropertyStepDescriptor(Boolean calledFromParser)    at System.Windows.PropertyPathParser.ReadStepDescriptor(Boolean calledFromParser)    at System.Windows.PropertyPathParser.Parse()    at System.Windows.Data.Binding..ctor(String path, Boolean calledFromParser)    at MS.Internal.FrameworkCallbacks.CreateBindingExtension(String constructorArgument, IntPtr& nativeOutValue)"

From searching the web I found a number of things that might cause this. Apparently it’s Siverlight 3’s way of saying “you confused me”. I didn’t find any issues relating to my problem, which happened to be on a date picker.

I had this code:

 

<controls:DatePicker Grid.Row="1" Grid.Column="0"
                     Name="StartDate"
                     DisplayDate="{Binding Values(0), Converter={StaticResource ObjectToDateConverter}}"/>

 

Did you catch it?

It was early, it was a VB project, I didn’t notice that I had reflexively used parentheses instead of square brackets on the binding to the Enumerable member.

by Kathleen | 1 comment(s)
Filed under:
VS 2008 Debugger Issue
Fri, Mar 5 2010 14:10

I was trying to debug a Silverlight application when I encountered the error

“The debugger cannot continue to run the process. Process was terminated.”

Happily I found a thread that discussed this issue because it was certainly not what I was expecting or looking for.

I was touching a property which called an initialization process in its Get accessor (did I mention this was a really, really bad idea). I had added code that touched the property in an overriding method that was called from the Initialize method.

Unexpected recursion.

I can’t say whether there are other things that can cause this error, but if it occurs I suggest that you check carefully for recursion.

One of the reasons this error can behave bizarrely is that it may occur because of recursion as one of the automatic watch windows such as Locals is displayed.

by Kathleen | with no comments
Bruce McKinney on Visual Basic.NET
Wed, Feb 17 2010 9:05

Many mixed feelings about posting this on the first day of the MVP summit. I got this email from Bruce McKinney this morning:

We haven’t talked for a while. I thought I’d let you know that I just posted a version of our discussion of VB.NET on my web site. Check out:

www.pobox.com/HardcoreVB/vbnet2.htm

How far out-of-date is this description of VB.NET in 2008?

It’s bizarre to think that most of the people on the VB Team have probably never heard of Bruce McKinney. I’m going to post this now because I received it now, and delaying it would be as much editorializing someone else’s post as deliberately timing it would have been. I did not. It came out of the blue this morning. Had I wished this to be main topics at the summit, I would have tried to get these things into our conversations weeks ago. I do not.

Obviously many of you do not know who Bruce McKinney is. Perhaps you don’t know who Dan Appleman is either. Perhaps you’re a C# programmer and think you just don’t care. But merging business programming and platform power started with VB (we’re comparing with Dbase and C++ in this time frame). The success of this merge is part of the history of C#, part of why the market existed in 2000. Bruce McKinney and Dan Appleman (and a few others) are the ones who proved that power mattered in such languages. They proved that business programmers could do great things and that they needed a powerful language to do it. Thankfully VB.NET/C# moved us an order of magnitude closer to the metal and allowed us to do the amazing things we do today.

That’s what Bruce meant to our collective history. Do you care what Bruce meant to me? As I look at the future and the work I’m doing to provide easier development and the thinking I’m doing to about the next level of abstractions, Bruce and Dan remain prophets. We can’t separate from the metal – which is why my current mantra is that we need to abstract application writing while not abstracting debugging and not hiding what’s really going on. Code still matters. Dropping down from an abstraction to the metal still matters. Anyone for in-line DSL? In line 3GL in a DSL? I believe understanding 3GL will eventually become as unnecessary as understanding assembly is today, but we can’t get there with a declaration or in a single jump or just because we want to get there. It’s a decade. We can only get there with a long iterative process that will require we go to the metal, understand why we went to the metal, and iterate again. Unlike VB6, we sit on an amazing platform where this process will work. .

If you still can’t quite recall where you heard that name before – Bruce McKinney wrote Hardcore Visual Basic which was on the bookshelf of most of the people that pushed the edges of Visual Basic. And if you read Bruce’s piece, remember this is one of the smartest guys there was in VB6.

More Posts Next page »