about
framework & approach
knowledge network
news & events
technology council
why join?

Friday, March 07, 2008

Mix - Conclusion

The bad:

  • UX track needs some work.
  • Business panelists were not very impressive and forward-thinking. I found the 2006 sessions with Ebay, MySpace and Amazon to be more interesting. Those guys actually had profitable businesses. Web 2.0 guys make cool stuff but still have no idea how to make a buck out of it other than ads.
  • Keynote was too demo-centric. I understand the need for some wow-factor in order to get developers excited acount SilverLight, but IMO flying images and glossy buttons don't "wow" anybody anymore.

The good:

  • The Ballmer / Kawasaki interview was a lot more fun than the Gates / O'Reilly discussion at Mix 06. Tough questions, good humor, and Ballmer is just fun a guy. I was really thrilled I got to ask him the EC2 question.
  • I got more interesting info on the tech side than I expected. SilverLight finally looks promising, Version 1 was just a toy, more of a CTP than anything else. But this is pretty cool.
  • I'm very impressed with the MVC team. It's so unlike Micrsosoft: hire active smart bloggers, forward thinkers with deep community relationships (small team, only 4 FTE right now), give them complete freedom, and see what happens. They're not even locked into a release schedule. New builds will happen frequently and are completely based on community feedback. Basically it's like an open-source project with virtually unlimited funding. Any developers' dream. These guys were so honest about the company, didn't care about pissing people off, it felt very non-corporate. I loved it.
  • Open Space is a great concept. I wish I had spent more time there. The 45 minutes I spent chatting directly with Scott Hansleman and Phil Haack were worth the $1300.
  • The overall openness and unpretentious tone were promising. Microsoft's always been great at supporting developers, and that hasn't changed. "Web developers, web developers, web developers!!!"

Mix 08 - Day 3

SilverLight / Ajax integration

Some good ideas there, like how to integrate your siliverlight app with the Ajax history manager. I was impressed with how transparent the integration is.

Not only can you can access any DOM element or JS object from SilverLight, but you can even register managed code event handlers for javascript events. That's pretty cool. The JS to SilverLight integration is really good, too. Just mark any method as Scriptable, register it, and JS will be able to access it. The JS proxy converts CLR types to javascript objects automatically. I believe you can register javascript event handlers to CLR events as well.

It did give me a bunch of ideas in terms of expanding my Ajax code without breaking the good old HTML page metaphor. For apps other than email clients and intranet apps, Flash and Silverlight apps just look weird. When developing apps for the masses, you have to always weigh usability vs what users are used to. The Office Ribbon may look nice, and for all I know it may be more usable, but it is so different from the traditional menu system it took employees a long time to get used to it. That can be OK in an enterprise environment where people are paid while trained, but in the web world, this can kill your business right there. Areas that could benefit from Ajax support may be file system access, local storage, rich media display (project management Gant chart etc)... tons of possibilities there.

The one thing I'm still going to use Flash for for a while is audio/video capture. Silverlight doesn't have that capability yet.

Creation internation apps

Not much new here- use resource files, place resources in satellite assemblies etc...
A few good points though.

  • Avoid the conpt of "Countries' for liability reasons
  • Don't create maps and deal with border problems.
  • Don't show flags.
  • Avoid text in images.
  • Of course, build a UI that can accomodate for varying string sizes.
  • Make sure fonts have full Unicode character coverage.
  • Localize javascript and CSS files.

Thursday, March 06, 2008

Mix 08 - Day 2

Out of the 3 sessions I attended yesterday the SEO one really stood out. Great session. I got a ton of cool tips out of it. It pretty much paid for the trip. I'll post the link to the video as soon as I find it.

Oh yeah, and the TAO party was really great.

Steve Ballmer keynote

