SOLID

bruce johnson 1

This morning’s sessions in TechDays’ Developing for the Microsoft-Based Platform focuses on both the ASP.NET MVC web app framework and recommended object-oriented programming practices, namely the Model-View-Controller pattern with Colin Bowern’s presentation earlier this morning and now (at the time of this writing) the SOLID principles in Bruce Johnson’s session, SOLIDify Your ASP.NET MVC Applications.

Assless Chaps + Twitter = Business Opportunity

You might remember Bruce from the “Assless Chaps” story. The story can be summarized in the three tweets shown below.

First came Bruce’s response to my article about CodeCamp back in April, in which I forgot to mention the session he was doing:

lacanuck_tweet_1

I tweeted him back and then decided to throw in a jokey reply:

accordionguy_tweet_1

My thinking was: Hey, this is a conference of Microsoft developers! Yes, they’re a bright and talented bunch, and I like them, but they’re an older, corporate, more buttoned-down crowd. They’d never go for renaming a session from “Data Binding” to “Data Bondage”.

But Bruce and the Toronto Code Camp organizers surprised me – he changed the name of his session very quickly:

lacanuck_tweet_2

And since he responded to my challenge, I had to fulfill my end of the bargain:

assless_chaps_closeup

assless_chaps_behind

The “Assless Chaps” story doesn’t end there. Yesterday, while we were hanging out by the Windows 7 lounge and the “Assless Chaps” story came up. Bruce told me that our conversation on Twitter about the assless chaps actually landed his company, ObjectSharp, some business. A local developer got curious as to what the “assless chaps” business was all about in Bruce’s and my conversation on Twitter and the ensuing conversation got them talking about ObjectSharp’s services, which in turn became a contract.

The moral of the story: there’s actual business value in Twitter and assless chaps. I may have to go buy a pair (I rented the ones pictured above).

There’s a tamer version of this story in Canadian Developer Connection.

{ 0 comments }

Microsoft TechDays Canada 2009: 2 days - 7 cities - 5 tracks - 40 sessions - plus more!

In planning this year’s TechDays conference, we made some significant changes to the developer tracks: they were reformulated into:

  • A “tools and techniques” track, called Developer Fundamentals and Best Practices, for which my friend and fellow Developer Evangelist John Bristowe is the track lead
  • A “technologies” track, called Developing for the Microsoft-Based Platform, which I lead.

As the track lead for the Developing for the Microsoft-Based Platform track at TechDays Canada 2009 conference, I thought I’d take the time to talk about it and praise its virtues.

Designing the Track

Each track lead has the responsibility of designing his or her track. We pored over all the sessions from TechEd North America 2009, consulted with developers or IT pros for their opinions on what topic they’d like covered and came up with a selection of 8 sessions for each track.

When choosing my sessions, I kept these philosophies in mind:

  • TechDays is about current tools, technologies and techniques. That means talking about stuff you can get your hands on and use in production right now: Visual Studio 2008, .NET 3.5, SQL Server 2008, and so on. Visual Studio 2010, .NET 4.0 and Azure are fascinating tools and tech, but they’re not yet on the market, so they’re not in TechDays. We made a few exceptions for a couple of things that are coming out right around now: version 3.0 of Silverlight and the Expression suite and Windows 7.
  • TechDays is about giving the audience the biggest bang for the buck. It’s more than simply taking the content from the TechEd North America conference (which has a steep registration fee and you have to also factor in the costs of flying to and staying in New Orleans) and bringing it close to home with local speakers and a reasonable price tag. It’s also about choosing the content that best serves an an audience that uses Microsoft tools and tech in their day-to-day work. There’s no point in rehashing presentations that the audience has already seen a dozen times before, and neither does it do any good to cover topics that are interesting but impractical. I tried to strike a balance — in choosing the sessions for my track, I kept this question in mind: What sort of things will this audience be using that they aren’t using yet?
  • TechDays is more than just throwing random information at the audience. A track needs to be more than just a collection of sessions simply thrown together. It works best if it’s a set of sessions whose topics fit together to form a cohesive whole, almost as if telling a story. While picking out the track’s sessions and arranging them, I tried to set things up in such a way to best show the possibilities that open up when you develop on the Microsoft-based platform. 

The Developing for the Microsoft-Based Platform Track

The Developing for the Microsoft-Based Platform track breaks down into four topic areas, as shown in the diagram below:

platform_track_chart

The topic areas are:

  1. Day 1 morning: Rich UIs
  2. Day 1 afternoon: Client Tech
  3. Day 2 morning: ASP.NET MVC
  4. Day 2 afternoon: Web Services

They’re explained in greater detail below.

