An Epic Week of Development in Norway

tldr; NDC was amazing! I was a guest on .NET Rocks! My recorded sessions from NDC in Oslo, Norway are below. And I finally got to meet Uncle Bob!

I just had an amazing experience at my first ever international conference. I’m back from attending the Norwegian Developer Conference in Oslo, Norway. It was an exceptionally well run conference with a few features I’ve never seen before. One exceptional feature was the overflow room which allowed people to watch 8 concurrent sessions simultaneously! Great for those times when you can’t find a seat or you’re not sure which session to pick.

And I couldn’t have been more excited to finally meet one of my programming heroes, Uncle Bob Martin. We had a wonderful chat after his session and I thoroughly enjoyed getting to talk shop 1:1 with an author I’ve looked up to for so long. Thanks Bob!

I also got to see Scott Hanselman speak in person for the first time. Absolutely superb edutainment! And I got to meet Douglas Crockford and attend his excellent sessions as well!

.NET Rocks!

To top it all off, Carl and Richard from .NET Rocks invited me over for my first guest appearance on the show! I’ve enjoyed the show for years and was absolutely flattered to finally be invited to be a guest. They’re a lot of fun and two of the nicest guys one could hope to meet. The show was on Single Page Application Development and we dove into the unique challenges of SPA development in the automotive industry.

Give the .NET Rocks show a listen here!

Oh Yeah, I Spoke Too.

Finally, my sessions at NDC Oslo went great! It was standing room only in both the sessions. A full room just makes speaking that much more fun by adding that extra spark of energy.

Crowd

Videos from both the sessions I presented at NDC are now up on Vimeo.

This is a subset of my Pluralsight course. If you’ve seen the Becoming an Outlier course, you’ll find this contains some unique content, especially at the beginning. If you haven’t seen the course, this is really just a preview since it’s less than half the full course content.

And here’s the session we chatted about on .NET Rocks. This is a case study on the largest single-page application of my career. Many lessons were learned along the way!

In Summary…

There were some touchy points along the way…

But I’m not sure I’ve ever learned more at a conference. I’ll save my gushing on the amazing sessions I attended for a separate post. I feel so lucky to have been a part of it all!

The TDD Divide: Everyone is Right

I’ve been enjoying the back and forth regarding the Death of TDD on the interwebs. The intellectual volleying between “legalists” like Robert C. Martin (Uncle Bob) and “pragmatists” like David Heinemeier Hansson (DHH) is nothing short of fascinating. I have a tremendous amount of respect for both these gentlemen for different reasons, and I can see wisdom in each of their views.

DHH argues that an excessive fixation on unit testing has added indirection, abstraction, and conceptual overhead.

Don’t pervert your architecture in order to prematurely optimize for the performance characteristics of the mid-nineties. Embrace the awesome power of modern computers, and revel in the clarity of a code base unharmed by test-induced design damage.

Unit testing indeed isn’t free and, as DHH argues, provides questionable benefit to offset this cost. Yet he’s fixated on test speed being the reason that we code to an interface. I agree that fast integration tests that hit the database are much more practical in the age of SSDs and fast processors. However, speed isn’t the only reason coding to an interface has merit.

We also code to an interface so that:

  1. We can easily switch out the implementation behind the scenes
  2. We can agree on the interface and have two separate teams handle each side of the interaction independently and concurrently.
  3. We can abstract away an ugly DB schema or unreliable third party.
  4. We can write tests first and use them to help drive the design. Uncle Bob and Kent Beck see this as a core benefit. DHH sees this as test induced design damage.

I again see the wisdom of both sides. TDD has been shown to reduce bugs and improve design. Yet every abstraction has a cost and must be justified. The T in TDD is *more code*. Be pragmatic. The fact is, in many kinds of software, occasional bugs are an acceptable risk. When they occur, fix it and move on.

Uncle Bob is fixated on craftsmanship, perfection, and centralized control. His brand is cleanliness and professionalism. The idea that the era of unit testing could feasibly be replaced by automated integration testing is unsurprisingly viewed as illogical heresy to existing thought leaders in the space.

“It is difficult to get a man to understand something, when his salary depends on his not understanding it.” – Upton Sinclair

Of course, this quote cuts both ways. Some have accused DHH of declaring TDD dead merely because unit testing is hard to do in the very framework he created: Rails.