Great keynote today. Ballmer is a fun guy, and answered tough questions with a smile. He looked like a motivated, smart, and surpisingly honest guy. I got to ask him a question about Micrsofot's plan to offer an Amazon EC2 / S3 alternatice on the MS platform, and he pretty much told me it's in the works, but still confidential. We should know more in 3 months. But basically he admitted MS will have a hosted file storage and utility computing offer pretty soo. Exciting stuff.

UX Track - a failure

When I read about the UX track I got pretty excited. Information architecture. Interaction design. I thought I'd get a bunch of great tips, dos and don'ts that'd help me create great web experiences. I've attended 1 1/2 sessions, and it was quite a disppointment.

In session #1 (interaction design), we learned about the revolutationary concept of "brainstorming", but rebrnded under the name "ieation phase" - they're consultants, they have to pretend to be thought leaders to make money I guess. But nothing about actual interaction design in web apps.

Session #2 (information architecture) unveiled the secrets of folksonomy (fancy consultant word for tagging), and wasted 30 minutes of the attendees time in modeling a "Hotel" class. ("Hmmm.. it should probably have a name and a description, maybe a location as well? What data types could that possibly be?"). Are you kidding me??? This is what my interns do all friggin day!

UX track is a wonderful idea with incredibly poor implementation. 1 hour is not enough time to do group activities (which are overrated anyway) and learn something. Tell me something I odn't already know, or don't bother.

I wasn't the only one feeling that way. Other designers walked out. If Microsoft wants to keep Mix interesting by keeping a mix of designers and developers, they better fix this fast.

Other sessions

ASP.NET Ajax - nice presentation by Nikhil Kothari . Some nice little code snippets and Ajax best practices. I think it's worth mentioning XML-Script is pretty much dead in the water. Micrsosoft is looking at a different approach for client-side databinding and templating.

Great MVC session. Scott Hanselman is clever, funny guy. They're doing a really good job with that framework. The open space discussion afterwards was very interesting. It looks like we'll have to wait for the next preview to get better AJAX support, but they seem to be trying to monthly builds out, so that's encouraging. MS has a good team working on this.

Good quote from Scott: "compilation is really just a series of unit tests". He even went as far as questioning the purpose of compilation altogether. When using test driven development methodolgy (TDD), are strongly typed languages really just useful for intellisense support? Probably. But that's where Sscott and I disagree. Intellisense support and code readablilty are a big deal for me. My app has over 100,000 lines of code. I can guarantee you that if everything was loosely typed, handing code over to new developers / interns etc... would be a nightmare.

I also learned about how to use Linq's dynamic data binding when submitting a form. Pretty cool, but you gotta make sure you don't expose vulnerability. It reminds me a bit of SQL injections. Trusting the query makes coding easy and saves a bit of time, but can lead to serious security holes.

That's where Scott's recommendation of using custom objects between Controller and View makes a lot of sense. Only expose what the view needs to know. It doesn't solve the problem of trusting the query at the controller level though. Here's a concrete example.

Let's say theProduct class has a Name and Description Property. For whatever reason, in a specific context you only want to expose "Name" as editable in your HTML form. In asp.net, injecting more properties in the post data is difficult, if not impossible. When using a FormView/DetailsView, you'd need to inject a new databound control in the data control tree, all on from the client. You just can't do that.

In MVC, if using Linq dynamic data binding (something like Bind(c => Form.Product) - I;d need to look up the exact syntax), you'd basically matching Product properties by name. If your post data contains a "Product.Description" field, it'll get updated.

So... watch out.

Another topic of discussion revolved around building business objects leaning towards the UI tier rather than data tier. A typical business tier might know about DataRows, DataSet etc... But think about business objects containing validation and presentation attributes around its properties. It can make view building pretty easy.

That's basically what SalesForce does. When building custom objects, you define validation rules at the object level. It makes a lot of sense IMO. The biggest complaint I've had from users though is the lack of customization at the presentation level.

Anyway, it was a very interesting chat with very smart people. I'd love to see the ability to set validation rules at the object level.

Wednesday, March 05, 2008

Mix 08 KeyNote

I'm attending the Mix 08 keynote in Vegas right now.