Day 1 – Front End: User Interface and Experience

Day 1 of the Developing for the Microsoft-Based Platform is about building the front end, that layer of our applications with which the user interacts, and about giving the user the best experience possible.

The morning will be an introduction to the latest version – version 3 – of our rich interface technology Silverlight and our rich interface-building tool, Expression Blend. In the afternoon, we’ll shift the focus to building client technology by looking at the PRISM guidelines for building applications with modular Silverlight- and WPF-based front ends and the API code pack for building .NET applications that take advantage of Windows 7’s new UI features.

The tools and technologies covered on Day 1 are:

  • Silverlight 3
  • Expression Blend 3
  • WPF
  • Windows 7
  • Windows 7 API Code Pack for the .NET Framework
  • Windows Mobile

Day 1 Morning: Rich UIs

Track Introduction
Presented by Joey deVilla
9:00 a.m. – 9:15 a,m.


Session 1: What’s New in Silverlight 3
Presented by Cory Fowler
9:15 a.m. – 10:30 a.m.
Cory Fowler Rich internet applications just got richer! Silverlight 3 is packed with new features and improvements that your users will notice, from pixel shaders to perspective 3D to animation enhancements to bitmap APIs to HD video. We think you’ll also be impressed by the features for developers, such as the updated style model, data binding improvements, better resource handling, and a tuned-up Web services stack. In this session, we’ll explore new features of Silverlight 3 as we build a Silverlight-based application using Expression Blend 3 and Visual Studio.

Session 2: Expression Blend for Developers
Presented by Barry Gervin
10:50 a.m. = 12:05 a.m.
Barry Gervin Not a designer? Overwhelmed by Expression Blend? Not a problem! We’ll show you how to use Expression Blend to create advanced and polished user interfaces for business applications, consumer applications, multimedia projects, games or anything in between. We’ll cover features of Expression Blend from a developer’s perspective and show how it works in tandem with Visual Studio throughout the development process. You’ll learn how to create professional-looking user interfaces and visual elements – even if you don’t think of yourself as an interface designer.

Day One Afternoon: Client Tech

Session 3: Building Modular Applications Using Silverlight and WPF
Presented by Rob Burke
1:10 p.m. – 2:25 p.m.
Rob Burke How do you build extensible and maintainable line-of-business applications in Silverlight and Windows Presentation Foundation (WPF)? How do you design and code to handle real-world complexity? Composite Application Guidance (a.k.a. "PRISM") offers guidance, libraries and examples – in small, free-standing, digestible chunks – that you can use to build applications with rich user interfaces that are also easier to maintain and extend. You’ll learn how to compose complex UIs from simpler views, integrate loosely coupled components with "EventAggregator" and "Commands", develop independent modules that can be loaded dynamically, and share code between Silverlight and WPF clients.

Session 4: Optimizing Your Apps for the Windows 7 User Experience
Presented by Anthony Vranic
2:45 p.m. – 4:00 p.m.
Anthony Vranic This session will show you the Windows 7 APIs that will let your applications – and your users – get the full Windows 7 experience. Learn about new extensibility methods to surface your application’s key tasks. Discover how enhancements to the taskbar, Start Menu, thumbnails, desktop elements, the Scenic Ribbon, Federated Search and Internet Explorer 8 provide new ways for you to delight your users and help make them more productive. If you want to give your users the best Windows 7 experience, this session is for you!

Bonus Session: Taking Your Application on the Road with Windows Mobile® Software
Presented by Mark Arteaga and Anthony Bartolo
4:20 p.m. – 5:30 p.m.

Mark Arteaga and Anthony Bartolo As a developer of .NET-based applications, you can extend your desktop software to the Windows Mobile-based platform using the tools available within Visual Studio®, the Windows Mobile SDK and the .NET Compact Framework. This session will give you an overview of how Windows Mobile lets you use your existing infrastructure, business logic, and desktop code on a mobile device to innovate and help solve business problems. We’ll show you how to use the familiar Microsoft .NET Framework and .NET-based programming languages like Visual C#® development tool. You will also learn about new features in Windows Mobile 6.5 such as the Gesture APIs and the Widget Framework and how to use them appropriately. With the launch of Windows Marketplace for Mobile upon us, this session will help you take the next step for application testing and submission.

Day 2 – Back End: Programming Frameworks and Principles

On Day 2, the track moves to the back end, focusing on server-side programming tools and technologies, and even wandering into the area of technique.

The morning’s sessions concern themselves with the new option for developing web applications using ASP.NET: ASP.NET MVC, the alternative framework based on the Model-View-Controller pattern, in the same spirit of such frameworks as Ruby on Rails, Django and CakePHP. The afternoon will be about writing web services using various Microsoft technologies.