Bottom line

One important thing to keep in mind: Uncle Bob sells consulting. DHH sells software. It’s a common divide. Software “coaches” like Uncle Bob believe strongly in TDD and software craftsmanship because that’s their business. Software salespeople like Joel Spolsky, Jeff Atwood, and DHH believe in pragmatism and “good enough” because their goal isn’t perfection. It’s profit. So if you want to build the most beautiful, reliable, scalable software, listen to the consultant. If you want to build a profitable product, listen to the salespeople too.

The world is a messy place. Deadlines loom, team skills vary widely, and the impact of bugs varies greatly by industry. Ultimately, we write software to make money and solve problems. Tests are a tool that help us do both. Consider the context to determine which testing style fits for your project.

Uncle Bob is right. Quality matters. Separation of concerns and unit testing help assure the utmost quality, speed, and flexibility.

DHH is right. Sometimes the cost of unit tests exceed their benefit. Some of the benefit of automated testing can be achieved through automated integration testing instead.

My take: Search for the wisdom in both of these viewpoints so you can determine where unit testing has merit on your project.


What’s your take? Chime in via the comments below or on Reddit Programming. Like this article? Submit it to Hacker News

AngularJS: The De Facto Standard for SPA Development?

One year ago, I started a large Single Page Application (SPA) project. I spent a few weeks Googling and biting my nails, trying to choose between the various options for SPA development. I considered four leading players:

  1. Knockout with Durandal
  2. Ember
  3. Backbone with Marionette
  4. AngularJS

A year ago this felt like anyone’s race. I ended up selecting Knockout with Durandal for the project since the combination offered clear support for older versions of IE. I currently develop apps for automotive dealerships and they’re notoriously slow to upgrade browsers. I enjoyed the development process with Durandal and Knockout and don’t regret my decision. There’s certainly no way I could’ve pulled off such a rich, interactive UI with solely jQuery.

Yet in the last year I’ve watched the tide shift heavily toward AngularJS.

AngularJS, KnockoutJS, Ember, Backbone

Angular’s momentum has become clear at various conferences across the country. Perhaps the most obvious recent example was at FluentConf in San Francisco:

That’s a pretty striking contrast. Now given, one could argue high conference session counts are merely a sign that Angular is a lot more complicated! But there’s no denying Angular has massive momentum. Enough to settle into a long-term #1 spot on Pluralsight’s top 100 courses. Angular even recently spawned it’s own its own conference: ng-conf.

Today marked another huge landmark for the Angular project: Rob Eisenberg, Durandal’s creator and director, announced that Durandal is being merged with Angular. He quietly joined the Angular team a few months ago. And, going forward, there will be only maintenance releases for Durandal 2. So, Durandal’s upcoming convergence with Angular makes this basically a three horse race.

Only a few years ago JavaScript developers abandoned MooTools, Prototype, and various other frameworks to declare jQuery the de facto standard. And today, Angular has such a clear lead in inertia that I’m comfortable with this declaration:

Angular has become the de facto standard for SPA development.

Why Has Angular Become so Popular?

I see three simple reasons:

1. Google Support – Sure, Google has a long history of killing promising projects. Remember Wave and Reader? But they’re a corporate powerhouse which lends a great deal of credibility to the project. Tell your boss you want to use a free framework from Google. That’s an easy sell.

2. Integrated and Opinionated – I enjoy working with Durandal, but ultimately you must rely upon multiple technologies to create a complex SPA using Durandal including Knockout for binding, RequireJS for dependency management, and a promise library (I went with Q.js). Backbone takes a similar approach – it’s not very opinionated so developers are free to make many architectural decisions on their own or to pull in libraries like Marionnette.

In contrast, Angular is highly opinionated and offers a single integrated solution. It’s analogous to the Unix and Windows model. In Unix you perform complex tasks by piping commands. The composition of many small targeted applications provides great power and flexibility. But the masses gravitate toward opinionated and integrated solutions like Windows. Why? A simple psychological principal called the tyranny of choice. In short, abundant choice often leads to misery. It’s easier to accept a few things you dislike in Angular than to be overwhelmed with decisions in other less opinionated libraries and frameworks.

