Category Archives: Development

Event: Edinburgh, 1 May – Windows 8 for Application Developers

Calling all Scottish Developers!
Microsoft will be bringing Windows 8 to Edinburgh on May 1st – join the UK team for a day of developer-level, demo-driven sessions and see first-hand the opportunities for designing, developing and selling apps world-wide via the Windows Store.

Windows 8 offers unparalleled new opportunities for application developers to build and sell apps world-wide via the Windows Store. In this event, we’ll deliver developer-level, demo-driven sessions that give you an accelerated entry into what it means to design, develop and publish exciting, modern, polished, world-ready applications for next-generation devices running Windows 8.

Level of knowledge required:

1. A familiarity with .NET development and Visual Studio would be advantageous but not required.
2. We will talk about building Windows 8 applications with JavaScript and with .NET with an emphasis on the .NET technologies.

Agenda (subject to change):

0900 – 0930 Registration Opens
0930 – 1030 Windows 8 for Modern App Development
1030 – 1045 Break
1045 – 1130 Metro Design Language
1130 – 1145 Break
1145 – 1245 “Metro Style” Apps – The Power of the Device Part 1
1245 – 1330 Lunch
1330 – 1430 “Metro Style” Apps – The Power of the Device Part 2
1430 – 1445 Break
1445 – 1545 “Metro Style” Apps – The Power of the Cloud Part 1
1545 – 1600 Break
1600 – 1700 “Metro Style” Apps – The Power of the Cloud Part 2
1700 – 1730 Wrap Up and Close

Click here to register now.

Job: Edinburgh, C# web and mobile

The ESPC are looking to recruit a software developer!

Essential

  • Web UI techniques (.NET MVC, JavaScript, CSS, HTML)
  • 2 years+ professional experience in object oriented programming: C# (or possibly Java)
  • Unit testing (nUnit)
  • MS SQL Server
  • XML
  • Content management, indexing & search
  • Ability to take ownership of key project areas such as software design, implementation, integration, documentation, quality assurance, deployment & support

Nice to Have

  • HTML5
  • Native mobile app development (iOS, Android)
  • Apache Lucene / Solr
  • Agile (scrum) development methodology
  • Continuous integration (CruiseControl.NET)
  • REST
  • nHibernate
  • Windows Workflow
  • Mocks (RhinoMocks)
  • nAnt
  • Subversion

Further information
http://www.espc.com/about-us/software-developer-opportunity

Software projects that are over-budget and late: please, don’t blame us…

[Originally drafted in March 2010, published February 2011]

For many decades now, developers and IT departments have been at the receiving end of a lot flack. Flack stemming from the fact that many software projects cost more than originally estimated and take longer to reach production than previously thought. Typically, it’s the fault of the folks near the bottom of the tree: the developers or the IT department. This blog post is a tale of woe that highlights the blame culture that we live in and how this author believes that blame to be misdirected, at least in some cases.

Most software projects have some sort of plan, a list of activities, a product backlog, user stories, perhaps even a schedule. Regardless of your religious view in the waterfall or agile space, you will have requirements noted down somewhere using whatever technique floats your boat. You may also have an “end date” (aka a go live date) that is either dictated by some form of time estimate based on the list of activities or, worse, by a third party. Invariably, you may not have a lot of say in the estimation process…you have to hope that the person is reasonably good at estimating how long it will take a somebody else to complete a task. Remember, that person is estimating how much time somebody else needs to complete a task: a task in a domain they most probably know very little about (“stick a button on that form there, how hard can it be?”)

Thinking about scope: can you produce a flowchart outlining your current process, the process that you want a magical application to replace? If you can’t produce a flowchart, how do you expect other people to understand the start point, the processing and the end point? You can expect some help from your developer, programmer or system implementor when it comes to documenting your current workflow; equally you can expect some help from them when it comes to documenting your requirements. However, don’t turn to your developer, programmer or system implementor and tell them that you don’t have the time to document the requirements or document the workflow. If you don’t have time to tell us what you want in the first place, we know (from experience) that you’ll not have time to help us with user acceptance testing later on in the project – assuming we can build a system worthy of user acceptance testing in the absence of any real requirements.

All too often developers and IT departments have been getting it in the neck for project failures. However, little has been said about the fact that the blame really lies with those further up the project hierarchy. Failure to provide adequate work scope / definition results in confusion and the potential for large amounts of scrap and rework. Developers don’t mind throwing code away as a result of refactoring, however they do mind shelving code because it has suddenly become redundant or is now not part of the solution.