The tools, technologies and techniques covered on Day 2 are:

  • ASP.NET MVC
  • The SOLID principles of object-oriented design
  • WCF
  • REST (REpresentational State Transfer)
  • SharePoint

Day 2 Morning: ASP.NET MVC

Track Introduction
Presented by Joey deVilla
9:00 a.m. – 9:15 a,m.

Session 1: Introducing ASP.NET MVC
Presented by Colin Bowern
9:15 a.m. – 10:30 a.m. 
Colin Bowern You’ve probably heard the buzz about Model-View-Controller (MVC) web frameworks. They’re all the rage because they combine speed, simplicity, control…and fun. ASP.NET MVC is Microsoft’s MVC web framework, and in this session, we’ll talk about the MVC pattern, explain the ideas behind ASP.NET MVC and walk through the process of building an application using this new web framework. We’ll also cover several techniques to get the most out of ASP.NET MVC and deliver web applications quickly and with style.

Session 2: SOLIDify Your Microsoft ASP.NET MVC Applications
Presented by Bruce Johnson
10:50 a.m. – 12:05 a.m.
Bruce Johnson Object-oriented programming makes it easier to manage complexity, but only if you do it right. The five SOLID principles of class design (one for each letter) help ensure that you’re writing applications that are flexible, comprehensible and maintainable, and we’ll explain and explore them in this session. We’ll start with a brittle ASP.NET MVC application that’s badly in need of refactoring and fix it by applying the SOLID principles. This session is a good follow-up for Introducing ASP.NET MVC, but it’s also good for developers of ASP.NET MVC looking to improve their code – or even if you’re not planning to use ASP.NET MVC. The SOLID principles apply to programming in any object-oriented language or framework.

Day 2 Afternoon: Web Services


Session 3: Building RESTful Services with WCF
Presented by Bruce Johnson
1:10 p.m. – 2:25 p.m.
Bruce JohnsonREST (REpresentational State Transfer) is an architectural style for building services, and it’s the architectural style of the web. It’s been popular outside the world of Microsoft development for a long time, but it’s quickly becoming the de facto standard inside as well. Windows Communication Foundation (WCF) makes it simple to build RESTful web services, which are easy to use, simple and flexible. In this session, we’ll cover the basics of REST and the show you how to build REST-based, interoperable web services that can be accessed not just by Microsoft-based web and desktop applications, but anything that can communicate via HTTP from an Ajax client to a feed readers to mobile device to applications written using other languages and frameworks such as PHP, Python/Django or Ruby/Rails.

Session 4: Developing and Consuming Services for SharePoint
Presented by Reza Alirezaei
2:45 p.m. – 4:00 p.m.
Reza Alirezaei The world gets more service-oriented every day, and with that comes the demand to integrate all kinds of services, including those from SharePoint. This session introduces SharePoint as a developer platform and provides an overview of how you can build and deploy custom services with it. The focus will be on developing ASP.NET and Windows Communication Foundation services for SharePoint as well as building a Silverlight client to consume them.

This article also appears in Canadian Developer Connection.

{ 0 comments }

Barbara Liskov, Interviewed

by Joey deVilla on July 31, 2009

This article also appears in Canadian Developer Connection.

Barbara Liskov The Interview

Over at the IT Manager Connection blog, there’s an interview with Barbara Liskov, who is:

  • The Ford Professor of Engineering at MIT’s Electrical Engineering and Computer Science Department
  • An Institute Professor at MIT
  • The first woman in the United States to earn a Ph.D. in computer science
  • An ACM Turing Award Recipient for both 2008 and 2009
  • An IEEE John von Neumann Medial Recipient for 2004
  • An ACM and American Academy of Arts and Sciences Researcher
  • …and most relevant to us, the “Liskov” in the Liskov Substitution Principle, one of the five SOLID principles for object-oriented design.

In the interview, Barbara talks about winning “the Nobel Prize of computing”, her vision for computing, what got her interested in computers, the challenges that the field still presents to minorities, the work she’s done and her thoughts on up-and-coming tech. If you’d like to listen, here’s the MP3 of Stephen Ibaraki interviewing Barbara Liskov. Stephen also wrote an article containing an abbreviated transcript that appears in IT Manager Connection. Enjoy!

The Liskov Substitution Principle

Small Liskov Substitution Principle poster

In case you’ve forgotten (or perhaps never learned), the Liskov Substitution Principle is:

If for each object o1 of type S there is an object o2 of type T such that for all
programs P defined in terms of T, the behavior of P is unchanged when o1 is
substituted for o2 then S is a subtype of T.