3. Testability Baked-in – The Angular team has gone to great lengths to assure that Angular apps are testable out of the box. Testing JavaScript is notoriously painful given its lack of native dependency management options and the constant temptation to interact directly with the DOM. Angular’s focus on dependency injection and testability is refreshing. It creates a “pit of success” for developers.

The Future is Evergreen

I still have concerns about Angular. One must ask why Google is making this play at all. I believe it’s the same reason they built Chrome: Angular is Google’s new lever to push the web forward. That said, I worry that Google will push too aggressively on browser standards, thereby making the framework a non-starter for unlucky developers who must support older browsers. It’s clear Google prefers to err on the side of forcing the web forward. I admire this mission, but hate to see the developers supporting legacy browsers left with few viable alternatives.

Framework developers are starting to embrace a new ideal: Soon only Evergreen browsers will be supported by modern frameworks like Angular. This term, coined by Paul Irish has a simple premise: Evergreen browsers auto update. Most of today’s current browsers are Evergreen including Chrome, Firefox, Safari, and IE10+. This trend is great news for web developers who will soon be able to enjoy the power of ECMAScript 6 and the shadow DOM with Web Components. But it means customers should be warned now. Select an auto-updating browser ASAP – The web is surging ahead and Google will use AngularJS to lead the charge.

Chime in on Hacker News, Reddit or in the comments below.

User Interface Framework Showdown: Bootstrap, Foundation, KendoUI, and jQueryUI

Standards might not be exciting, but man, they’re important. Without them everyone does their own thing, reinvents the wheel, and unnecessarily injects new frameworks into the system. Lately the importance of standards has become painfully obvious. In my current role, our app has been around since the days of ASP.NET 1.0, so it’s over a decade old in various spots. In that time it’s picked up over a half dozen data access frameworks! And the story with the user interface frameworks is even more fragmented:

Wow. And this list doesn’t even include the dozens of jQuery plugins that have been pulled in over the last few years like Fancybox, tablesorter, toastr, etc. So the question is, how do you pick one framework? And wait, is that even a practical goal these days? To do so, you obviously have to understand what each offers so you’re clear what you’re giving up.

Since our application is behind a login and requires a lot of rich interactions, we’re moving toward primarily client-side rendering via Knockout with Durandal. So to simplify this list, one important decision involves selecting a client-side UI framework. I pitted four leading client-side UI frameworks against one another for consideration: jQueryUI, KendoUI, Bootstrap 3, and Foundation 5. And yes, Foundation isn’t in the list above but is worth a look. Perhaps it checks all the boxes and can become the one new standard?

XKCD - https://xkcd.com/927/

Okay, fat chance. These all slice the market a little differently. You likely find it odd that I’m pitting jQueryUI and KendoUI against responsive CSS frameworks, but the fact is, as you can see below these four cover a lot of similar ground. I summarized their features in a table I compiled below. Unique attributes are highlighted in yellow.

  jQueryUI KendoUI Bootstrap Foundation
  1.10.4 2013.4.1324 3.1.1 5
Accordian / Panelbar x x x x
Autocomplete x x x  
Alerts   x x x
Badges     x  
Breadcrumbs     x x
Button x x x x
ButtonDropdown     x x
Calendar   x    
Color Animation x      
Colorpicker   x    
ComboBox   x    
DatePicker x x    
DateTimePicker   x    
Draggable x x    
DropDownList   x    
Editor   x    
Grid (paginated table)   x    
Icons x x x  
Joyride (guided tour)       x
Labels     x  
Lightbox       x
ListView   x    
Menu x x x x
MultiSelect   x    
NumericTextbox x x    
Pagination   x x x
Pills     x  
Position x      
ProgressBar x x x x
Scheduler   x    
Slider x x    
Splitter   x    
Rotator       x
Resizable x      
Selectable x      
Sortable x x    
Tabs x x x x
TimePicker   x    
Tooltip x x x x
TreeView   x    
Upload   x    
Validation   x   x
Window x x x x
       
 
  jQueryUI KendoUI Bootstrap Foundation
Other Features        
Themeable x x x  
Templatable x x
Knockout Compatable KO/jqueryUI KO-Kendo KO-bootstrap  
HTML Input styling   x x x
Grid System     x x
JS Size (minified) 223 276 28 75
CSS Size (in K) 31 81 97 106
Total size (in K) 254 357 125 181
Browser support IE7+ IE7+ IE8+ IE9+
Sass integration     x x
Support   Telerik   Zurb
Visual Studio Default     x  
Requires jQuery x x    
Fluid grid resizing       x
Dev team 8 core Telerik Open. 500+ Zurb. 15

