Showing posts with label DDD. Show all posts
Showing posts with label DDD. Show all posts

Friday, 10 June 2011

Guathon 2011

Monday this week saw this years Guathon in London, a day of technical presentations from St Scott of Guthrie, ably assisted this year by Steve Sanderson. The event is free and held in a cinema - now I know how big I want my next monitor to be :-) Unfortunately, due to Microsoft's lack of organisation in changing the venue at the last minute, there were lots of empty seats and many more developers could have attended. This year Scott did the first and last sessions, with Steve covering the late-morning/early-afternoon shifts.


Build An App Using ASP.NET MVC 3, EF Code First, NuGet, and IIS
The first session (which due to National Express East Anglia's incompetence I missed the start of) was Scott covering some of the features of MVC3/Razor and Code-First Entity Framework. This was probably the session I got the most out of all day, as I haven't done any MVC/EF in anger yet there was a lot of value here for me. Key points I took away were:
Razor syntax
@ - starts a code block
@:  - is the prefix for a string literal e.g. if you want to output some HTML inside a code block
There is detection for the @ symbol inside an email address that means it automatically renders a mailto: link
@@ - acts as an escape character
@helper - one of the biggest things for me, I've never seen this before. @helper allows you to write a helper method that acts like a method but with Razor syntax so you can call the helper to display a canned piece of HTML. Helpers can be declared in-line or in a partial class within the App_Code folder. Scott also mentioned that David Ebbo (@davidebbo) has a project on his website that allows you to write helpers that are compiled into an assembly. It's actually now on CodePlex at http://razorgenerator.codeplex.com/.
@model -By default the Model variable in a page is of the dynamic type, which means at design-time you don't get (much) Intellisense from it, however an @model declaration at the top of the page allows you to specify the exact type of Model, and you then get proper Intellisense support. If you create the View as a strongly-typed view and select the concrete type the View will support, it puts an @model declaration in for you.
_ViewStart.cshtml - Allows you to setup defaults for a set of views, including setting the _Layout.cshtml page. Someone asked whether you can have multiple _ViewStarts, Scott didn't know but was surprised when someone else said that you can. Gunnar Peipman's blog makes this clear - a _ViewStart is scoped to the folder that it is in.
_Layout.cshtml - The Razor equivalent of an ASP.NET Master page.

Scott also showed off a couple of tools:
Modernizr.js - allows you to detect which HTML5 and CSS3 features are supported on the browser instead of detecting these from the User-Agent string. Scott also showed off some HTML5 features in his demos, to which somebody asked if you could use those outside Razor. Scott's reply? "Yes, you can open your project and start typing the HTML5 tags" :-)
Glimpse - "FireBug for your server" is the best description of this tool. It shows you on the client what is happening on your server, how your server is configured. And I confess I'm pleased to see this is currently available for ASP.NET only, I'd assumed it was something other frameworks had had for a while but it seems not.

Dynamic Web UIs with Knockout.js
Steve's first session covered Knockout.js, an MVVM framework that works with any JSON feed. I think I may have misunderstood the principle behind this, it seemed to me to be largely another jQuery templating framework, although looking on the website it says that you can use your choice of templating engine. Talking to others in the evening though, there seem to be other concerns around Knockout - lack of testability and accessibility were the principal ones, and no degradation support means for me I'm unlikely to use Knockout. Plus I'm primarily a server-side guy - I can do some jQuery but right now I don't have the bandwidth to learn another JavaScript framework.

C#5 and Asynchronous Web Applications
After lunch Steve was on again, demoing some of the asynchronous bits that are coming in C#5. Steve talked about polling, long polling and sockets. The difference between these is as follows (I've probably got these wrong, if I have someone please tell me so I don't look a complete Muppet):
  • polling - call a service at a regular interval e.g. every second, the service returns any changes made since the last call.
  • long polling - call a service, the call doesn't return until the service has some data to return to the client, however long this takes.
  • sockets - opens a channel between the caller and a service and the service then returns data to the client whenever it has any, keeping the channel open.
Of these sockets is the best, however there is currently limited support for it on browsers so we won't see this go mainstream for a little while yet. 


Cloud Development
The last session of the day saw Scott back on the podium talking about developing for the cloud and Windows Azure. Scott has recently taken on management of the Azure team, although this was badly publicised as it sounded like Scott had moved away from ASP.NET and all the other things he was managing - this is not so, he's still in charge of ASP.NET and everything else, the Azure stuff is in addition to, not instead of. Scott talked about and showed off a lot of the infrastructure behind Azure, including fun facts like:
  • the ratio of servers to staff in the data centres is 15 000:1
  • the centres are constructed from containers
  • the newer containers they are deploying don't have roofs which saves a lot of energy on cooling
  • for every watt of energy that powers a server, they only use an additional 0.1 of a watt on ancillary usage such as heating/cooling etc
This gives you a much lower TCO when you use services in the cloud, however Scott came out with the quote of the day when talking about this:
"Developers don't care about money, we just care about developing cool stuff."
Employers, take note...

Scott demo'ed developing an ASP.NET application to be hosted in the cloud and showed the steps necessary to set this up. I was interested to hear that there is/will be a PowerShell commandlet for deploying solutions to your Azure setup.

Scott showed off some forthcoming technology on Azure, a Queuing service allowing you to de-couple parts of your business processes, which was interesting and made me wonder whether Microsoft might be thinking of putting some of the BizTalk infrastructure in the cloud. This would be a big win, I think, in terms of making BizTalk a more accessible technology and getting more take-up - we looked at BizTalk for a project a couple of years ago but the costs for setting up BizTalk on-site are currently prohibitive.

Scott presented a mini-case study on EasyJet - they host their applications in the cloud and then connect to them in airports using local WiFi, which saves them money on having to setup infrastructure in every airport they operate in.

Scott touched on the Azure AppFabric caching service, which I'm interested to know more about - I'm still fuzzy on the benefits. The throughput rate for the caching service is 4Tb/s - not too shabby. Scott also mentioned, almost, as my old German teacher would say, en passant, that Microsoft will shortly be rolling out a Content Delivery Network service on the Azure infrastructure, which is something I find really exciting. But maybe I'm just sad that way...

Thanks to Scott and Steve for presenting, Phil and Dave for organising it all, and Paul, Nathan, Johan and Dan for the conversation over dinner at TGIs!

Sunday, 30 January 2011

What's A DDD9?

Some of my (non-geek) colleagues who follow me on Twitter have asked me recently: what's a DDD9? The answer: for the UK .net community, it's the major event of the year. Held annually at Microsoft's offices in Reading, it is a free one-day conference run totally by the community. The DDD stands for Developer Developer Developer, from Steve Ballmer's chant of several years ago (http://www.youtube.com/watch?v=8To-6VIJZRE) *. Microsoft employees are welcome to attend, but they aren't allowed to speak. It is only advertised through word-of-mouth and Twitter: this year it sold out 350 spaces in 12 minutes, the waiting list for spaces was full after another 30 minutes. You may find this slightly more notable as DDD is held on a Saturday, which ensures that the people who are there are the kind of passionate people who are prepared to give up a large part (or in many cases the entirety) of their weekend to attend. The programme is completely voted for by the attendees, this year there was again a great mix of technical and technique sessions. The sessions I saw this year were:

.net Collections Deep Dive - Gary Short
Actually I wanted to see all four talks in the first session, but I picked Gary's as I don't think I've ever seen him talk before. This was a session going through many of the Collection classes available in .net, how they work internally and in what circumstances each one offers better performance. It included such gems as the fact that in the multithreaded collections if you call the Count property it is not guaranteed to be accurate unless you can be sure all threads have exited. In which case it wouldn't be, y'know, multithreaded. The top tip I took away was that if you know how many elements you are going to put in a collection, to set the Capacity in the initialiser:
List myListOfTenElements = new List(10);

CQRS, Fad or Future - Ian Cooper
OK, so I, um, didn't actually see this session, I got chattinjg to people in the speakers lounge. The presence of chocolate and raspberry cheesecake brownies (made by me) was a total coincidence. This was still quite useful as I was able to talk to Dave Sussman about a CSS issue I'd been having and get some advice. However I look forward to seeing Ian's slides and maybe catching this talk at a user group sometime.

A Primer on RavenDB - Rob Ashton
One of the sessions I really wanted to see as I'm interested in playing with RavenDB and I can see cases in WSP where it could be a very good technical fit. Rob is quite opinionated, especially on how MongoDB and RavenDB differ. Rob recommends getting the unstable version of RavenDB to play with so you can see the features, although I think at least initially I'll be using the stable build until I've found my feet with it. One of the things I'm most impressed with is the fact that for unit testing purposes, you can run RavenDB completely in memory with no impact to disk.

Is Your Code SOLID - Nathan Gloyn
This talk walked through the SOLID principles of software engineering.Nathan began with a pretty ropey bit of code, and then talked through each principle before demonstrating how the code changed after the application of the principle. A really interesting session for me, SOLID is something I need to think about more as I write software.

CSS Is Code - Helen Emerson
Helen's theme was that CSS code is as important as application source code, but that the rules and principles we apply to source code aren't often applied to CSS. Probably not the right session for me given that I'm a total numpty where CSS is concerned, although it was useful to see that in Helen's demos there were things that chimed with some of the CSS we used on the Intranet last year.

A Beginner's Guide to Continuous Integration - Paul Stack
A great session to round off the day from Paul Stack, talking about how to use CI to reduce the time it takes to release your software. Like RavenDB, CI is something I definitely want to look into, in fact in that respect it was a shame it was a Saturday as I was fired up enough that I wanted to go straight into the office and set up a CI server. The only real negative in this session for me was that there was little discussion of how to set up CI with TFS, although Paul tells me this is straightforward.

The Social Network
There's much more to DDD than just a technical conference - for many if not all of the delegates it is as much a social event as a learning opportunity. It's a chance to catch up with old friends, make new ones, or just an opportunity to put faces to Twitter handles - I've been chatting with Nathan and Paul on Twitter for months but Saturday was the first time I'd met them. And the socialising continues into the evening - there is a Geek Dinner after the conference, at which 40 of us take over most of Pizza Express to eat, drink and chat.
We had an interesting conversation at our end of the table about the nature of developers and DDD and why it seems to work for us but no-one else. There simply doesn't seem to be any other profession that does events like this - even inside IT, there's no equivalent event for IT Pros.

* I did discover through the power of Google an alternative DDD9 conference - Death, Dying and Disposal. Which doesn't sound anything like as much fun.

Sunday, 7 February 2010

What I Learned At DDD8

First thing on Saturday morning my Twitterstream was full of sleepy geeks converging on Reading - yes, it was time once again for DDD at Microsoft. DDDs are free one-day conferences where all the content is from the UK Microsoft developer community - Microsoft speakers are not allowed to speak, although they usually come just to hang out. The community also decide the sessions that form the agenda by voting on submissions. I was lucky enough to speak at DDD7, but my session didn't make it into DDD8 (which was for the best as hardware failure meant I wouldn't have been able to do any demos). They're also a good networking event - a useful addition this year was to have people's Twitter names on their badges, which meant that if, like me, you follow a number of people you've never met, you could start to spot them and say hello. In fact, at one point I thought 'this is just a social thing with some technical content tacked on'!

Once I was at Microsoft and checked in, the first person I saw was Simon Harriyott, who I met for the first time the preceding Thursday at Barry Dorrans' leaving drinks. Of which more later. As I was getting my sausage sandwich and coffee, I also bumped into VBUG Chair Tim Leung and had a quick catch-up with him before it was time to head into the first session of the day...

Barry Carr - Contractual Obligations: Getting Up and Running With Code Contracts
I walked into this session and pleasingly got a seat next to virtualisation guru and all-round good guy Liam Westley, and behind Guy Smith-Ferrier and Gary Short. I picked this session as it sounded to be similar to some work that was done at my last company, and it proved to be a very interesting talk. The concept of code contracts stems from some work done by the not-yet-dead Bertrand Meyer, father of the Eiffel programming language. Contracts allow you to specify pre- and post-conditions on methods, functioning like Asserts. One of the most interesting demos was where Barry stepped through some code, which had both pre- and post-conditions declared at the start of a function followed by the body of the function; as Barry stepped through the code Visual Studio seemed to be jumping around the code instead of following the flow of code as written, due to the way that Code Contracts amends the IL that your .NET code outputs. However the highlight of this talk was probably when one delegate had the temerity to ask a question; his reward was a USB stick, however Barry threw it to him unintentionally hard and nearly took him out!

I followed this with ...
Neil Robbins - Hello Document Databases
Neil said up front that he's a new speaker and that this was his first DDD session, and proceeded to give a blinding talk on NoSQL and CouchDB. CouchDB (and its' GUI, Futon) are all based around a mantra of Relax, which several of us shouted out from the audience at certain points when Neil got tied up by some Linuk case-sensitivity issues :-) Neil's demos were done with CouchDB running on Ubuntu, which was a slight disappointment for me as it effectively means CouchDB is something I won't be able to run at work; Neil's comment is that the installer for CouchDB on Windows is only a beta. Which is a shame as CouchDB looks like exactly the kind of technology we could do with at work for asset management software - we've had several conversations recently around the Entity-Attribute-Value pattern, which seems to be the major problem that CouchDB solves.
Andy Gibson - Web Application Testing with Selenium
This was an introduction to using Selenium, which is something I need to look into further, however I have to confess to too much Twittering and not enough paying attention in this session, particularly after John Nolan tweeted that he needed some water (Memphis was by now getting seriously warm) and minutes later Craig Murphy brought some in for him!

