Jeremy Bytes

byte-sized chunks of .NET

Skip Navigation Links
 

Presentations


Introduction to Data Templates And Value Converters in Silverlight

Business applications are all about data, and laying out that data is critical to creating a good user experience. Silverlight has several tools, including Data Templates and Value Converters, that make this easier for the business developer to manage. By the time we're done, you will have a good understanding of the basics of both of these valuable tools.


Introduction to XAML: Don't Fear the Markup

Understanding XAML (eXtensible Application Markup Language) is a key to creating the latest .NET user experiences in WPF, Silverlight and Windows Phone. We will introduce the basic concepts around XAML and take a look at various features such as namespaces, elements, properties, events, attached properties and some basic layout. We’ll create a simple WPF / Silverlight application that covers these fundamentals. Although you will probably end up doing most of your UI design with a drag-and-drop tool such as Expression Blend, knowing the internals gives you a leg up in making the final tweaks to ensure an excellent user experience.

NOTE: This demo is available in both WPF and Silverlight versions. The same XAML features are covered in each environment.


Get Func<>-y: Delegates in .NET

Delegates are the gateway to functional programming. So let's understand delegates and how we can change the way we program by using functions as parameters, return values, variables, and properties. In addition, we'll see how the built-in delegate types (Func and Action) are waiting to make our lives easier. By looking at code, we'll see how delegates can add elegance, extensibility, and safety to our programming.


Keep Your UI Responsive with the BackgroundWorker Component

Long running processes are a user experience killer. How many times have you had an application "lock up" while trying to do some function? The BackgroundWorker component in .NET allows you to spawn those long running processes in the background and keep your WPF, Silverlight or WinForms user interfaces responsive. We'll take a look at the features of the BackgroundWorker in a WPF application including running a background process, updating the progress in the UI, and cancelling the process before it has completed.


Design Patterns: Not Just for Architects

Design patterns are not just for architects. In fact, you already use Design Patterns but probably don't know it. Observer, Facade, Iterator, Proxy - these are all patterns that allow us to better communicate our ideas with other developers. And once we understand the patterns, we can use solutions that people way smarter than us have already implemented. In this session, we'll take a look at several Gang of Four patterns that we regularly use without realizing it. Don't know who the Gang of Four is? Join us to find out.


Learn to Love Lambdas (and LINQ, Too!)

Lambda expressions in C# can be confusing the first time you walk up to them. But once you get to know them, you’ll see that they are a great addition to your toolbox. Used properly, they can add elegance and simplicity to your code. And some .NET constructs (such as LINQ) lend themselves to lambda expressions. In addition, lambdas let us scope our variables more appropriately with captured variables. We’ll take a look at how lambda expressions work and see them in action. We’ll also see how LINQ can help us move from imperative programming to declarative programming (a gateway to functional-style programming).


LINQ - It's Not Just for Databases

LINQ (Language Integrated Query) is mostly associated with Entity Framework and database access. But it can be used for much more. LINQ lets us sort, filter, and aggregate data all in memory without needing to make another database call. In this session, we will build up an application that manages my book collection, including filtering, grouping, sorting, and even controlling how items are sorted. We will use the LINQ fluent syntax to combine functions and make a great user experience.


Safer Code: Nullabilty and Null Operators in C#

New projects in C# have nullable reference types enabled by default. This helps make the intent of our code more clear, and we can catch potential null references before they happen. But things can get confusing, particularly when migrating existing projects. In this session, you will learn about the safeguards that nullability provides as well as the problems you still need to watch out for yourself. In addition, you will learn the various null operators in C# (including null conditional, null coalescing, and null forgiving operators). These can make your code more expressive and safe.


Meet the Next Code Camp Speaker: You!

Ever wonder where the speakers for Code Camp come from? Just look in the mirror. Everyone has something to share. Take the next step and sign up as a speaker. In this informal session, we'll talk about some practical tips to make your session successful.


IEnumerable, ISaveable, IDontGetIt: Understanding .NET Interfaces

You want code that is easy to maintain, extend, and test. C# interfaces are here to help. In this session, you will learn we to use interfaces effectively in your code, starting at the beginning ("What are interfaces?") and then exploring why and when to use them. Along the way you'll learn how to use existing interfaces, implement your own interfaces, and also use interfaces for unit testing and dependency injection. The result is code that is easier to maintain, extend, and test.

Note: There were a lot of changes to interfaces in C# 8 (released Sep 23, 2019) and a few more in C# 11. Be sure to take a look at the "C# 8" articles listed below for details as well as the separate topic "Catching Up with C# Interfaces: What You Know May Be Wrong".