Summary

Each framework has it’s merits. jQueryUI is easy to use and well documented, though it’s progress lately has been slower than the others. Bootstrap is lightweight and very popular. It has a rich plugin ecosystem that fills in many features that aren’t listed above. Kendo offers many powerful and unique features with a high level of polish. And it certainly should since it’s not free! Foundation is the only option with a fluid resizing grid, and it arguably offers the most compelling mobile first story. Which would you pick if you could only choose one? How does your team avoid ending up with a laundry list of UI frameworks?

Who Dictates Software Quality: Client or Coder?

A friend of mine brought up a common struggle for many software developers, particularly independent consultants:

How do you influence your clients to demand their apps have effective unit and integration test coverage? Quality is a tough sell because the customer doesn’t directly see it.

This struggle between quality and expediency is a common thread throughout any developer’s career. It’s a big reason why I was so excited to publish Architecting Applications for the Real World on Pluralsight. Once we learn best practices, it’s natural to have a desire to apply them everywhere. Yet once pressure is applied, developers tend to revert to the mode that they feel allows them to move fastest. And this commonly means temporarily ignoring clean coding practices and reducing or altogether eliminating efforts in automated testing. Yes, many feel TDD helps them move faster in the long run, yet a recent study by Microsoft found TDD added around 15-35% to the initial development timeline. Thus, like many architectural best practices, TDD is an investment up front for potential payoff later (in both improved design and enhanced agility down the road).

So how do we assure that there’s adequate time to build sufficient quality into the application? I see two approaches to consider:

  1. Developer dictates quality. Code at a level of quality that makes you feel comfortable, fulfilled, and professional. Don’t even broach the subject with the client. There’s no requirement that we expose decisions on such technical details to the customer, right?
  2. Customer dictates quality. Engage the customer in conversations about the current constraints and their impact on code quality. Attempt to sell them on the need for these best practices, the impacts of technical debt, and the cost/benefit ratio. Be flexible and ultimately let the customer make the call on the level of quality they desire.

While neither approach is universally applicable, I tend to choose #1. Why? They’re paying us to be professionals. And as professionals, we should analyze their situation and flex the quality of the implementation based on an assessment of their current and future needs. If I feel that means their timeline is unrealistic, then I discuss the need to flex the feature set or the timeline. I only hack something in to hit the date when I think that option is truly recommended for the client in their current situation.

Waitresses from Alice TV Series on Wikipedia

A Human Service Layer

Think about your job as a service layer. Yes, they’re all the rage these days because they provide a coarse grained, friendly, and reusable API. As developers, we provide a human service layer to our clients. Yes, we’re aware of the fine grained API and plethora of options that we’re working with behind the scenes. But that doesn’t mean we should expose all these choices to the client. They’d likely be both overwhelmed and annoyed. They’re paying us for our judgment.

If you consider other fields, there’s indeed a precedent for hiding information from clients. An architect won’t mention all the potential materials that could be utilized for a structure. She’ll consider the situation and recommend a short list that makes the most sense in that context. A doctor won’t enumerate every potential drug or surgical option to a patient. He’ll instead recommend a specific course of action based on his expertise. We know this to be true because patients often seek second opinions when they don’t like what they’re hearing from the doctor. We assume the doctor is hiding some options he feels aren’t advisable.

We are software professionals, so we know that quality is not an all or nothing decision. We should consider the client’s needs and select an approach that balances quality and expedience. And yes, this means the answer likely won’t be 100% or 0% test coverage. But make your decision based on context, and if the timeline doesn’t afford you the time to deliver at the quality you believe is merited for this project, then it’s not suddenly time to start silently reducing quality to hit a deadline. Instead, it’s time to talk about flexing features and deadlines. Reducing quality below your professional recommendation in order to hit a deadline is malpractice. An architect won’t risk public safety, the company’s future, or her reputation for the sake of a deadline. Neither should we.

How do you balance quality, cost, and timelines? Do you discuss options for quality such as automated testing with your clients? Chime in via the comments below or on Hacker News or Reddit.

Where Should an Architect Begin?