Simon Sabin - Entity Framework - How to Stop Your DBA Having a Heart Attack
I went into this session intending to pick up some knowledge about the Entity Framework, as I basically don't have any and one of my colleagues is intending to use it on his next project.But for that, and for me really, it was the wrong session. I still took some points away from it though, the key one being that although the SQL produced by the Entity Framework can look like it won't perform well, you can spend a lot of time trying to optimise it yourself but get only comparable results. Another good takeaway concerned the DATE datatype in  SQL Server 2008 - traditionally when trying to restrict results to a single date, we've used a SQL BETWEEN clause with the bounds set to midnight and 23:59 for the date in question; in SQL 2008 we can cast DATETIME values to DATE and just search for rows where the date is the date in question.
Oh, and for my personal future reference it's pronounced Say-bin.

Barry Dorrans - A Developers Guide To Encryption
And on to the last session of the day, and Barry's last DDD presentation before leaving the UK to go and work for Microsoft in Redmond. I first met Barry back at DDD1 and I've seen him speak a few times since then, and he's always been good. However, I already knew that his session was going to have some disruption, having had a chat with Phil Winstanley about it at the aforementioned leaving drinks. And also having provided to Phil and Craig Murphy, the organisers, a video of a rather younger Barry when he was on The Crystal Maze. And we weren't disappointed, either by the session (very good) or the disruptions (very funny). Barry wasn't too fazed by the videos that kept appearing on the big screen (or by Jon Skeet and others pointing out both mistakes in his code and typos on his slides). It started with coverage of hashing (which is NOT encryption), and then proceeded to show symmetric and asymmetric (private/public key) encryption, X.509 certificate encryption and XML encryption. I think everyone will remember Barry's key point about symmetric encryption keys, which can become diluted the more they are used for: Barry's message is keys are like condoms, don't re-use them. The only thing I would have liked to see would have been for each level of encryption the kind of data you might protect with it e.g. the correct level of encryption for storing, say, credit card data. 

