Later today I’ll be speaking at the C# Corner 2022 .NET Conference. This is a 3-day FREE online conference with a great set of speakers. I’ve been really impressed with the quality of production and how the C# Corner team is really building a community with their articles, events and how they are encouraging people to get involved.

Slides | Sample Code

I’ll be speaking on unit testing strategies with my “Coding Naked – Unit Testing those hard to reach places” talk. I need to update the slides on SlideShare, these ones are a bit dated by now, if you watch the live steam or recording, you’ll see I’ve updated this talk quite a bit since I first put it together (in 2012!).

In addition to TDD fundamentals, I dig into a few strategies for better TDD and test coverage.

One area I address is working with extension methods. Extension methods can be hard to mock, or at least, they often get in the way. Extension methods that are “functionally pure” (input, output, no side effects) are pretty easy to unit test, the challenge are extension methods that return void, or that do a lot of work under the hood.

The three strategies I discuss for dealing with extension methods are:

  1. Wrapping Extensions with an Interface (my preferred approach)
  2. Mocking around Extension Methods (creates dev cognitive load, and leaky abstractions)
  3. Using Fakes, Pose or Isolator (I don’t recommend these)

You can download or fork the sample code on githuib.

One thing I recently added to the sample code, is a new method for mocking around a common extension method. The Microsoft.Logging.Extensions! I’m really glad that Microsoft has created a common logging interface. There are a lot of great .NET loggers.. but often moving from project to project the nuanced api differences can be really annoying. I’ve used the Common.Logging interface several times, but it never really took off the way I hoped it would. I think the Microsoft logging abstractions will have a much higher adoption. 🤞

Here’s the thing though. There is only 1 logging method in the Microsoft.Logg Interface, and you’ll likely never use it! Instead, you’ll end up using one of the many logging extension methods. So now you might try and mock around it since the source code is all available. This will lead you to a massive deep dive where you finally realize that all of the Microsoft Extensions, end up using a method call that takes an internal class as a parameter! Ugh. That makes it really hard to mock around!

That being said, MOQ recently added a parameter option for It.IsAnyType – huzzah! Adam Storr has a much more extensive write up on this challenge and the solution that he came up with (go read it!) to Mock Around the Microsoft Logging Abstractions. I extended his solution in my code, and am planning on publishing this as a reusable nuget package soon.

Happy Coding!

Detroit Code – 3 Days of Awesome.

July 7, 2017    Category: Blog, Events   1 Comment »

 

TL;DR:

Detroit.Code() is a 3 Day conference I’ll be giving two talks at in Detroit next week. You can register now and save 10% by using code CalebJenkins10

detroitcode

The rest..

Earlier this year I spoke twice at our internal Software Craftsmanship Community at Quicken Loans. Next week, I’ll be giving two more talks in Detroit. Coding Naked and Scaling Scrum.

I’m really looking forward to this “local” conference. It’s local for me since I started working in Detroit every day. Well, “in Detroit” is relative, my commute involves walking to my standing desk in Texas – more on that in a future post! OK, I really am excited to experience this conference. The speaker line up is amazing. The hardest part will be some of the time slots where there are way too many good speakers and topics I want to hear at the same time. Where else can you go spend a whole day learning about ASP.NET CORE directly from Microsoft’s Jeffrey Fritz or Do Architecture Kata’s with Ted Neward or spend a day learning directly from Ted X Speaker Christina Aldan? Seriously, here’s me trying to decide which session to attend in one slot

image

Too many good talks to decide.

The only thing that made this one easy to pick, is that one of them I have to be at..

image

You get the idea.. so much great content, learning, growing – mind stretching will be going on next week.

I’m also looking forward to seeing how the people from Amegala run a conference. They do a number of conferences that I’ve never been at before.

image

This feels like a notch up from a TechFest, but not quite at the VS Live sort of level. In other words: just perfect.

Quicken Loans

imageI should also mention how awesome it is to work for a company that not only gives time off for attending a speaking at conferences.. but actively encourages broader community participation. Not only is Quicken Loans officially sponsoring Detroit Code, 6 of the speakers are from QL, many of us are from out of town, and QL is paying for our travel and hotel for the week. Awesome!

  • Keith Elder – will be flying up from Mississippi, and is talking about the highly scalable encryption platform that we built and use at Quicken Loans
  • Mike Eaton – is giving two talks, one on Becoming a Remote Worker Pro, and other on making the transition from individual contributor to  Team Leader (Manager outside of QL)
  • Peter Ritchie – 2 talks: Introduction to Microsoft Service Fabric, and Moving Towards Elastic Scalability
  • Jason Follas -  2 talks: Bit Coin: What makes it secure, and Lightweight Pub/Sub for Web Applications using MQTT
  • Eric Helin – Adventures with TDD and Paired Programming

 