Imagine you’re dropped in a new position with no one there to help provide a smooth knowledge transition. It’s like being dropped right out of the sky. That’s exactly how a new software architect felt who reached out to me with this question:

You are brought on board as a software architect in a company with products in a totally foreign business domain (to you). You are told you are responsible for working with product lines X, Y, Z. Btw, here is the code base (TFS url). Kthxbai.

Ouch. That’s an intimidating place to start. Time to figure out how to eat the elephant a bite at a time.

One obvious starting point is documentation. Well, assuming the existing documentation that isn’t horribly out of date. But properly updated documentation is rarely the case. Much like out of date comments, stale documentation can tell dangerous lies and lead you in the wrong direction altogether. So avoid spending time reviewing any documentation alone. Having others there to vet existing documentation as you review it kills two birds with one stone. If it’s accurate, it shouldn’t take long to confirm. And if it’s a dusty mess, now’s the time to have the conversations necessary to get the house in order.

By Andrew Dupont at http://www.flickr.com/photos/savetheclocktower/172724622/

I would move on by reviewing the codebase at a high level. Where is it stored? What technologies are utilized? What skeletons are in the closet that are immediately obvious? But don’t spend too much time exploring on your own just yet. There’s a more profitable and enjoyable option: buy chicken wings and beer. Get your fellow geeks and business folk out of the office and start picking their brains in a casual atmosphere. Bring some paper so you can sketch down notes as you strive to understand and document the system.

To help drive your initial goals, consider the areas of the application that you seek to manage and improve as an architect:

  1. Security
  2. Reuse
  3. Duplication
  4. Separation of concerns
  5. Code quality
  6. Test coverage
  7. Build process
  8. Consistency
  9. Performance and scalability
  10. What do people love? Hate?

Prioritizing these areas will focus your conversations, questions, and any documentation you decide to generate. Sure, the problem is feeling like the domain you need to learn is too big. Having a standardized list of questions to ask helps drive discovery. However, consider exactly what actions you plan to take based on the answers. This will cut the fat on your list of questions and maximize the signal to noise ratio in conversations. Having a finite set of areas you seek to improve initially will focus conversations and lessen the pain of your initial learning curve.

There’s no easy answers when you’re trying to bootstrap in a situation like this. But organization and clear short-term goals combined with out of the office time to help gain the necessary candor can help make the transition process more profitable and enjoyable for all.

Lean Software Architecture: Focus On the Pain – Part 3 of 3

In previous parts of this series, we outlined a simple two step process for being a lean software architect:

  1. Build the simplest thing that could possibly work
  2. Focus on the pain

In part one of this series, we outlined some specific examples of complexities that today’s software architects may consider. And in part two of this series we defined some ground rules that help you determine if you’re building the simplest thing that could possibly work. In this final part, let’s discuss how to focus on the pain to determine when adding additional complexity to the system is justified.

Once you’ve selected the simplest thing that could possibly work, it’s time to start looking around for pain points. Perhaps you’re seeing redundant queries as the application grows or struggling with unit testing business logic due to tightly coupled data access. This is where abstracting data access into a separate layer can add value.

Hammering Thumb

Perhaps your presentation layer is getting bloated with excessive amounts of logic to handle the interactions among your business logic classes. At this point creating a service layer and migrating such code to this new layer can simplify your controllers. Waiting until this point avoids creating a service layer that may not be necessary or worthwhile.

Maybe your data access story has grown more complex, involving multiple databases and third party services that persist data. Abstracting data access to sit behind the repository pattern can hide this complexity behind a clean simple interface the application can leverage.

Real Craftsmen Consider the Options

Adding complexity is much like adding options on a car. There’s no best practice for selecting options. Automatic transmissions, sunroofs, and heated seats are useful to some and a total waste of money for others. They’re all useful in a certain context and their value thus lies in the eyes of the beholder. In both cars and software, the more options you check, the more money you have wrapped up. So be wary of a blind devotion to perceived “best practices” – it can lead to building more application than you need. Speculative architecture is risky for the same reason speculating in stocks is risky: The investment may sink or swim.

This discussion just scratches the surface of architectural considerations. To learn more about thinking pragmatically about software architecture, check out “Architecting Applications for the Real World in .NET” on Pluralsight.

Architecting Applications for the Real World in .NET