All in all another excellent day at Microsoft, I should like to say a big thank you and well done once again to the organisers, looking forward to DDD9!

Sunday, 19 April 2009

WebDD Roundup

I had a really enjoyable day at WebDD yesterday. Aside from presenting my own session and catching up with people like Andy Westgarth and Barry, I attended four other sessions:

ASP.NET 3.5 - Miss something? - Dan Maharry
This was a really interesting session covering a number of out-of-band releases from Microsoft that may have been a little overshadowed by the ASP.NET MVC release. For me, the high points that I need to go off and investigate further are:
Lightweight Test Framework
This is a framework which was initially used internally by Microsoft's QA teams for ASP.NET but has now been released on Codeplex. It is a single DLL which works cross-browser and supports integration testing for ASP.NET sites. It also supports AJAX callbacks.
AJAX HistoryState and Back-button Support
This is a feature that was added in ASP.NET 3.5 SP1. It provides a method enabling the Back button to be fully supported by AJAX postbacks so that the browser's History list includes entries showing different states. I'm afraid I threw Dan a little bit as I asked about how well supported this is across different browsers - my thoughts were that I could see this would work with IE but I wasn't really expecting it to work in Firefox (or, to be frank, any other browser). However Dan confirmed that it does work in Firefox, though he hadn't tested it in against the other browsers. Definitely one to look into.
Composite Scripts
This is a method by which a number of JScript references can be combined into a single file, meaning your site only has one file to download instead of opening up a number of connections to download seperate files. I was unsure about this from a scalability point of view as it involves referencing scripts inside the ScriptManager control (which normally prevents the browser caching scripts since the URL is different for each postback), however the combined file is also put into the output cache instead of being compiled on the fly.
This was Dan's first time presenting at a DDD but I thought he presented very well and I'd like to see more from him in the future.