T, Earl Grey, Hot: Generics in .NET

Let the compiler work for you. Generics shift the burden of type-safety from the developer to the compiler. To understand Generics, we'll take a look at some .NET classes from the BCL (such as List), comparing the generic and non-generic versions. Then we'll add Generics to our own methods to add flexibility and type-safety.


DI Why? Getting a Grip on Dependency Injection

Many of our modern frameworks have Dependency Injection (DI) built in. But how do you use that effectively? We need to look at what DI is and why we want to use it. We'll look at the problems caused by tight coupling. Then we'll use some DI patterns such as constructor injection and property injection to break that tight coupling. We'll see how loosely-coupled applications are easier to extend and test. With a better understanding of the basic patterns, we'll remove the magic behind DI containers so that we can use the tools appropriately in our code.


Code is for Humans

The computer understands your code just fine. But what about humans? The world is constantly changing, and your applications need to change with it. Humans make those changes; sometimes it's you, sometimes it's someone else. So let's look at some practical techniques to keep code readable, such as working in small pieces, coming up with good names for methods and objects, and avoiding "clever" code. Think about the next developer who needs to change this code. Often that developer is you from six months in the future.


Abstract Art: Getting Abstraction "Just Right"

Abstraction is awesome. And abstraction is awful. Too little, and our applications are difficult to extend and maintain. Too much, and our applications are difficult to extend and maintain. Finding the balance is the key to success. The first step is to identify your natural tendency as an under-abstractor or an over-abstractor. Once we know that, we can work on real-world techniques to dial in the level of abstraction that is "just right" for our applications.


Practical Reflection in C#

Reflection is an extremely powerful feature of .NET. But there is a big difference between what we can do and what we should do. Several of these features are useful to the everyday developer. We'll take a quick look at what reflection is capable of and then narrow our focus to practical uses, such as making runtime decisions for features and functionality -- all while balancing flexibility, safety, and performance.


Shields Up! Defensive Coding in C#

Coding is easy. Making sure our code is robust and effective takes a bit of effort. By coding defensively, we prepare our applications to face the challenges of real users in the real world. We'll go through some best practices to handle errors and exceptions, validate user input, and head off the common causes of memory leaks. Our ultimate goal is to provide an excellent experience for our users regardless of the circumstances.


TDD / Unit Testing / Smart Unit Tests (Jan 2015)

How do you get started with Unit Testing? A quick way is to implement some simple business rules using Test-Driven Development (TDD). This gives us a chance to understand the tools, see the importance of testing, and write code that is easy to test. We'll use Conway's Game of Life to help us get there. Tools will include MSTest, NUnit, and we'll even take a quick look at Smart Unit Tests -- a feature coming with Visual Studio 2015.


Getting Started with Git

We all need source control, and you may already be using a centralized source control system. But let's take a look at Git -- a distributed source control system that has 100% functionality without needing a network connection. We'll take a look at how to get started using Git, some of the useful features like branching and rollbacks, and we'll also see the built-in support that is provided in Visual Studio. After seeing how easy it is, you'll wonder why you haven't been using it all along.


Unit Testing Makes Me Faster: Convincing Your Boss, Your Co-Workers, and Yourself

Bosses hate unit testing. They see it as code that doesn't contribute to the final product. And maybe you see testing that way as well. But here's the truth: unit testing makes us faster. You'll look at specific examples of how unit tests save time in the development process by letting us code more confidently, catch bugs earlier, and minimize manual testing. With this in hand, you can show your boss (and yourself) how unit testing makes us faster.


Test-Driven Development in the Real World

Are you tired of trivial TDD examples like FizzBuzz? I am. So let's look at a real-world problem to see how Test-Driven Development (TDD) helps us think is small pieces, build provable code, and reduce the amount of unneeded code that creeps into our applications. In the real world, we have to deal with services, libraries, and dependencies. And we have to deal with strange bugs that crop up. In this session, we'll go beyond the simple examples and learn how to break down complexity, isolate dependencies with mocking, and capture expected exceptions.


Focus on the User: Making the World a Better Place

Our job as developers is to make the world a better place, whether it's connecting people, providing entertainment, or making someone's job easier. We have to know who we're building software for: our users. Understanding my users has been a key to every successful project I've worked on. I'll share some of my successes and some of my failures, and show how that's led to the approach to software that I take today. Together, we can provide our users with just what they need to make their world a bit better.


Leggo My Ego