Well, duh. Who didn’t know that?

Object guru Robert C. “Uncle Bob” Martin took this bit of math nerd-speak and paraphrased in a way making it somewhat easier to follow:

Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.

And because I’m nowhere near as smart as Uncle Bob, here’s the way I like to cover it:

If MySubclass is a subclass of MyClass, you should be able to replace instances of MyClass with MySubclass without breaking anything. Sort of like when they changed the actors who played "Darren" in Bewitched or "Becky" in Roseanne.

(Unlike Liskov or Martin, I don’t have to write academic papers, so I can get away with making references to old TV shows.)

As I mentioned earlier, I’ll be writing more about the SOLID principles. Watch this space!

{ 1 comment }

DimeCast.Net’s SOLID Screencasts

by Joey deVilla on July 17, 2009

This article also appears in Canadian Developer Connection.

Brick with the word "SOLID" beneath it

Following up on the previous article about the SOLID principles for object-oriented design, Steve Bohlen pointed me to a series of screencasts on DimeCasts.net covering each SOLID principle:

The screencasts are each about 12 minutes long, a perfect length for a “learning snack”.

{ 1 comment }

This article also appears in Canadian Developer Connection.

SOLID Seems to be Everywhere These Days

solid

Robert C. “Uncle Bob” Martin first gathered the object-oriented design principles that would eventually go under the acronym SOLID almost fifteen years ago, but the SOLID principles have been making the rounds lately.

Before I talk about the SOLID principles, let me show you where the concept has been popping up in the past few months…

SOLID at Conferences

At the Microsoft TechEd conference in May, Steve Smith gave a presentation on applying the SOLID principles to developing applications with the ASP.NET MVC framework. At around the same time, the GeeCon conference in Krakow, Poland had a couple of presentations on SOLID: Bruno Bossola gave a talk on the SOLID principles and  Lee Brandt gave a talk on spotting SOLID code “in the wild”.

SOLID at User Groups

A number of user groups have had recently presentations on SOLID, such as:

Stack Overflow on SOLID

SOLID was the topic of a recent argument that took place over a series of podcasts earlier this year:

SOLID in Blogs

SOLID has also been spotted in a number of blogs:

Will There be a Presentation on SOLID at TechDays Canada 2009?

Mmmmmmmaybe…

And Now, The Principles and Posters

The folks at LosTechies.com have created a series of Creative Commons-licenced posters that illustrate the SOLID principles. I took the posters, cleaned up the typography a little and posted them below under the same Creative Commons licence. Below each poster is an explanation of the corresponding SOLID principle. Enjoy!

Single Responsibility Principle

single_responsibility_principle

The “S” in SOLID is for Single Responsibility Principle, which states that every object should have a single responsibility and that all of its services should be aligned with that responsibility. “Responsibility” is defined as “a reason to change”, and Wikipedia does a pretty good job of explaining it:

As an example, consider a module that compiles and prints a report. Such a module can be changed for two reasons. First, the content of the report can change. Second, the format of the report can change. These two things change for very different causes; one substantive, and one cosmetic. The single responsibility principle says that these two aspects of the problem are really two separate responsibilities, and should therefore be in separate classes or modules. It would be a bad design to couple two things that change for different reasons at different times.

Open-Closed Principle

open-closed_principle

The “O” in SOLID is for Open-Closed Principle, which states that software entities – such as classes, modules, functions and so on – should be open for extension but closed for modification. The idea is that it’s often better to make changes to things like classes by adding to or building on top of them (using mechanisms like subclassing or polymorphism) rather than modifying their code.

Liskov Substitution Principle

liskov_substitution_principle

The “L” in SOLID is for Liskov Substitution Principle, which states that subclases should be substitutable for the classes from which they were derived. For example, if MySubclass is a subclass of MyClass, you should be able to replace MyClass with MySubclass without bunging up the program.

Interface Segregation Principle

interface_segregation_principle

The “I” in SOLID is for Interface Segregation Principle, which states that clients should not be forced to depend on methods they don’t use. If a class exposes so many members that those members can be broken down into groups that serve different clients that don’t use members from the other groups, you should think about exposing those member groups as separate interfaces.

dependency_inversion_principle

The “D” in SOLID is for Dependency Inversion Principle, which states that high-level modules shouldn’t depend on low-level modules, but both should depend on shared abstractions. In addition, abstractions should not depend on details – instead, details should depend on abstractions.

Bonus Reading Material on SOLID

In addition to the LosTechies.com posters, they’ve also produced a book covering the SOLID principles in detail. Go and download Pablo’’s Solid Software Development [1.4 MB PDF] now!

{ 11 comments }