What's Good in .NET 4.0 and VS2010 - Alex Mackey
This session covered a number of things from the next release of the CLR and Visual Studio 2010. The things that stood out for me from this session were:
The improved code editing experience, including highlighting of every instance of a method call whenever you enter one of them, and showing the hierarchy of calls down to the method you are currently editing.
Something called variance and contravariance - I'll be honest, I didn't understand this. At all.
For ASP.NET:
Much better control around disabling Viewstate, including better support in the grid controls around working without Viewstate.
Static client IDs for controls.
The ability to compress Viewstate (though attendees to my session will have seen that this is possible in ASP.NET 2.0)
Environment-specific changes for web.config files e.g. web.config.debug, which looks like a mix of XSLT and the .dconfig configuration deltas from the Enterprise Library.
Better server-side control over META tags, for those developers interested in SEO-type activities.

For Workflow:
Performance improvements - up to 10x better performance.
A new workflow type, the Flowchart, which is a hybrid between the existing Sequential and State Machine workflows.
It will be easier to include information in a workflow, hopefully remving the need for the ExternalDataExchange object.
Overall, Alex' recommendation was that if you're currently thinking of developing a workflow application, wait for this version. This was particularly relevant for me, as I'm currently looking at a workflow app for a project at work.

I want it on that one, that one and that one! And it all needs to be synched! - Andy Westgarth
This session from VBUG Chairman Andy Westgarth covered the new Web Deployment bits coming from Microsoft. This tool is built on top of MSBuild and allows you build deployment packages to be deployed to IIS. These packages are not MSIs, the idea of the tool is to produce a package that can be passed to IT types without the need to handhold them as they deploy your application.