Strategy

So far, nothing really new. Microsoft is basically playing catch-up with other industry leaders. MS seems to be focusing in 3 areas:

- Advertising platform (desperately trying to grab some of Google's insane market share)
- Device management unification (Zune/XBox/MediaCenter etc...)
- Virtualization and utility compupting both at the pltform level (trying to catch up with VMWare) and service level (Exchange Online, SQL Server Online) - trying to catchup with Amazon AWS offering. No news about an EC2 equivalent or licensing changes to accomodate for elastic comuting though.

IE 8

I can't believe after a 2 year wait we're expected to cheer for features like integrated debugger, CSS/DOM inspection, CSS 2.1 support and better Javascript performance. Other than web slices, IE 8 is just on par with Firefox and Safari. There's some support for HTML 5 and localstorage. Overall, it looks good, but it's 2 years late. This is what IE 7 should have been. Hugh... whatever.

SilverLight 2.0 / Expression Studio

Ver, very interesting news. SilverLight is offering some interesting advertising features, but the real big deal is DoubleClick announcing support for SilverLight. This could seriously speed up SilverLight market penetration, but it's also very intriguing since DoubleClick and Google are trying to merge, and the Google/MS war seems to be at its peak right now. No MS employee will even mention the G-word here. So what does this mean? Is there a deeper message in this announcement? What's DoubleClick incentive in supporting this very new technology?

MSN Video demo, showing Beijing Olympics video coverage. Looks really, really cool. Replay feature on live streams, picture-in-picture... awesome.

A couple of SilverLight marketing site demos (Hard Rock memorabilia and Aston Martin). This is hilarious. It reminds me of those good old Flash web sites that I thought had gone out of style years ago. Sure, bandwidth is better, processors are faster, so they look a bit better, but this is 1998 all over again. I guess they're trying to add some "wow" factor to this keynote because of the lack of breakthrough announcements, but come on... these are useless, useless apps. Haven't we learned anything over the past 10 years???

Cirque du Soleil was pretty cool. Nokia speech was mind numbing. MIXr is sooooo 2007. WeatherBug - whatever.

If I see one more SilverLight demo I'm going to get sick.

Conclusion

It's all about SilverLight. No mention of ASP.NET MVC. Scott Guthrie had promised a new release, but I've heard nothing. I have a list in front of me of all new software available to download, but it's all Expression Media / Studio and IE 8. Nothing about ASP.NET Ajax either.

Silverlight is pretty much Flex, with the advantage of supporting .Net programmirng languages and IDE, but worse animation features, and no audio/video capture or Flash Comm Server equivalent.

IE 8 is Firefox + web slices and offline storage (which probably won't be useful for another 2-3 years).

Oh yeah, and in 5 months we'll get a .Net 3.5 SP that'll add rippling effects to WPF. Great...

There you have it.

Friday, February 29, 2008

ASP.NET MVC

Microsoft is finally admitting ASP.NET is now an outdated web framework. It makes testing very complex, working around the ViewState is a big waste of time, and the webform metaphor makes zero sense to most web developers. Most web front-end developers don't use the designer, and want complete control over rendered HTML and styles. You can do this in ASP.NET, but it requires workarounds like CSS adapters etc...

ASP.NET MVC keeps all the good ASP.NET stuff like databinding, user controls etc... and add a pure Model-View-Controller pattern to your app. Mixed with Linq, and considering Unit Tests now come out of the box with VS 2008 Professional, you now have a web framework that's very similar to Ruby on Rails, with a much better IDE and the whole .Net framework to support it.

I'm building an app using the MVC framework, and I have to say I like it a lot. I was very familiar with webforms, custom web controls, ViewState and all that nice stuff. Quite powerful, yes. But now web UIs are getting more client-centric thanks to the rebirth of Javascript, all that server-side stuff is not necessary anymore. You really just want to serve a page, offer data services (SOAP/REST/whatever) and let javascript take care of the rest.

I've been very happy with the framework so far. The URL routing engine is nice, and the HTML helpers are great. Strong-typing and generic ViewData make views a breeze to put together.

There are only a few things I hope MS can put together before the release:

  • Better AJAX support. I don't really care about UpdatePanels, but I'd like to be able to catch AJAX requests at the controller level and add ScriptManager instances to my controls without using a server form. Nikhil Kothari at Micrsofot worked on his own implementation. You check it out here.
  • Ability to out views in generic http handlers (.ashx). Right now you can use pages and user controls. But whenever outputing content other than HTML (xml, JSON strings, images, binary data...), HTTP handlers are pretty handy.
  • Ability to use sub-views. I'm not sure yet how that would work exactly, but right now if the page to render is pretty complex, your controller becomes responsible for too many parts of the page. A controller should be able to call sub-controllers, maybe linked to user controls... something like that.

If you're sick of the webform model but love .Net and Visual Studio, I'd strongly recommend you check this out. If you're familiar with other MVC frameworks, it'll look pretty familiar. If you're new to the idea, you'll finally learn what all the rage is about.

A new community preview should be released at Mix 08 next week. I'm looking forward to it.

VS 2008 - Javascript Intellisense

It's a big step in the right direction, but there are still some things that need to be figured out. My biggest problems are:

  • Lack of intellisense support within the prototype. Let's say I'm writing a JS "class". Intellisense seems to work well for all external libraries that are properly referenced, but I can't access the current class methods and properties within its prototype. "this" doesn't give me any choices.
  • Some methods referrencing the DOM rather than javascript objects seem to not work as expected. The first one that comes to mind is "$get()" in the MS Ajax library. Using getElementById() shows all the DOM element properties and methods, but the "$get" shortcut doesn't. It's a real pain actually, and it looks like a bug. It seems like DOM element are described via "isDomElement=true" in the comments rather than the "type" attribute, but it doesn't seem to work properly. I've found multiple posts about the topic, but no response from Microsoft.
  • Not support for code folding / outlining. That seems like a pretty basic feature - all other JS editors offer it, and I don't understand why it didn't get implemented. It makes long javascript files a big pain to edit.

Overall, JavasScript Intellisense works really well if you write small snippets of code referencing well-described external files. Referencing Web Services works really well, too. But if you're writing complex components, it's not going to do much for you.

Wednesday, February 13, 2008

XSD.exe

I've been using a neat little Visual Studio command-prompt tool lately: xsd.exe. It lets you create XSDs from XML (though it seems to generate some dataset-specific code that I had to clean up), classes from XSD (very useful), and other little things.

http://msdn2.microsoft.com/en-us/library/x6c1kb0s(VS.80).aspx

Wednesday, February 06, 2008

The beauty of IoC and DI

I had been reading about Inversion of Control and Dependency Injection for a while. It looked interesting, but I never took the time to implement it in any of my projects. I think I just never had the perfect scenario that would greatly benefit from that kind of configurable component-oriented architecture.

If you're an ASP.NET programmer and have never heard of those terms, they're basically the same as the Container or Provider pattern (provider pattern is issued by MS in ASP.NET 2.0 for Profiles, Membership, Roles, Session storage etc...).

Lately I've had 2 use cases that fit this need perfectly. I downloaded Castle.Windsor and started digging into it.

Sample Scenario: caching.

Every ASP.NET programmer has used ASP.NET's static Cache. It's fast, easy to implement, until... you try running it in a web farm. .Net doesn't support distributed caching out of the box, ,o now you're stuck with a bunch or redundant caches on each server that get out of sync easily. If you use SQL Server 2005, you can try using SQL Dependencies. I did. It started generating a whole bunch of events in the event log, and was overall not very reliable. Not only that, but now you've built a system that's highly reliant on a SQL Server 2005 backend. What if you decide using MySQL? Then ASP.NET will poll the database, and you're going to have more scalability issues.

Here comes distributed caching. Basically your cache is now located on a cluster of caching server shared among your web front-end servers, and now you only need to worry about that one cache being in sync with the database. There are different flavors, with different pricing and different features, but I chose Memcached because it's free, runs on Linux, is easy to setup, and if MySpace relies on it it must be good enough for my little app. (There's also a Windows implementation that's pretty useful for development and testing.)

But here's the thing. I don't want to write references to the C# Memcached client all over my code. What if I switch to something else? What if the app doesn't need to scale up and needs to rely on ASP.NET cache? Caching, like logging, is one of those aspects that's all over the place and creates dependencies that can be a real pain to refactor.

Here's where a container (like Castle.Windsor) comes in handy. All I had to do was create an ICache interface as follows:

public interface ICache
{

void Set(string key, object value);
void Set(string key, object value, TimeSpan duration);
object Get(string key);
void Remove(string key);
bool KeyExists(string key);
}

then I wrote 3 simple implementations:

CacheMocukupImpl uses a private dictionary to organize its contents. It's not thread-safe but is guaranteed to work in any context. Very useful for unit-testing.

ASPNetCacheImpl is a wrapper for the built-in ASP.NET Cache object.

MemCachedImpl uses a MemCached client (there are a couple C# clients out there: here and here).

Then it's just a matter of declaring the ICache component in the Castle configuration, and calling IWindsorContainer.Resolve() to get access to the instance.

Remember to set lifecycle attribute to "singleton", which prevents the class from being instanciated for every single call. Since the cache shares its resources across all incoming requests, it has to be a singleton. Of course, you have to make sure your implementation is thread-safe. Now depending on my needs all I need to do is change the Castle configuration to change my caching implementation. Why not using the ASP.NET provider pattern you might ask? Because I didn't want to limit myself to ASP.NET. I might have other non-web apps that could benefit from this feature. Also, it makes unit testing much easier. Using mockups allows me to focus the test on the method it's testing, and not associated components.

I'm now implementing this pattern all over the place. We're using Amazon Web Services extensively, so I created interfaces, mockups and implementations for queuing and file storage. Logging is next. By decoupling your components, your code becomes much easier to read, test and debug.

.Net source code debugging

Shockingly, Microsoft released the entire .Net framework source code a few weeks ago. More here. This is really amazing; a great, great move. A full downloable version will come out soon. It'll really help debugging, and gives me better visibility in the inner workings of various components. I don't have to use my favorite decompiler anymore, and even have access to developer comments. I'm also hoping it'll speed up Mono project development.

I did run into some difficulties installing the hotfix though, kept getting a fatal error. Turns out that it had to do with my having Orcas Beta2 installed a while ago. I read a post mentioning I just needed to insert the original install DVD and everything should work OK, but that didn't work for me. I finally figured it out, so hopefully this will save you a 1 hour headache.

Here were my original VS 2008 install steps:

- Installed Orcas Beta 2.
- Removed Orcas Beta 2.
- Downloaded VS 2008 ISO from MSDN.
- Burned DVD from ISO.
- Installed VS 2008 Team System from DVD.
- 2 weeks later, received MSDN DVD and threw away my burned copy.
- When trying to install the VS 2008 QFE, inserting the MSDN DVD doesn't solve the problem.

It turned out that the downable ISO and the mailed DVD don't have the same file structure. The hotfix tries to find the original vs_setup.msi. In the ISO, it's located under D:\vs_setup.exe (where D is my DVD drive), but on the shipped DVD it's D:\vs\vs_setup.exe. So the solution was to re-download VS 2008 ISO from MSDN web site, re-burn it to DVD and insert it. One I did that, everything worked fine.

VS 2008 Team System Rant/Rave

After using VS 2008 and TFS 2008 for a few weeks, here are a few initial impressions.

Pros:

- TFS 2008 merging is working great
- Unit test creation is much, much faster (UI used to freeze for 2 solid minutes)
- Thanks to Vishal Joshi for giving me access to the latest build of WDP 2008 before official release. You saved the day.
- ASP.NET ListView control is pretty cool
- LINQ is amazing. Just utterly amazing.
- Multi-targeting works great.

Cons:

- The XML Schema (XSD) designer is gone. I understand it's being re-written, and it'll be nice once it's released (release date seems to be TBD), but I find strange to take away useful product features entirely. For now I have to resort to manual XSD editing, VS 2005, or I might to purchase XML Spy.

- ASP.NET designer and xml intellisense are broken. Sorry. A 20 sec freeze EVERY time I edit a tag or change some control property is just not usable. I run a 2.4 GHz core duo, Vista 64 and 4 GB of RAM, with a 128 MB NVidia video card. It can't be my machine. A lot of people are having similar issues. Even in a simple page with no master page, no themes, and only 6 native ASP.NET components (3 gridviews and 3 repeaters), I'm ready to blow my head off every time I need to make an edit. It's faster to just use WordPad. How bad is that?

EDIT: Since this post, Microsoft has released a hotfix for this specific issue.

- There used to be an annoying UI bug whenever using the database schema compare tool - sometimes the text in the source / target dropdowns would be off by a few pixels, making it unreadable. The good news is the bug is fixed for database dropdowns, but not for database projects. Basically, it's half-fixed. FYI - this bug was acknowledged by MS as soon as VS for database developers came out - about 2 years ago?? No hotfix was ever released for VS 2005.

No comment yet:
- Javascript debugging (coming soon)
- WPF / WCF (coming soon)

Friday, January 25, 2008

Amazon Web Services + Microsoft = My Dream Platform

We're implementing some changes to move our processing and file storage components to Amazon Web Services (more on that later). We're using S3 for file storage, EC2 for report processing and SQS for report queuing. The end result will be a very exciting, cheap, virtualy infinitely scalable platform that will remove a lot of day-to-day maintenance headaches and gives us cost predictability.

But I have to say, the lack of support for Windows OS on EC2 nodes is making the transition very difficult. Sure, there's a hack out there to run a virtual Windows instance on top of your Linux virtual host, but it's really slow and it's still up to you to maintain your windows licenses to match actual use. If you need 50 Windows nodes for 2 days, well, you're out of luck.

We're a .Net shop. Our only option is to convert our heavy processing code to Java and run it on Linux. Sure, we could use Mono, but .Net support is limited, and I'm a little concerned about the future of the Mono platform. Unless they get significant support from MS, I just don't see it keeping up with .Net framework advances. I mean, can you imagine Linq support in Mono anytime soon? I can't.

Since they're using Xen in the backend, it seems to me that the only thing preventing Amazon to support Windows is a licensing issue. I don't understand why MS wouldn't make a deal with them. It doesn't sound that complex. Average # of Windows Server instances / yr * volume price. Amazon has the metrics needed. It would require initial investment in purchasing a large set of licenses though, but I don't see why MS couldn't help them out and charge after the fact rather than up-front. And charge the cost back to the end-user.

Assuming Amazon pays $800 for each Windows Server Standard License. Now let's assume they want to cover that expense within the 1st year. That's $.09 / hour, so let's say $.10 is Amazon's actual cost for the first year, $0 afterwards. Charge end-users $.20/instance/hour extra for windows boxes And make a healthy $.10/hour profit during the 1st year, $.20/hour afterwards.

Pricing now becomes

$0.30 - Small Instance (Default)
$0.60 - Large Instance
$1.00 - Extra Large Instance

So you now pay roughly $720/mo for 15 GB of memory, 8 EC2 Compute Units (4 virtual cores with 2 EC2 Compute Units each), 1690 GB of instance storage, 64-bit platform Windows server, with EC2 platform flexibility.

Would I pay this much? Heck yeah. Giving me the power of Windows on EC2 is definitely worth the price, and now I don't have to worry about how many Windows licenses I own. And this could be a cash-cow for Amazon, with very low risk.

So why the heck this is not offered today is beyond me.