As developers it's really easy for us to let our egos get in the way. And that's understandable. What we do is a creative process: we're problem solving and coming up with new and creative ways of doing things on a regular basis. We need to take pride in our work, but there are serious consequences when we let too much ego get involved: we can become defensive, isolated, and stubborn. Our teams can fall apart due to lack of sharing, mentoring, and communication. Let's figure out how to keep things in balance so that we are open to other ideas, helpful to other developers, and also able to take the appropriate amount of pride in the work that we do. Together, we can make the world a better place.


I'll Get Back to You: Task, Await, and Async in C#

There's a lot of confusion about async/await, Task/TPL, and asynchronous and parallel programming in general. So let's start with the basics and look at how we can call asynchronous methods using Task and then see how the "await" operator can makes things easier for us. Along the way, we'll look at continuations, cancellation, and exception handling.


Becoming a Social Developer: A Guide for Introverts

This is NOT a highly-interactive workshop. Now that you feel a bit safer, make the most of your time this week: talk to other developers. This is easy -- and incredibly terrifying. A few simple steps (and a bit of bravery) is all that it takes to get started. Building your developer network will boost your knowledge, your skills, and your career. Can an introvert become a social developer? YES! And we can do this while staying true to ourselves.


Getting Started with .NET Core on macOS (works on Windows 10, Too!)

Microsoft .NET Core lets us quickly spin up services, websites, and create applications that run on a variety of platforms. In this session, we'll see how to create a self-hosted service and then consume that service in a simple application. We'll use Visual Studio Code and the command-line interface (CLI) to do all of this on macOS (and these exact same projects run on Windows, too).


Run Faster: Parallel Programming in C#

Want to see code run 6 times faster? Join me as we use parallel programming to make full use of our multi-core systems. We'll use techniques such as the .NET Parallel.ForEach, and we'll also spin up Tasks manually to take more control over the process. Along the way, we'll see how to write code that is easy to run in parallel (warning: it may start you down the path of functional programming). Use the hardware you have to run faster.


Get Comfortable with .NET and the CLI

Command-line interfaces (CLI) can be very powerful. The same is true in the .NET world. So let's get comfortable with creating, running, and testing applications using the command-line interface. We'll create a self-hosted web service and then write an application to use that service. Unit tests will make sure things work along the way. Whether you're new to .NET or have been using .NET with Visual Studio, this session will help you get up-to-speed in this powerful environment.


Diving Deeper into Dependency Injection

You know the basics of dependency injection (DI). Now it's time to take a closer look at how DI patterns and other design patterns can help us use DI effectively. We'll look at implementations and uses for DI patterns including constructor injection, method injection, and property injection. In addition, we'll use other design patterns to add functionality to existing objects and to manage disposable dependencies. We'll leave with several practical ways to improve the functionality and testing of our code.


Catching Up With C# Interfaces: What You Know May Be Wrong

(formerly "What's New in C# 8 Interfaces (and how to use them effectively)")

C# 8 & C# 11 brought new features to interfaces, including default implementation, access modifiers, and static members. We'll look at these features, and see where they are useful and where they should be avoided. The world of interfaces has changed; the line between interfaces and abstract classes has blurred; and C# now has multiple inheritance (sort of). With some practical tips, "gotchas", and plenty of examples, we'll see how to use these features effectively (and safely) in our code.


A Tour of Go for the C# Developer

Learning other programming languages enhances our work in our primary language. From the perspective of a C# developer, the Go language (golang) has many interesting ideas. Go is opinionated on some things (such as where curly braces go and what items are capitalized). Declaring an unused variable causes a compile failure; the use of "blank identifiers" (or "discards" in C#) are common. Concurrency is baked right in to the language through goroutines and channels. Programming by exception is discouraged; it's actually called a "panic" in Go. Instead, errors are treated as states to be handled like any other data state. We'll explore these features (and others) by building an application that uses concurrent operations to get data from a service. These ideas make us think about the way we program and how we can improve our day-to-day work (in C# or elsewhere).


Getting Better at C#: Interfaces & Dependency Injection (Sep 2016)

Loosely coupled code is easier to maintain, extend, and test. Interfaces and Dependency Injection (DI) help us get there. In this workshop, we'll see what interfaces are and how they can add "seams" to our code that makes it more flexible and maintainable. From there, we'll dig into loose coupling with Dependency Injection. DI doesn't have to be complicated. With just a few simple changes to our constructors or properties, we can have code that is easy to extend and test.

If you're a C# developer who wants to get better with higher-level concepts like abstraction, loose coupling, and extensibility, then this is the workshop for you. We'll start by laying a good foundation and then ramp up throughout the day.


Awesome C#: Unit Testing

Unit testing can make you a faster developer. Good tests let us move forward more confidently, give us instant feedback when checking regression, and help us pinpoint bugs when things go wrong. In this workshop, we’ll look at the qualities of good tests, including isolation, repeatability, runnability, and more. And we’ll look at specific techniques that make our tests easy to ready, easy to write, and easy to run.

We’ll go hands-on with TDD (Test-Driven Development) to see the red-green-refactor cycle in action. Some code is tricky to test: we’ll look at how to test for exceptions and error states, and we’ll use a mocking framework to create mocks and stubs. Tools include MSTest and NUnit (for testing) and Moq (for mocking), but the skills easily translate to other frameworks.


Awesome C#: Asynchronous Programming

Asynchronous programming is a critical skill to take full advantage of today's multi-core systems. But async programming brings its own set of issues. In this workshop, we'll work through some of those issues and get comfortable using parts of the .NET Task Parallel Library (TPL).

We'll start by consuming asynchronous methods using the Task Asynchronous Pattern (TAP), including how to handle exceptions and cancellation. With this in hand, we'll look at creating our own asynchronous methods and methods that use asynchronous libraries. Along the way, we'll see how to avoid deadlocks, how to isolate our code for easier async, and why it's important to stay away from "asyc void".


Clean Code: Principles, Patterns, and Practices for Better Code (May 2014)

You already code. Now it's time to take the next steps to becoming a better developer. Those steps are not difficult; we just need to put them into practice. The end result is code that is easier to maintain, easier to test, and easier to extend. Through lots of examples and hands-on labs, we'll learn about software design principles and the patterns that help us implement them. We'll see how Dependency Injection helps us create loosely-coupled code. And we'll spend a bit of time looking at Software Craftsmanship: ensuring that our code is readable by humans while still easy to maintain and test.


Leveling Up: The Professional Coder Workshop (Sep 2014)

How can you create better software? What cutting edge practices can you employ to become a better professional? This workshop is a packed day of training and labs. Come experience how common design patterns, coding techniques and core concepts combine to make you more effective. More effective as an individual developer, more effective in a team, more insightful about how to go about things.


Quick Byte: Get Func<>-y (Jan 2011)

If you look into the LINQ extension methods, you will run across Func<T, TResult> quite a bit. If you see a Func<> in a method definition, you can treat it like a big sign that says "Put your lambda expression here." What we'll see is that Func<> is simply shorthand for creating a delegate.


Quick Byte: Extension Methods (Aug 2010)

Extension methods allow you to add functionality to existing types by adding new methods -- no subtyping required. Here's a quick overview of how they work.


Quick Byte: Statement Lambdas (Feb 2010)

The first time I came across a lambda expression, I was perplexed. I could tell that something important was going on, but I got stuck on the new syntax. As I studied them some more, I had an "aha" moment, and it all clicked into place. This is a brief runthrough of that process with statement lambdas.


Target Practice - Silverlight 3 / XAML Sample (Sep 2009)

XAML has intrigued me ever since I took a close look at it. Previously, I created an entire WPF application using only XAML (it's trivial, yet functional). When I got started with Silverlight 2, I wanted to replicate that application. Unfortunately, there were limitations to Silverlight 2 (such as a lack of triggers) that kept me from implementing it. Silverlight 3 allowed me to implement the application entirely in XAML.

Silverlight 3 / Visual Studio 2008:

Data Templates & Value Converters - Silverlight 2 (Jun 2009)

Here's a few more useful things that I've come across. This time, it's Data Templates (which make List Boxes extremely flexible) and Value Converters. Note: this is applicable for Silverlight 3 as well (although Silverlight 3 does have some additional features that makes this easier).


User Controls and Events - Silverlight 2 (Jun 2009)

This demo shows how to split out a section of your UI as a user control. We'll also add an event to the user control that the other controls can hook into. Note: although this application uses Silverlight 2 (and Silverlight 3 has better ways of implementing this particular scenario), the concepts of eventing are still useful in other contexts.


Silverlight 2, WCF, and Lambda Expressions (May 2009)

This is an introductory demo in creating a WCF service and consuming it with a Silverlight 2 application. In addition, we'll take a look at the various ways of creating the call backs for the service (Event Handlers, Anonymous Delegates, and Lambda Expressions) and the various advantages of each. Note: this demo is applicable for Silverlight 3 as well.


Target Practice - WPF / XAML Sample (Mar 2009)

XAML has intrigued me ever since I took a close look at it. In this demo, the goal was to create an entire application using only XAML. This application is somewhat trivial, but it shows the power and flexibility of XAML and declarative programming.