ASP.NET 4.0 - Mike Ormond
This session from Mike Ormond of Microsoft was, like Alex, concerned with .NET 4.0, however it was much more focussed on ASP.NET. The highlights I picked out were:
VS2010 is going to be productivity-focussed - there will be a new range of snippets for both HTML and AJAX authoring, although Mike pointed out that a snippet called 'requiredfieldvalidator' doesn't actually save you much typing. A nice feature is that when you add a validator, it will try and attach itself to the nearest control that can be validated - nice, but it seems Microsoft haven't grasped that not many people use the designer, they code the HTML in Source View.
Mike covered some of the new provider-based caching functionality and demonstrated a custom cache provider. Velocity was mentioned, but only as one of the available providers. Mike also mentioned that the existing System.Web.Cache namespace is likely going to be moved to a more general namespace, which explains the decision of the Velocity team to change their namespace - it seems likely to me that SYstem.Web.Cache will become System.Data.Caching. This is a small change but will clear up a lot of confusion over whether you should use System.Web.Cache in a WinForms application.
In WebForms, the need for the CSSFriendly adapters will go away - controls will be much easier to style in CSS out of the box. Mike also covered the Routing engine (which was split off from the MVC effort) which gives you much better control over URLs you generate inside your application, and the NamingPanel, a new control which is part of increased control you will have over client IDs.

I'd have liked to have seen Andy Gibson's session on jQuery but it was on at the same time as me :-( however all the sessions have been videoed so I will be able to see it on the web!
I had a great day, it was just a shame I couldn't stick around for beers afterwards. Next time!

Saturday, 18 April 2009

ASP.NET Scalability at WebDD

Thanks to everyone who attended my session on ASP.NET scalability at WebDD today - I hope you all found it useful. I got to the end of the section on caching, which is more or less the first half, and realised I had ten minutes left for the entire second half, so apologies for having to race through the rest of the slides. If anyone has any questions please feel free to post them in the comments here and I'll answer them.

I had a few questions afterwards over coffee, which were:
Q) Output Caching. Can you VaryBy things other than elements in the QueryString?
A) Yes, there are a range of VaryBy options: VaryByContentEncoding, VaryByControl, VaryByHeader, and VaryByCustom. In each case ultimately it boils down to a string. There's a discussion of all these options on MSDN, but basically VaryByContentEncoding's probably not going to help you too much since this looks at what encodings your browser can accept e.g. compressed content (and remember that I mentioned all the current browsers (and previous generation browsers) can accept compressed content). VaryByHeader looks at a semi-colon seperated list of HTTP headers. VaryByControl looks at the controls declared inside a UserControl. VaryByCustom is perhaps the most interesting as it allows you to roll your own scheme by implementing GetVaryByCustomString in your Global.asax file, or if you set it to 'browser' it caches page instances based on the browser name and major version.

Q) Is there a reason not to use VaryByParam=*?
A) VaryByParam=* will cache pages on all combinations of elements in the QueryString - I can only tell you what it does, it's up to you to decide whether this facility is going to fit into your application or not.

Q) Can you cache objects for longer than 20 minutes?
A) Yes. If you use sliding expiration, it takes a System.TimeSpan object. TimeSpan has three constructors - I used the hours/minutes/seconds constructor, but there's nothing to stop you using the second constructor which adds a days parameter onto the constructor. Bear in mind, however, that doing that means you're sacrificing that much memory on your server for that length of time. As with so many things in scalability, it's a trade-off...

Q) Do you need command-line access to your server to enable a SQL database for SQLCacheDependencies?
A) No. There's two options here: one is to keep in mind that the ASPNET_REGSQL command-line tool takes a server name from the -S parameter - this can be any SQL server that is on your network, you don't have to run the tool locally to the server you're enabling.
The second option is to use the SqlCacheDependencyAdmin static class, which gives you the ability to programmatically enable and disable databases and tables for cache dependencies.

Thursday, 26 March 2009

Speaking at WebDD

I had an email from Phil Winstanley overnight to say that my talk on writing scalable ASP.NET has been accepted for WebDD at Reading on 18th April.

I'm looking forward to running it again, this'll be the third outing. Maybe Barry'll get to it this time...

Update: Delegate registration is now open. Book early to avoid disappointment.

Thursday, 19 February 2009

WebDD

I was pleased to see a tweet from Phil Winstanley yesterday announcing that there will be another WebDD this year. I went to the one in 2007 and had a fab time.

Once I've come up with some words about myself I'll be submitting my scalability in ASP.NET session. I'm also trying to write a session on scalability with Velocity - maybe this'll be the kick I need...

Sunday, 23 November 2008

DDD7 - ASP.NET Scalability

I'd like to thank the organisers and attendees for giving me the opportunity to present 'This One Goes Up To 11, or How To Write Scalable ASP.NET' yesterday at DDD7 at Microsoft in Reading. It was my first time presenting at DDD, and I really enjoyed it. My session seemed to go quite well, there were a couple of demos I need to go through again to figure out why they didn't work, but overall I felt it was quite well received. All the sessions were videoed for Channel 9 , which is both quite exciting and means I'll get to see the sessions I couldn't get into :-)

A session I did get into was Phil and Dave's ASP.NET 4.0 runthrough. A lot of things are still under wraps, but one of the most useful things they demoed was the ability to set a control's ID and not have it munged with the control's container name when the html hits the browser. Which is nice. I feel validated in being unsure about MVC now I've heard that Phil's not keen on. It'll be interesting to see the new provider-based caching model when it arrives, especially as this will fit really well with Velocity. I'm not, however, at all sure about the new WPF-based Studio.

Edit: My slides and code samples are now available at www.philippursglove.com/ScalableASPNET.

Friday, 10 October 2008

How to Write Scalable ASP.NET

Like Barry, I got my email last night to tell me my talk on writing ASP.NET that scales sensibly (or indeed at all given the standard of code I've been reworking for the last two weeks) has been selected for inclusion at DDD7.

Suddenly I'm rather nervous and wondering if I can actually pull this off...