In a recent current project I was told “we don’t have time to write a specification”. However, we do have the time to overrun by many months and we do have the budget to fund the additional development and to cover the opportunities that are lost. With no end in sight, developer morale takes a hit, they lose direction. Similarly, there can be nothing worse for a developer to be on a project where s/he doesn’t know what they are meant to be doing? And worse, if they do find out what they are meant to be doing, to have it change from one week to the next. Or even to have it [the glimmer of hope, the taste of the requirement] change from day to day.

In the absence of a specification, feature creep is inevitable. Development cycles feel, and often are, endless. Even with an understanding and helpful client, the absence of a specification is a golden ticket for those who want everything from the system. Specification-less projects suffer from feature creep and work scope additions. All of the “nice to haves” suddenly come out of the woodwork. And because there’s little in the way of contractual documentation in place to lay down the law or draw the line in the sand, there’s nothing you can do apart from argue your case against adding features. The time you spend arguing your case, is time you’re not working on the project, you’re not progessing the project towards completion, the delay gets worse. Mind you, perhaps it’s a good thing that you’re not working on the project, after all, do you know what you’re meant to be doing?

Software development is a complicated process.  Unstructured and unproven time/budget “guesstimation” just doesn’t work in this industry.  You can’t say to software developer “two weeks” to write an enterprise class system that replicates the functionality of commercial of the shelf software costing many £000’s per license.  Two weeks is how long it might take you to cut’n’paste a spreadsheet together…it’s hardly long enough to develop all but the most simple functionality.  In the absence of a specification, database schemas are an ever-changing beast.  In most data-driven applications, the database schema is comparable to the foundations of a building.  The foundations are not something you want to change half way through the development.  Granted, clever people have written applications with dynamic database schemas…but they weren’t written in two weeks, or part thereof. 

After the database design, there’s the user interface.  Yes, it is easy to drop a button on a form!  What’s not so easy is what that button does when you click on it.  Anything beyond MessageBox.Show(“Hello, world!”); is where the time is spent.  I’m grateful to have seen multi-page specifications for the action behind a single button – if you can find somebody willing to invest the time and effort in writing such detail, the payoff is amazing. However, such people are few and far between. In today’s day and age, agile is where it’s at and user stories are King. Ultimately, it’s an emotive topic and one that I will not debate here (although you are free to discuss in the comments) – I don’t mind how you capture requirements, as long as you do.

Software developers struggle to work with “what’s in your head today”, knowing from experience that it will change tomorrow. Even in the agile world, there has to be an element of commitment: if you change your mind day after day, you’ll get a reputation and folks will end up using baseball bats to extract requirements. That’s not a good look, trust me on that. Oh, and don’t take the picture too literally: don’t do things on a handshake, that doesn’t work either: put something in writing, a contract, something that sets the scene and defines the lay of the land.

Requirements: however you document them – they are the light at the end of the tunnel for you and for the developer / development team. If your developer / development team ask you for “better requirements” very early in the project (or, shoot, even at the very start of the project), don’t dismiss it. Listen to them, they probably have a point. They are the folks who’ll be writing the software and they are the folks who’ll struggle to prepare a deliverable based on incomplete or inaccurate scribbles on whiteboard or sheets of paper.

Requirements: abuse them at your peril. In the absence of requirements, prepare yourself for a bottom-less pit that will consume time, money, other potential projects/opportunities and the morale of your development team.

Considered Reading

DDD9 – Agenda and Session Abstracts #DDD9

DeveloperDeveloperDeveloper 9 is being held on the 29th of January 2011 at Microsoft’s Thames Valley Park campus in Reading, UK. Registrations filled up within 12 minutes – I think the only way we could better that is by throwing more hardware at it.

Thanks to everybody who submitted sessions, voted and took part in the registration process. It is worth getting on the waitlist as it’s actively managed – folks that cancel free up their place for others, there’s a queuing system in place so you can keep track of your position.

I am pleased to see a mix of new and old (as in spoken at previous DDD events!) speakers! DDD is all about community, it’s about sharing your learning experiences with your peers. New speakers are the life-blood not just of DDD events, but of user groups. DDD audiences are tend to be forgiving, new speakers are given the break they need to hone their skills and go on to delivery that second killer presentation!

There are some great topics, including a some from respected authors. A few of the sessions have been run elsewhere, which tells us how good the speaker is and how topical the session is too.

There will be two guests making appearances: Barry Dorrans (author of Beginning ASP.NET Security) and Jon Skeet (author of C# In Depth and Real World Functional Programming)

In the interests of saving the planet and keeping costs down, it’s unlikely that we’ll have copies of the session abstracts available. If you need to, please print this information and take it with you to DDD9!

I will print the abstracts out and will stick copies on the doors to the respective rooms.

09:30 – 10:30
Go Asynchronous With C# 5.0 – Liam Westley
Anders Hejlsberg announced the Visual Studio Async CTP at PDC 2010.

This CTP means you don’t need to create callback functions anymore and can write code in the same way as if it were synchronous. The compiler will do all of the heavy lifting for you.

public async void GetDDD9Sessions()
{
var ddd = “http://ddd.com/ddd9/Sessions.aspx”;

var sessions = await new WebClient().GetSessionsAsync(new Uri(ddd));
}

In this session we’ll see how the GetDDD9Sessions method works and why it allows you to make a pot of tea while it runs.

More info on the Visual Studio Async CTP, including download details at:
http://blogs.msdn.com/b/csharpfaq/archive/2010/10/28/async.aspx

.Net Collections Deep Dive – Gary Short
The .Net framework provides a rich set of collection classes, but how much do you really know about them? In this presentation we’ll take a deep dive into the .Net 4.0 collection classes and examine which are best for what scenario and why. By the end of the presentation, you’ll no longer be happy just reaching for the same old collection you always had before. Instead, you’ll be armed with the information required to pick the best collection for your needs.

Functional Programming in C# – Oliver Sturm
C# introduced a number of language features that finally make it very easy to employ a functional style of programming. However, from the perspective of an imperative programmer, there are lots of questions surrounding functional programming. Why would I want to do it at all? Should I drop all state information in my apps? What useful functional patterns are applicable to C#? This session uses many practical examples and some theory to answer these questions, and it requires a good understanding of C# 3.0 language features.

AJAX with jQuery – George Adamson
Getting started on AJAX with jQuery:
We’ll hurtle straight into using jQuery to handle your AJAX; Rummage about in code, ‘hijaxing’ links and doing fashionable things like Progressive Enhancement; JSON and JSONP; solutions to get around the ‘Same Domain Policy’. We’ll work through a bunch of examples to POST and GET data from various sources. If there’s time we’ll explore more of jQuery’s AJAX methods and events and maybe even look at live ajax event handling in large single-page apps.

George’s presentation style is entertaining and leaps along at quite a rate. (If you’ve attended George’s Get Going with JQuery session then you have an idea what you’re in for.) There will be a few minutes’ refresher on jQuery basics then it’s non-stop AJAX. Some experience with JavaScript will help but if your world is C# and curly brackets then I’m sure you’ll be as happy as a pig in, er, shift+]

10:40 – 11:40
Monads! What are they and why should I care? – Mike Hadlow
Or: How to bend Linq syntax to your will.

These days, monads are the “celebrities of programming language theory”. But they also inspire fear in the hearts of lowly imperative programmers like myself. However they are a very useful and powerful abstraction and they pop up everywhere. C#’s Linq syntax is Monadic, for example. Having an understanding of Monads will give you the conceptual tools to greatly simplify many programming challenges, from dealing with nulls and managing state, to asynchronous programming and parsing. This talk will be mostly C#, but I will also be introducing a little F# and even some Haskell.

Real World Application Development with NHibernate, FluentNHibernate and Castle Windsor – Chris Canal
In this session we will look at how we can use a number of popular .Net OSS projects to develop a real world application. Based on production code, we will look at how using a combination of NHibernate, FluentNHibernate, Castle Windsor and a number of other OSS (AutoMapper, MvcContrib, FluentMvc) to reduce the friction of application development and remove a lot of infrastructural concerns. We will explore how we can leverage these tools to drive a convention based development experience and make it easier for ourselves and team mates to write applications and deliver what the client wants.

CQRS, Fad or Future? – Ian Cooper
Command-Query-Responsibility-Seperation (CQRS) is the new ‘hotness’ but beyond a desire to use the latest ‘fad’ what might actually lead you to adopt this approach over a conventional layered architecture. We will look at the business drivers behind command and query separation as well as a technique known as event sourcing. We will also look at steps to begin moving your application to CQRS

Rewriting software is the single worst mistake you can make – apparently – Phil Collins
Joel Spolsky once said that rewriting software from scratch is the single worst strategic mistake a software development company can ever make.[1] We all know of the Netscape story and the never-released v5.0. So as a developer how do you react when you’re faced with the fact that there is little other choice than do exactly what you’re told you should never do.

During this session I will describe how as a team we are managing to beat the odds and rewrite our main flagship product from a legacy platform into VB.net; as well as describing the decisions behind the choice of language, the choice of development methodology, how we built the project plan, how we learnt from our mistakes and our successes, how working with Bournemouth University and their study of our rewrite has helped us, and whether or not we still think it’s something you should never do.

[1] Joel Spolsky, Things You Should Never Do, Part I
http://www.joelonsoftware.com/articles/fog0000000069.html

12:00 – 13:00
A Primer to RavenDB – Rob Ashton
RavenDB is a relatively new document database written by Ayende Rahien as an open source .NET project.

This is quite exciting as it means a focus on being able to talk to a document database with your chosen .NET language and support for writing custom map/reduce functions in your chosen .NET language too.

This means up front queries written using familiar LINQ syntax, and the ability to write plug-ins for RavenDB in a familiar environment.

In this session, I aim to give an introduction as to what RavenDB is, how to use it, and give a brief comparison to the other popular NoSQL projects that have appeared on the .NET scene in recent times.

Functional Alchemy: Tricks to keep your C# DRY – Mark Rendle
C# 3.0 and LINQ have made anonymous delegates and closures a hot topic. C# 4.0 improves on them. But these “functional” features have applications beyond messing about with IEnumerable. In this session I’ll present 10 simple and not-so-simple uses of first-class functions to help cut down on repeated code and improve maintainability; hopefully you’ll discover a new and exciting way of approaching coding problems.

The main thrust of it is that F# is cool and groovy but there’s a lot of mileage in functional-style programming in C#, which people are using every day, so let’s look at some cool examples there.

Learning from the HTML5 Boilerplate – Dan Maharry
The best place to start your development is on solid foundations and in the web world, that means with a sound knowledge and understanding of HTML and script and those little browser quirks and tweaks which mean you can wrestle the best performance once server-side code has done its job. This session looks at the HTML5 Boilerplate project, the tips and tricks we can learn from it (cross-browser normalization, performance optimizations, even optional features like cross-domain Ajax and Flash) and suggests some additions we can add to it on the server-side.

Writing Maintainable Tests for Selenium – David Burns
Selenium is one of the most widely used testing frameworks in the world. It has great support for driving a wide range of browsers and writing tests for it is extremely easy. People with little to no Selenium experience can write/record tests with little to no effort.

It can be very easy to write brittle or hard to maintain tests – simple UI changes can require large amounts of work on the tests.

Imagine that you have 1000 tests and all your tests require you to login before completing a bit of work.

If someone on your team changes the ID of the username text box and all your tests will start failing.

Updating 1000 tests is going to be a lengthy, tedious process – something that you would want to avoid!

This talk will show how to create maintainable Selenium tests using the Page Object Model, with the goal of allowing even non-technical members of the team to be able to write new tests.

14:00 – 15:00
What’s New In ASP.NET MVC 2.0 and 3.0 – Andy Gibson
ASP.NET MVC has been making waves over the past 2 years within the ASP.NET community and quite rightly so with features such as promoting separation of concerns, strongly typed views and a great routing system but it doesn’t stop there. ASP.NET MVC 2.0 is now publicly available and is also being shipped with Visual Studio 2010 and hot on its heels is version 3.0 which adds Microsoft’s new Razor view engine to the mix. But what new features have been brought to the table? What has changed? And most importantly, how will you be affected by upgrading from 1.0 or even 2.0?

This session will bring you up to speed with all the information you need to know delivered through slides and more interestingly, live demos. Topics covered include (but not limited to)
– Razor
– Model-Validator Providers
– Optional URL Parameters
– Template / HTML Helper improvements
– Improved Dependency Injection / Inversion of Control integration
– NuGet Package Manager
– Additions and updates to MVC Attributes
– Visual Studio integration improvements
– Breaking changes from MVC 1.0/2.0
– Pros and cons to MVC
– To upgrade or not to upgrade (or simply, Advice)

We will look at features brought in by both v2.0 and v3.0 of the MVC framework and provides a good source of information for those looking to learn more or to upgrade existing projects.

Is your code S.O.L.I.D ? – Nathan Gloyn
Everybody keeps on about SOLID priniciples but what are they? and why should you care?

In this session I’ll aim to walk through each prinicple telling you about that prinicple and examing why you should use it.

Once we’ve talked about the principle in theory we’ll look to how we can put it into practice.

Behavioural Driven Development (BDD) with F# – Phillip Trelford
BDD is an Agile methodology that aims to get business and development folks collaborating.
F# is the powerful new programming language from Microsoft bundled with Visual Studio 2010.
Use both to test your .Net code for fun and profit!

Scenario: Deliver customer value
Given collobaration with customers to produce user stories and acceptance tests
And some awesome .Net code
When a BDD framework that executes plain text specifications like SpecFlow or TickSpec
And F# to write the tests
Then profit!

Writing tests with F# is a great way to learn the language, this talk will take you through common steps with live code examples.

Computer, earl grey tea, hot – John Price
Ok, so this is a little more difficult to arrange with home automation, but controlling lights, heating, curtains and just about every other device in your house just by talking to it, is actually Science Fact. Take a tour around our automated house and see whats possible with a little effort.

15:10 – 16:10
CSS is code, how do we avoid the usual code problems? – Helen Emerson
CSS has a lot of the same problems that application code has but none of the language features that help us keep out of trouble. Start writing anything complicated and you end up with problems like dependencies, cohesiveness and creating the right abstractions. It’s pretty easy to end up with CSS that is impossible to predict unless you understand it all. I’m going to tell the tale of my team’s journey to write CSS that is flexible, easy to understand and easy to change.

From .NET to Rails, A Developer’s Story – Colin Gemmell
In May 2010 I changed jobs, leaving the land of .NET to the world of Ruby on Rails. In this talk I will go over what I found easy, hard or just completely misunderstood when starting with Ruby and Rails. While focusing on my experiences we will also look at the differences between .NET development and Ruby development.

Expression Blend for WPF and Silverlight Developers- Sam Bourton
Not many WPF/Silverlight developers are using Expression Blend yet; but those that are, couldn’t do without it…

In this fast-paced talk and demonstration I will be showing how to use Blend in your everyday design and development tasks to rapidly create visually engaging User Interfaces and controls, and dramatically increase your productivity in building WPF/Silverlight front-ends.

We will cover real-world practical tasks such as: How to use the Blend environment, access key functionality, and use the different types of controls; Create and manage Resources and resource dictionaries within Blend; Create, edit, and apply Styles and Control Templates to different controls; Bind controls to sample and runtime ViewModel data and Commands; Make your applications stand out with Animations, Visual States, Effects, Fluid Layouts, and Behaviors; and some random tips and techniques I’ve learnt along the way.

While the presentation is targeted at developers with WPF/Silverlight experience who have not yet gotten to grips with Blend, if you’re new to WPF/SL it will be a great introduction, and if you’re familiar with Blend already then hopefully you will pick up something new.

Enforcing Code ‘Beauty’ With StyleCop – Guy Smith-Ferrier
n May 2008 Microsoft released StyleCop. StyleCop does for C# source code what FxCop does for assemblies – it applies ‘good practice’ rules to your source code. This means all those controversial code beauty issues like spaces, where to put curly braces, how and when to use blank lines and over 150 similar rules. This session gets you started using StyleCop, investigates a selection of rules, shows how to integrate StyleCop into Visual Studio and your build process and finally shows how to write your own custom rules. This is a low tech session on an essential tool that all C# developers should be using.

16:20 – 17:20
Beginners Guide To Continuous Integration – Paul Stack
As developers who work in a team, we need to continually make sure that code we check in to source control works integrates with our existing code. In order to do this we need to get feedback from user check ins. If we don’t test code integration how do we know that our code still works?
CI processes and CI tools can help us to do this in an effective way. In this session I will cover

  • Benefits of CI
  • Different types of CI tools
  • Tips on choosing the right CI tool
  • CI as a form of feedback to development teams
  • CI as a tool for release preparation

Developing Windows Phone 7 Applications using Silverlight – Kris Athi
This session will look at using Silverlight as your weapon of choice to target the Windows Phone 7 platform. This session will focus more on the platform specifics including:

  • Theming
  • Input & Navigation
  • Push Notifications
  • Location Service
  • Connected Apps (WCF)
  • Lifecycle (Tombstoning etc)
  • Launchers, Choosers

We will also take a look at how to architect an application using the MVVM design pattern.

Introduction to PowerShell – James Boother
So you’ve heard SysAdmins and DBAs discuss PowerShell but you’re not sure what it is or how to use it. Powershell is a powerful scripting engine that can be used to automate admin tasks making more efficient use of your time. This session will introduce Powershell so that you can add it to your toolbelt. I’ll discuss some general admin tasks that can easily be automated with PowerShell and look at some developer specific tasks that can benefit from PowerShell knowledge.

Mobile Panel – From iPhone to HTML 5 to Windows Phone 7 to Android – Chris Hardy
A mobile panel featuring some of the top mobile application developers in the UK. Should create some interesting discussions!

epicenter Open XML Slides and C# Code #ISS2010

On Tuesday 8th June 2010 I ran my Introduction to Open XML session at the Irish Software Show in Dublin.

My Slides and C# demo code are available for download!

I have updated the demos to use the Open XML SDK 2 RTM and have provided a more advanced example of the Content Controls demo. Remember, you can view the original Content Control demo here.

Photos from the event (day 1) can be found here: http://www.flickr.com/photos/craigmurphy/sets/72157624106633205/

Pre-order Visual Studio 2010! #VSPreorder

Microsoft Visual Studio 2010 Professional will launch on April 12 but you can beat the rush and secure your copy today by pre-ordering at the affordable estimated retail price of £484.99.

If you use a previous version of Visual Studio or any other development tool then you are eligible for this upgrade. Along with all the great new features in Visual Studio 2010 (see www.microsoft.com/visualstudio) Visual Studio 2010 Professional includes a 12-month MSDN Essentials subscription which gives you access to core Microsoft platforms: Windows 7 Ultimate, Windows Server 2008 R2 Enterprise, and Microsoft SQL Server 2008 R2 Datacenter.

Visit http://www.microsoft.com/visualstudio/en-gb/pre-order-visual-studio-2010 to check out all the new features and sign up for this great offer.

Book: Introducing .NET 4.0: With Visual Studio 2010 by @alexjmackey

Introducing .NET 4.0: With Visual Studio 2010 is a book that many day-to-day developers will benefit from. It provides a great overview of what’s new in .NET 4.0 and Visual Studio 2010 – an obvious statement I know, however what sets this book apart is the fact that it makes reference to the new 4.0 content with references to both the earlier 3.5, 2.0 and 1.1 material. You’ll also find that the author chooses to refer to the Microsoft Developer Network (MSDN) documentation using URLs as opposed to either copying the information verbatim or paraphrasing it some way: a refreshing change. This means that for much of this book, you are presented with straight-to-the-point information about the highs, the lows and the gotchas to look out for when you are building applications using Visual Studio 2010 and the .NET 4.0 platform. If you need a book that covers the salient technical points without going into huge amounts of detail, this is the book for you.

Alex is an experienced developer, he discusses his own personal experiences with many of the .NET 4.0 technologies, providing us with an insight into their history, their strengths and weaknesses – it’s all valuable content that can be hard to source elsewhere. And what’s more, given that this is Alex’s first book, he has done a terrific job: his writing style is contemporary, elegant and is easy to read.

Why should I buy this book?
Don’t be put off by the use of “Introducing” in this book’s title. It’s a book all developers should buy, from beginners to seasoned professionals. Beginners will benefit from the coverage of features, Alex essentially provides a roadmap of the things you need to look at in .NET 4.0 in order to gain the most benefit.

What’s in it for me? What’s this “roadmap” you mention?
Alex covers all of the bases with chapters about the following topics: Visual Studio IDE and MEF, Languages and Dynamic Changes, CLR and BCL Changes, Parallel, Workflow Foundation 4, Windows Communication Foundation, Entity Framework, WCF Data Services, ASP.NET, Microsoft AJAX Library, jQuery, ASP.NET MVC, Silverlight Overview,WPF 4 and Silverlight 3 and Azure. This should provide you with a one-stop shop regarding the current .NET 4.0 technologies and tools: a great resource, especially for newbies, those developers moving to .NET 4.0 from the Java world, etc. and experienced developers looking to make use of new material in their applications.

One of the most common questions I get asked at developer events is “how do I get to know .NET?” – this book is a great source of up-to-date information, “newbies” and those moving to .NET 4.0 from other platforms should rush out and buy this book. Seasoned developers will enjoy the to-the-point writing style, the short code examples and the author’s reach out to “subject matter” experts from the field – if you need to know more, the links are there for newbies and long-in-the-tooth developers!

This book sits nicely in between Pro C# 2010 And The .NET 4.0 Platform 5th Edition by Andrew Troelsen (Hardcover – 3 Mar 2010) and Pro ASP.NET 4.0 In C# 2010 4th Edition by Matthew MacDonald (Paperback – 3 Mar 2010). Alex’s book provides all the groundwork you’ll need in order to be able to tackle the works of Troelsen and MacDonald – Alex’s book is available now!

What are you waiting for? Visual Studio 2010 will be released in a few months time! Get ahead now, buy this book, you won’t regret it!

Further links
Alex’s web-site
The APress web page for Alex’s book

Programming Challenge – Original Pascal Submission

Earlier this week I set a Programming Challenge using an example from my first year in academia. So far it has attracted 60 or so comments and solutions!

I’m particularly impressed with the range of languages that have been used.

Regular day-to-day offerings in C# are there, C# with LINQ, PowerShell and VBScript. “Vanilla” C, C++, Perl, Ruby and Python aren’t left out; neither are Smalltalk, Haskall, Lisp, clojure, Scala, F#, T-SQL, Informix SQL, SyBase SQL, APL, APL2 and A+. 6502 machine code and Excel are in the submission pot to – extreme diamond plotting!

There are even submissions in Octave and J (references here and here)!

I’ve had offers of solutions in JavaScript and jQuery, hopefully they’ll arrive soon!

I haven’t verified it yet, but here’s one of the J solutions, stunningly terse:

It is written in Iverson’s J programming language.

3 :'(],|.@}:)(|.@}.”_1,.])(AB{~i.Y)(_2<\2#i.Y)}'' ''$~2#Y=.>:y(=i.1:)AB=.a.{~65+i.26′”0

by Tracy Harms

That won me “most cryptic” tweet from Stuart!

Naturally I’m pleased, I wasn’t expecting it to be so popular! Huge thanks to all involved so far!

For the sake of completion, I’ve scanned in the original Pascal submission. Here it is:

Oh dear: notice the scandalous indentation after the FOR loop. Cringe.

If I was to write a C# version of the Pascal code, I might end up with something similar to this:


using System;

namespace diamond
{
class Program
{
static void Main(string[] args)
{
char widest_char;
int next_char, finish_char, wide, range, direction, position, spacelength, loop;

widest_char = Console.ReadKey().KeyChar;
Console.WriteLine();

wide = (int)widest_char;
direction = 1;
spacelength = 1;
position = 1;

next_char = 66;
finish_char = 65;

range = 2 * (wide - finish_char);

// Calculate initial left indent
int mid = wide - 65 + 1;

String firstLetter = Char.ToString((char)finish_char);
firstLetter=firstLetter.PadLeft(mid+1);
Console.WriteLine(firstLetter);

for (loop = 1; loop < range; loop++) { Console.Write(" ".PadLeft(mid - position)); Console.Write((char)next_char); Console.Write(" ".PadLeft(spacelength)); Console.WriteLine((char)next_char); next_char = next_char + (1 * direction); position = position + (1 * direction); spacelength = spacelength + (2 * direction); // Flip direction when the middle of the diamond is reached if (next_char == wide) direction = -1; } Console.WriteLine(firstLetter); Console.ReadLine(); } } }

Back in 1988, I was reasonably pleased with the Pascal solution. Looking at it now, there are a few things I'd probably change, however hindsight with experience is a wonderful thing.

I can't remember how long it took me to write the Pascal version, probably not very long as I had prototyped the solution using BBC Basic V - a programming language that I had been using since I was 13...some five years before I set eyes on the diamond plotter task! I can't recall exactly, but I'm reasonably sure that the BBC Basic version took me about an hour to get working...

Of course, throwing readability, etc. out of the window, were I thinking about writing a similar solution today in 2009, I might find myself writing something similar to this:


using System;

namespace ConsoleApplication5
{
class Program
{
static void Main()
{
int range = Console.ReadKey().KeyChar - 65;
Console.Clear();

Console.WriteLine(String.Format("{0}A", "".PadLeft(range)));
int r = 1, dir = 1;
while ((r > 0) && (range>0))
{
char c = Convert.ToChar(r + 65);
Console.WriteLine(String.Format("{0}{1}{2}{3}", "".PadLeft(range - r),
c, "".PadLeft(r + (r - 1)), c));
if (r == range) dir = -1;
r = r + dir;
}
Console.WriteLine(String.Format("{0}A", "".PadLeft(range)));

Console.ReadKey();
}
}
}

How long did it take me to write a solution today? 30 minutes. 10 minutes of which were spent strangely refactoring for fewer lines of code and terseness. It was interesting writing this version, readability and ability to follow the work-flow came through in the initial version. Then the desire to strip it back to the very basics caught up with me. It's still not perfect, but it does the job. That said, I'm not sure my original Pascal tutor would be hugely happy with it! C'est la vie!

I'll write another post that brings together all the submissions that I've received so far - keep them coming!

Programming Challenge!

Twenty years ago, during my first year in academia, my Pascal tutor set us some top-notch assignments.

Your mission:

Write a program which draws a diamond of the form illustrated below. The letter which is to appear at the widest point of the figure (E in the example) is to be specified as input data.

Here’s a scan of the original hand-out:

My original Pascal solution, which I prototyped using BBC Basic V, took less than a page of fan-fold listing paper and was implemented as a console application. 50% of the listing dealt with input validation and “do you want to run the program again?” code! I will convert the example line-by-line into C# for later publication here! Of course, were I to write it today, it should look very different!

I’d be keen to see your solutions, written in your choice of programming language. Novelty value for uniqueness in your choice of programming language may well be rewarded! Procedural, object-oriented, functional, dynamic, verbose, terse…the choice is yours!

“What’s in it for me?” you might ask?
Well, nothing really, a bit of kudos and the feeling of a job well done! However, I will offer the two best/novel UK-based solutions a much-coveted DDD polo shirt (modelled here!). My decision is final, colour may vary, size might not be the same size as you, yada yada, other legalese applies, etc.

Submission by comments here on this post, by e-mail (top right About Me), or via Twitter @camurphy please!

Over to you!

UPDATE: Comments seem to mangle the code formatting, it has been suggested that code is submitted either via e-mail or via http://pastebin.com/

C# Lists, updated to use LINQ

During 2006 I wrote a post about C# Lists. Of course, technology moves on, C# is no exception to that rule.

Whilst the examples I used in the 2006 blog entry still work today, LINQ heralds further levels of elegance and reduced the number of lines of code required to achieve the same results.

Here are the examples updated to use LINQ:

[code lang=”C#”]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
public class Person
{
public int age;
public string name;

public Person(int age, string name)
{
this.age = age;
this.name = name;
}
}

static void Main(string[] args)
{
Listpeople = new List();

people.Add(new Person(50, “Fred”));
people.Add(new Person(30, “John”));
people.Add(new Person(26, “Andrew”));
people.Add(new Person(24, “Xavier”));
people.Add(new Person(5, “Mark”));
people.Add(new Person(6, “Cameron”));

var unsorted = from p in people select p;
var sortedByAge = from p in people orderby p.age select p;
var theYoung = from p in people where p.age < 25 select p; var sortedByName = from p in people orderby p.name select p; foreach (var p1 in sortedByName) Console.WriteLine(string.Format("{0} {1}", p1.name,p1.age)); Console.ReadLine(); } } } [/code] On line 38, simply replace sortedByName with any of the other result sets. The use of LINQ in this simple example does demonstrate increased readability - the LINQ expressions are easier to understand than those present in the 2006 blog entry. If lines of code are your metric (and for some they are!), the LINQ version's conciseness does mean a reduction in the LOC count.

UK, London 20-24 April 2009: Windows OS Internals & Advanced Troubleshooting

What:
US MVP David Solomon is running a Windows OS Internals & Advanced Troubleshooting

When:
April 20th -24th

Where:
London, UK

Description:
A public offering of David Solomon Expert Seminar’s hands-on Windows OS Internals & Advanced Troubleshooting class is taking place in London on April 20-24. Gain a deep understanding of the internals of the core operating system components and how to leverage advanced troubleshooting tools to dig beneath the surface when things go wrong.

Registration:
The URL to register and for more details is http://solsem.com/london.html

Screencast – Word 2007 Content Controls

At the end of October 2008 I delivered an introductory presentation about the Open XML file formats and how we might use them from within C#, i.e. programmatically. Part of that presentation demonstrated the use of Word 2007 content controls and whilst it was the primary demonstration of the evening, it was one that prompted the most discussion. To that end, I have recorded an improved version of that demonstration, you can watch it here!

During this demonstration, I was using Visual Studio 2008 SP1, the Open XML SDK 2 CTP 1 and the Word 2007 Content Control Tookit.

I would recommend viewing this full-screen, double click on the video below to “go full-screen”. Pressing Escape cancels full-screen mode.

I recorded this screencast in one sitting, however during playback I noticed a minor issue with drag’n’drop inside the Word Content Control Toolkit. It wasn’t a show-stopper, however I decided to record the offending piece a second time – you may notice a slight change in background noise during that transition.

If you have any problems viewing the video below, please let me know.

Word 2007 Content Controls – demo from Craig Murphy on Vimeo.

Need the C# source code? Here you go: get the source.

Further Reading:
http://blogs.msdn.com/mikeormond/archive/2006/08/10/694173.aspx
http://msdn.microsoft.com/en-us/library/ms406053.aspx
http://blogs.msdn.com/modonovan/archive/2006/05/23/604704.aspx

Technorati Tags: , ,