I’ll be giving two talks:

Coding Naked – Unit Testing those hard to reach places.

image

This is an updated version of this talk that I’ve given many times. The new version (updated slides coming soon) is much more focused on code examples and working through various scenarios that people run in to while at the same time delivering on the principles behind those examples to really help people get better at navigating the world of automated unit testing. Original slides: https://www.slideshare.net/calebjenkins/coding-naked

 

Scaling Scrum to the Enterprise

image

Scrum is awesome.. just incomplete. (by design) – this talk goes through some of the patterns and practices that we used to scale scrum at Sabre to help people increase their over all agility and deliver better software.

 

There’s still time to register.

The full day workshops are on Monday with the rest of the conference taking place Tuesday and Wednesday. If you use the discount code CalebJenkins10, you’ll save 10% off of your registration.

 

Hope to see you there!

image

Later this month, I’ll be speaking at the DFW Scrum – Technical Edition meetup in Dallas, TX. They meet at Improving Enterprises (some really nice new offices!) Come check it out! If you’ve seen this talk before, this is updated for 2017 and is much more focused on strategies for unit testing those hard to reach places. We’ll look at working with Mocks, Dependency Injection – and look at some strategies for testing statics and extension methods.

Here is the “official description”:

Code coverage with quality unit tests are your first line of defense to reducing technical debt, increasing code quality and accelerating your ability to change and adapt code (without breaking it) while continuing to add new features. Most TDD sessions focus on the easy to test areas of your code base that are almost never what you experience getting back to your desk. Come learn why TDD is not a fancy practice for the coding elite, but an understandable, obtainable and practical approach to delivering value for every developer, and how, when done properly, will increase communication and design between the business stake holders and developers.

We will focus on practical steps to moving towards & embracing TDD. We’ll overview the normal roadblocks that people typically run in to, and practical coding strategies to overcome those road blocks on your way to embracing a Test Driven Development lifestyle – make coding without tests as uncomfortable as coding (or camping) naked! From the author of Automated Unit Tests chapter in the Wrox Book “Real World .NET, C# and Silverlight – Indispensable Experience from 15 MVPs, we will learn:

  • Distinguish between the 4 major elements of automated unit tests. Code, Tests, Testing Framework and Test Runners and how they interact with each other to round out your engineering practices.
  • Discover how Mocking Frameworks and DI make your tests easier to read and write in everyday life.
  • Dig in to better ways to write and organize your tests so that they communicate intent, document your code for you and bridge the gap between development and business needs.
  • We’ll take a more specific look at those “hard to reach” places like the edges of your code, extension methods and other interesting scenarios

* everyone will leave their cloths on – it’s not that kind of talk!

I recently gave this talk at the internal Software Craftsmanship community for Quicken Loans in Detroit – and we all had a great time. If you’re not in Dallas, this is one of the talks I’ll be giving at Detroit Code in July.

rhino_
This week I had the privilege of leading a custom workshop for a team of developers in Fort Worth, TX. One of the topics that we covered was Writing Testable Code; specifically, we looked at the Model-View-Presenter (MVP) patterns, dependency injection and using RhinoMocks to pull it all together. The one catch was… this group of developers used Visual Basic.

I’ve never shied away from VB. In fact, VB6 with classic ASP is where I cut my programming teeth, and VB.NET was my first move to a true OO language. That being said, I work day in and day out with C#… I’m much more fluent there, and I realized that there were a ton of new features in VB that I wanted to cover that I wasn’t up to par with, fortunately I was able to call on my network of super smart friends and recruit/hire a fellow MVP’er to help me out for the day (thanks Cory for doing that 2 days after your wedding!)

One of the things that tripped me up was using Lambdas in VB. Lambdas are especially important if you are going to use a Mocking framework like RhinoMocks (which I do). Doing Lambdas in VB – especially when I was trying to raise an event from a mock – sort of tripped me up…

First – if you are working with Rhino Mocks, you should go have a look at the excellent Wiki. http://ayende.com/Wiki/Rhino+Mocks+3.5.ashx I find that a lot of people (read: I had) skip the “documentation” since RhinoMocks is so fluent and straight forward, but it’s definitely worth the read!

Second, if you’ve never raised an event in mock from your test in C# here’s the code:

viewMock.Raise(x => x.CalcShippingRequest += null, this, EventArgs.Empty);

and in VB:

Read the rest of this entry »



Search

Subscribe

Enter your email address: