Tuesday, October 21, 2025
Don't complain about your stakeholders; instead, collaborate, then build trust
Monday, November 25, 2024
The way to do a no-op (do nothing) action in GitHub Actions is `run: exit 0`
Saturday, August 17, 2024
Readability Above All Else in Code Reviews
In my last post, I made a case that code reviews cannot be relied upon as the main activity to achieve defect prevention, correctness, robustness, usability, or learning. Even so, these goals are worth pursuing in code reviews, though other practices such as unit testing and QA should be the primary driver to such goals. Aside from those goals, code reviews can indeed be the primary driver of other areas of improvement for a software team. It is arguable (comments welcome), but I say above all else code reviews routinely and consistently improve code readability. Highly readable code might not be the first measure of software quality or of team competency that you'd list, but it should be. Code is typically written once and revised a few times, but read dozens of times. Programs are for humans to read and only incidentally for computers to execute. I or any competent developer can deal with any code that we can understand, and the quicker we can understand it, the faster it will be to troubleshoot, maintain, and enhance. Readable code gives us more than a fighting chance. Too often, when teams are under the gun and avoiding spending any time or effort into code review, we get indecipherable, weird, arcane, and confusing code, and this incurs troubleshooting, maintenance, and enhancement costs to go way up in the future, and in unpredictable ways.
Thursday, August 15, 2024
Code Reviews Are Overrated (but not how you think!)
When I first began leading a "two-pizza" software team in 2007, our
code reviews focused on code robustness and correctness. Our architect
would choose code to print out--usually around 4-6 pages' worth each
week. We would gather in a conference room and spend an hour
scrutinizing, and ultimately arguing, about what in that code should
change. A few months into the job, he turned over that duty to me and I
knew both the printed approach and the goals we were pursuing had to shift! Since that time, tools have greatly improved, code review
practices have become easier and more widely known, and the way we
structure code is less novel and more relatable. On top of these
improvements, developers expect to review code more commonly and with a
much healthier attitude; the benefits are more intuitive to all. However, after doing code reviews on most days for the last 17 years, I
have come to see that some of the supposed benefits of code review are overrated. Let's acknowledge the limitations of code review
toward those goals and consider other goals for which code reviews might be the primary means to gain.
Thursday, April 18, 2024
Full-stack? How about "Full Scope"
Hi, I’m Patrick Szalapski.
I make software and help others to make software.
I lead teams to make the most optimally-scoped business web apps and tools, often with .NET, growing such teams to deliver faster, better, and less expensively. I have a proven track record at multiple companies saving businesses millions of dollars and thousands of hours. I can lead or support the effort to figure out what you need, partnering with stakeholders to attack problems and quickly move to building solutions. My teams quickly grow to be highly productive, technically excellent, self-organizing, and happy.
Best of all, I pivot among these roles to whatever a team most needs for sustainable success.
Wednesday, June 22, 2022
Catch me presenting on Blazor at Minnesota Developers Conference 2022 on June 22 in Minneapolis
I'll be presenting at the Minnesota Developers Conference, June 22, 2022 in Minneapolis on Practical Blazor. I hope you can come and introduce yourself!
Also presenting will be some of my favorites, including Kamran Ayub with a fantastic approach to personal finance, Erik Onarheim on building a game engine in JavaScript, and Robert Boedigheimer on Regular Expressions in .NET. So good to finally get back to an in-person conference!
EDIT: That's today! Here's my slide deck for reference.
Friday, March 25, 2022
Avoiding unnecessary rendering in Blazor
In my previous post, I laid out the fundamentals of what can cause a Blazor site to be slow due to re-rendering. By far the most common cause of such slowness is when hundreds or thousands of components all need to re-render multiple times based on changes to parameters or explicit calls to StateHasChanged(). Often it is the case that only a few of the component instances in question truly need to re-render, but Blazor has no way to avoid such re-rendering, so it is up to the developer to worry about this concern whenever dealing with a proliferation of component instances.
The parent component
This potential slowness is often manifest in lists, grids, or tables where the content of each item is non-trivial. Imagine a UI with a grid of product images: a ProductGrid.razor something like…
<button @onclick="Add">Add new to top</button>
<ul>
<Virtualize Context="productViewModel" Items="Products">
<ProductTile Product="productViewModel" @key="productViewModel.Code" />
</Virtualize>
</ul>
@code {
[Parameter, EditorRequired]
public List<ProductViewModel> Products { get; set; } = null!;
private void Add() => Products.Insert(0, new());
}
Note here we have used the Virtualize component to avoid rendering components for items in the List that aren’t currently shown (due to scrolling). We are sure also to use a @keyattribute on the root child element or component inside Virtualize.
So this parent component seems pretty simple and already optimized using Virtualize; how could it be a problem?
Narrow edits can cause wide re-renders
Note there is a button to add a new empty product. When this button is clicked, Blazor re-renders the home component, which means every child component will re-render as well. In our case, this probably means our ProductGrid and the 50+ shown ProductTiles, and suppose each of which has a dozen small components it shows and thus has to rerender. So that’s easily 770+ rerenders needed just to show the new item.
Ideally, when clicking the add button, there would only be a re-render of the ProductGrid, exactly one ProductTile (the new one), and all the small components (but only those in that one instance): thus 14 re-renders.
The reason each of the ProductTiles has to rerender is that its parent is rerendering, and it takes a ProductTileViewModel (one of our domain classes) as a parameter. Blazor cannot determine that nothing has changed in the fifty shown products, as it cannot interrogate all the contents of ProductTileViewModel and compare them to the previous value–remember, Blazor automatically avoids rerendering based on values only when all parameters are of certain well-known immutable or primitive types.
The main way to address this in the ProductTile component is to override OnParametersSet to detect to store the previous values for every part of the parameter that affects the displayed state, and override ShouldRender on the ProductTile component so that it will return false when the previous values are all the same as the current values.
But such logic comparing “previous to current” would have to be repeated in every component, yet customized for each one to ensure you are tracking all the properties you care about. I’ll avoid showing you the example code for this since it is not the way I recommend doing it.
Avoiding the re-renders
So here’s where my Nuget package Sz.BlazorRenderReducers comes into play. Using its DisplayHashRerenderComponentBase and implementing the protected override string DisplayHash get-only property, I can simply return a string that is unique for each display state that is possible; usually, this is just going to be a string that contains the value of every property that affects the display state in any way.
This has the benefit of reducing the code required to finely control re-renderings to two lines of code in most cases: one line to inherit from DisplayHashRerenderComponentBase and one line to override the DisplayHash getter. So, such a ProductTile.razor will look something like:
@using Sz.BlazorRerenderReducers
@inherits DisplayHashRerenderComponentBase
<li class="product-tile">
<ProductImage Product="@Product" />
<div>
@if (!Product.IsInStock)
{
<OutOfStockBadge />
}
<ProductCode Product="@Product" />
<ProductPriceTag Product="@Product" />
</div>
</li>
@code {
[Parameter, EditorRequired]
public ProductViewModel Product { get; set; } = null!;
// when this value is unchanged, supresses unnecessary re-rendering
protected override string? GetDisplayHash() =>
$"{Product.Code};{Product.Price};{Product.IsInStock}";
// write a console line on every render
protected override void OnAfterRender(bool _) =>
Console.WriteLine($"Rendered {GetType()}");
}
Here, the DisplayHash get-only property can return anything that is uniquely determined by the data that affects what could be rendered by the component. True to its name, it is a hash for the display of the component. In this example, I’ve just shown a simple concatenation of the values that influence the display, but you could have any function here you’d like – perhaps using hash functions implemented on the parameters themselves, or serializing them using System.Text.Json, but I have found often a interpolated string is simplest and easiest to understand. The base component DisplayHashRerenderComponentBase will then properly store the previous and current values of this hash, and ShouldRender will return true or false appropriately, removing the need to reimplement such custom ShouldRender code in each component.
Drawbacks
Of course, one drawback to this approach is that it requires that all such components must inherit from DisplayHashRerenderComponentBase, thus removing the possibility of inheriting from any other base component, abstract or otherwise (unless of course you can in turn make that base component inherit from DisplayHashRerenderComponentBase). Fortunately, I have not seen much need to inherit a component from anything other than ComponentBase (which DisplayHashRerenderComponentBase itself inherits from), so this has not yet been an issue for me.
If you’ve followed along to this point, perhaps you can imagine the bigger drawback to this approach: it requires that the developer specify every potential source of changes to the display state. In effect, you have to “register” (by including in the DisplayHash getter logic) every property that might affect the GUI in each component, including its children components (after all. if a parent component avoids re-rendering, there’s nothing to cause its children to re-render either). As you can imagine, this can lead to confusion as to why a component isn’t re-rendering when it needs to–sometimes parameter properties are used but forgotten to be added to the DisplayHash. No error results and no cue is possible to tell the developer that they forgot to tweak the DisplayHash because of a new binding or some other new code indirectly affecting a bound reference.
However, even this latter drawback seems lower-risk than the frequent errors and confusion that results from manually making every component have a ShouldRender method that would itself need to take into account every relevant property and also would need to track the current and old values of each such property in order to determine if a render is necessary. So this technique seems to be a distinct improvement over having such nuanced and perhaps repetitive (though custom) ShouldRender overrides in many components.
Demo
So try it now on this demo page. To the code from above, I’ve added a toggle checkbox at the top to enable and disable the technique. We can open the console an d add an item, you’ll see a console line was written on each ProductTile render. With GetDisplayHash implemented, we’ve reduced the number of ProductTile renders from dozens to one–but don’t forget the child components that are unchanged: we’ve reduced the total number of components that render from several hundred to five. In my experience, this often cuts the “lag” after the user clicks the button from a few seconds to imperceptibly fast. On apps where users do lots of navigation or small manipulations, lag of a few seconds can kill your perceived performance, so this is a big win.
So if you have (or suspect you have) hundreds or thousands of unnecessary renders happening on many changes, give Sz.BlazorRerenderReducers a try to help drastically reduce the re-rendering that is needed. You can read more on the BlazorRerenderReducers project GitHub page and leave an issue with any concerns or questions, or just reply to this post.
Wednesday, March 16, 2022
Is your Blazor site rendering thousands of times?
When you think about it, data-bound real-time DOM updates are weird. We update values; then other code that we didn’t call knows somehow to call our code, then our libraries update the DOM based on those results. In Blazor, React, and Vue, it all just seems to work–but sometimes there is a nagging slowness to sites that bites our users on every click. What causes this? Usually, it is slowness in rendering.
This is a Blazor post, but first let me quickly contrast Blazor against the JavaScript framework/libraries React and Vue, which both have a robust “reactivity” implementation. In Vue, references for data binding are exposed in each component’s data and computed properties. Then, the magic of Vue automatically injects code using JavaScript’s prototype system so that on every set, code is run that causes every relevant getter to rerun, thus causing Vue’s internal representation of the DOM (called the “virtual DOM”) to update itself from the relevant data in memory. This is automatically followed by the internal code that updates the real DOM from the virtual DOM and then allows the browser to repaint the screen. This is actually quite elegant and it is all hidden from the developer. React does something very similar.
But in Blazor, there is no setter injection, as C# does not provide this capability natively. So instead, the Blazor component base classes internally rely on a simpler but less elegant approach: anytime the parameters to a component change, all the properties and methods that are bound in that component, and recursively in all its child components, will run. Since ideally the parameters to a component uniquely determine the values used therein and therefore determine the DOM for that component, this is seemingly good enough: everything updates immediately. Microsoft’s Blazor docs call this process “rendering” the component. We consider “rendering” in Blazor not to include the time it takes for the browser to paint this DOM, which is seldom (but not never) significant.
However, this can result in at least two pitfalls. First, the time to render (again, think “run C# code for my component”) can indeed be significant. In theory, I thought this would not be a problem; after all, hypothetical C# code run via the CLR (for example, in a unit test or command-line app) would take nanoseconds, and even if there were thousands of components on a page, we’re still talking microseconds here. The problem with this theory is that Blazor code run via WebAssembly isn’t run via the CLR, and so the time it takes a unit test to run a fragment of your component’s code is not the same as it will take a browser to run it. In fact, this difference can be small or it can be 100x or 1000x, and there isn’t always a good way to predict where this slowness will come. (In particular, I’ve noticed that deserializing is slow.) However, there is no simple way to profile Blazor WebAssembly yet, so it can be tough to isolate this kind of rendering slowness.
Secondly, when properties of parameters may have changed but didn’t, Blazor will unnecessarily re-render that component and all its children. This often causes lots of unnecessary re-renders; for example, consider when a property is set to the same value it already has. Blazor cannot look within user-defined objects to see that nothing has changed, so it presumes that something may have changed and it triggers a re-render. A corollary to this: unnecessary child re-renders will happen when a parent component re-renders even when the parameters to the child haven’t changed. Imagine updating the title of a large table when none of the cells have changed. C# can’t tell if this might have impacted a child, so it plays it safe by re-rendering all children anytime there is a chance that changed data affects the DOM rendered by the children.
So why is everybody having such a great time with Blazor WebAssembly and seemingly not complaining of these re-renders? Thankfully, Microsoft already has reduced the impact of these re-renders as much as can be expected. First, Blazor is pretty dang fast. Your site may be doing hundreds or thousands of re-renders in one second without you realizing it. Perhaps it’s bad, but just not bad enough for you to have noticed. Just add the following…
protected override OnAfterRender() =>
Console.WriteLine($"Rendered {GetType()}");
…in all relevant components and see how much they re-render. You might be surprised at all the plate-spinning going on under the hood. Paradoxically, the speed of Blazor WebAssembly masks the theoretical slowness, and this theoretical slowness tends to grow as development of a site progresses till it becomes actual slowness as experienced by users.
Also mitigating re-render slowness is that, if a component’s parameters are entirely certain known immutable types (such as bool, int, decimal, string, DateTime, and Guid), then Blazor will cut off the re-rendering when the values haven’t changed. So, if you can make a component depend on a few strings or bools rather than one instance of a user-defined type (be it a class, struct, or record), do so.
Another good practice to mitigate the re-rendering penalty is to ensure that rendering or parameter changing does not repeatedly cause loading data from a web service or any other asynchronous operation. Structure your C# component code so that data is loaded only when detecting a change that requires it–often, when the previous value differs from the current value–rather than simply loading that data every time in OnParametersSetAsync or OnAfterRenderAsync. Also, do not bind the invocation of any such asynchronous method directly to a displayed element (e.g. <div>@(GetNameFromServer())</div>); instead, bind to a property and some other event should invoke the method call to populate that property, usually on user action or based on conditional logic within a lifecycle event handler. In short, assume your component will be re-rendered many thousands of times, and the mere act of re-rendering should not do any heavy lifting except when something relevant has changed. Do not make components that require parent components to carefully limit re-rendering.
Is frequent re-rendering causing a long list, table, or other repeated components to bog you down? Most loops in your Blazor markup can be replaced by instances of the <Virtualize> component. This component is a godsend: it will render only the iterations needed to provide a good user experience. The component often is a no-brainer drop-in replacement for a @foreach loop, so learn it and use it often.
Finally, Blazor provides the protected override bool ShouldRender() method. If you have some logic where you can decide when a rerender is necessary, just implement ShouldRender to return false in the cases. Don’t worry about coding the first render as a special case: ShouldRender doesn’t get called on the very first render of a component, so you don’t need to add code to cover the first render case. (Also note that if ShouldRender returns false, then child components will also not be rerendered.)
Even with all these partial solutions, you may well find yourself in the situation where you’ve optimized all you can and many components are still re-rendering too often. How do you reduce unnecessary renders when dealing with non-primitive parameters without adding lots of non-intuitive, custom complexity in ShouldRender? I’ll have a solution for this in my next post.
Sunday, December 13, 2020
C# ascendant: Nuget packages to try (and some that are no-brainers)
I
feel like with the advent of Blazor, the power, usefulness,
and ubiquity of C# and .NET in general has kicked up a notch. At the
same time, the growth in functional programming (LINQ in C#, F#,
Clojure, Scala) and separately, dynamic typing (Javascript, Python), and
fluent APIs/DSLs all give us better ways of both thinking about and
writing our code--we can be more expressive and simpler while being less
error-prone. C# is becoming the best of all worlds as these paradigms
become nearly fully enabled in C# with the variety of NuGet libraries
enabled.
Here are some interesting NuGet packages that I haven't used yet, but might take advantage of soon.
- FluentValidation - On
my current work project, we just wrote a bunch of complicated (though
not complex) validation code, all custom, and mostly with nested if
statements. I wonder if this would be more readable and intuitive using
a library like this?
- Humanizer
- So much of our code is just variations on mapping identifiers,
timestamps, or logic into human-readable forms. This package provides a
ton of methods for doing this in a simpler and more intuitive way.
- FluentMigrator -
So far, I've never worked on a project that has successfully kept its
database schema in code, other than by retaining SQL scripts. Could
this library help?
- Polly -
Retries, timeouts, and more - I've often written custom methods to deal
with various service accessing needs. Next time I feel like I should,
I'll have a look at Polly.
- OneOf -
I see often where I need to return two different types--one for success
and one for an expected failure or "nothing to do" case. Functional
languages have handled this better than OO languages from the start, but
maybe this library could bring me the ability to return OneOf<bool, FailureMessage> or any other union that might be useful.
- Dynamic LINQ - Could it help or hurt to be able to dynamically build your LINQ logic depending on runtime state? I've often wanted to, but understood why C# can't do it by default. Could this package enable such power? Or would it do more harm than good?
- Dapper - EF
is great but I still think it is overfkill for most needs, especially
if your team is proficient in writing SQL (and they should be). I
cannot bear the thought of spending an hour to make EF do what I want
when I could just write my own SQL and be done with it. Dapper does the
part I want (Mapping rows to objects) and leaves out the part I don't
(Mapping code to queries).
- FluentAssertions - It is so much better
to write intuitive assertions in my tests than to even take the 20
seconds to write it with traditional MSTest assertion syntax. Goodbye
Assert.IsTrue, hello result.Should.
- Moq - There seems to be nothing better for detouring/mocking in your automated tests. Even though .Setup and It.IsAny<T> get tiresome, I haven't found anything better.
- Swashbuckle with Swagger and SwaggerUI - This trio gives my API documentation with hardly any effort. Nice!
- Serilog - We finally have a winner in the logging library fight. Everyone loves it; you will too. Ditch Log4net, nLogger, or anything else you might have struggled with before.
Sunday, April 12, 2020
See me at the all-online Minnesota Developer's Conference, May 4, 2020
My session is all about how to make your C# code better and to do it more routinely and with high-confidence. Too often, we are afraid to refactor because we might break something--but we err on the side of false caution, because our dirty, confusing code causes more bugs than a refactoring would. I'll show my favorite refactorings and demonstrate how to get into the habit of always improving.
I also am excited to see my colleagues Kamran Ayub, Erik Onarheim, and Elsa Vezino present there, and I always love more Benko-tips and wisdom from Ward. Thanks a ton to Jason Erdahl and his team at ILM for moving this thing online rather than cancelling--I've never been as interested in a live online conference before!
Video: Practical Refactoring in C#
Slides
Demo Code
My favorite refactorings:
- Tool-assisted:
- Rename
- Extract method
- Move
- Remove unused usings
- Reduce nesting: Invert if; combine singly-nested Ifs;
- Extract interface
- Restrict access modifiers
- Code against nonexisting members then generate
- Manual:
- Simplify boolean logic
- Early return
- Reduce newline usage
- Convert If-else to ternary
- Eliminate/simplify loops with LINQ
- Iterate instead of repeat code (try lambdas or private classes)
- Replace Start/Stop methods with an IDisposable
- 7 steps to add dependency injection
Sunday, February 2, 2020
Presenting at Twin Cities .NET User Group, Thu Feb 6 at 5:00
Monday, May 13, 2019
Easy screen resolution changes
I’m using the following AutoHotKey shortcuts to quickly change my screen resolution on my 27” 4K display from 4K (normal work) to 1080p (or “2K”, for screen sharing over Skype, MS Teams, or Slack). I simply press Win+Alt+2 for 2K and Win+Alt+4 for 4K. Enjoy!
#!4::
ChangeResolution(3840, 2160)
Return
#!2::
ChangeResolution(1920, 1080)
Return
ChangeResolution(Screen_Width := 1920, Screen_Height := 1080, Color_Depth := 32)
{
VarSetCapacity(Device_Mode,156,0)
NumPut(156,Device_Mode,36)
DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&Device_Mode )
NumPut(0x5c0000,Device_Mode,40)
NumPut(Color_Depth,Device_Mode,104)
NumPut(Screen_Width,Device_Mode,108)
NumPut(Screen_Height,Device_Mode,112)
Return DllCall( "ChangeDisplaySettingsA", UInt,&Device_Mode, UInt,0 )
}
Return
Thursday, May 9, 2019
Billy Hollis on interaction design
I just finished attending NDC Minnesota 2019. One of the highlights of the conference was Billy Hollis’s session on UX Principles, as well as his workshop on practical steps to tackle a design task.
Big takeaways:
- Users have much Inattentional blindness--they shut out anything other than the things we want to see or expect to see. Don’t fight this.
- When trying to improve or iterate upon a app’s design, first make observations about the user’s experience and write them down in short, simple, English sentences. (These sentences do not go onto the product backlog yet—they are unactionable observations, not user stories.) Then sort by importance, filter, and dedupe them, and then discuss as a team, and only 6-10 design tasks (or stories) to go onto the product backlog.
- Know what is most important to the users. Most experiences suffer for lack of emphasis or visual cues of relative importance.
- Sketch/mockup designs. Use a low-fidelity tool or just pencil or whiteboard.
- Sketch 3 or 4 designs, not just one. One sketch usually results in very particular, nitpicking feedback, but 3 or 4 sketches gives the opportunity for a range of reactions on the things that matter most
- Shoot for a “traditional” sketch, an “innovative” sketch, and a pushing-the-envelope sketch. Often this gets the stakeholders pushing themselves in the right direction. Don’t pigeonhole yourself to a
- The point of good aesthetics is to give impression of high-quality software; always focus on actually having high-quality software without putting lipstick on a pig.
Hollis is one of my favorite presenters; if you get a chance to see him, I highly recommend it. He has a Pluralsight course on UX principles and speaks around the country.
Saturday, November 18, 2017
Tweaking Scrum
I presented a short talk called Tweaking Scrum at Agile Day Twin Cities 2017. I hope to write a longer post on it, but for now, here is the slide deck, as well as notes from the followup open space discussion.
Thursday, May 11, 2017
Microsoft Build 2017 conference Liveblogged notes
Let me know if you want further thoughts on anything below. What a busy conference! It is more crowded than I thought, and I definitely not bored.
TLDR: Go to Build 2017 on MSDN Channel 9 to search for the videos that interest you the most. The best education for me was the New in .NET “three runtimes” session by Hanselman and Hunter, but the most impressive was certainly Saqib Shaikh’s blind coding demo in the first five minutes of the “what’s new in Visual Studio” session.
Full notes:
-
Keynote 1 – Satya Nadella, Scott Guthrie
- IoT/Cloud and “Intelligent Edge”: now able to sync logic in Azure cloud to devices apart from the cloud
- Hanselman: Azure CLI, .NET Standard, PostgreSQL and MySql on Azure; SnapPoints (see breakout sessions)
- AI / learning APIs: language, text, audio, more
- New in .NET: Scott Hanselman & Scott Hunter
- .NET Core is highly wanted; C# is #3 language, growing, talked about
- Architecture Guidance now available; see http://dot.net/architecture: samples, guides, etc.
- .NET Standard - formerly PCLs; a contract - allows sharing code, binaries,
- No change to the way code works
- For libraries, not for UI apps
- UI might be Framework 4.7, Core, UWP, Xamarin, Unity, etc.
- .NET Core 2.0 has one package reference for ASP.NET All
- VS 2017 Update 3: more refactoring features, live unit testing, C#7.1,
- File globbing: drop files into folder; appears in solution explorer
- Can edit .csproj without unloading
- Live unit testing of .NET Core and Framework too.
- Debugging: tells you WHY exceptions are thrown
- Ctrl+T, "F" for file, "M" for member, etc. – reduces need for Resharper
- Suggesting variable names, add a property with Ctrl+. – reduces need for Resharper
- VS2017 Code style conventions and enforcement – reduces need for Resharper
- Preview of FxCop live suggestions; live fix for you
- Can build .NET Core on Mac using new Visual Studio for Mac
- Azure
- now has dependency map with warnings, key stats, errors; example errors are given with full detail
- automatically takes snapshots (dumps) of state with errors from items running on Azure
- Can set additional snappoints (not breakpoints) to get these dumps: doesn’t stop anything or slow things down; can do it in prodution; can look at with “snapshot debugger” – need to start collection and get snapshot as soon as it happens, but app doesn’t pause
- Azure Functions: serverless functionality; based on .NET libraries; can debug locally or remote debug
- can run functions based on triggers
- Containers with Kubernetes and Docker: Brendan Burns & Gabe Monroy
- Most outages are self-inflicted: our systems are complicated. We have understanding of our local space, but not about how our changes affect something else.
- Usually we have Application, Server Cluster, Kernel/OS, and Hardware to worry a bout
- “DevOps” is mostly about the Application layer, but it also should be about the rest of layers
- Container Cluster Managers, Containers, IaaS/vitrualization decouple us from other layers
- New system for Kubernetes orchestration: “Draft” making containers easier for developers; reduce conceptual overhead; demo:
- "draft create” – scaffolds a docker app
- “draft up” – sends app to ACS Docker Container cluster, automatically
- Do not have to install Docker or Kubernetes on client, just need a remote ACS Docker Container cluster running (E.g. as set up from web hosting team)
- New tool Helm – a package manager for your Kubernetes cluster
- Helm needs to be installed as an app on Kubernetes cluster, then you can go nuts with packages without hassle
- “helm search <term>” to look for packages
- “helm install <packagename>” – installed, but also helps you configure it
- Still need application management for multiple devs, source control, CI tools: example from GitLab
- set up a file .gitlab-ci.yml
- uses a pipeline as set up in GitLab
- spin up container, run build, deploy, spin down container
- so close to Kubernetes that we can customize the actions in the pipeline
- That’s great, but what if we aren’t using Gitlab?
- These systems are becoming modular, more accessible to all.
- We don’t make GUIs anymore, we rely on existing OS and tools to do so
- E.g. Kube Lego simiplifies LetsEncrypt to automate certificate acquisition whenever needed in a Kubernetes cluster – never need to manage certs
- Azure CLI - Kamaljit Bath:
- To manage Azure, you can use GUI, PowerShell, or new Azure CLI 2.0 (for general use) or 1.0 (for ASM services)
- Natural and idiomatic integration with bash and GNU/Linux tools
- Meant to fully support Azure services
- Can be installed on any OS with a native installer, or use the web version
- Examples:
- “az” list all commands
- “az account list” list subscriptions on my account
- “az account list –o tsv” for tab-separated values
- “az vm list” list VMS on my subscription
- “az vm list –o json > file.json” get JSON version in a file
- “az vm show –h” help with all the parameters for az vm show
- “az vm show –g <TAB>” for autocomplete on groups
- “az vm show –g MyresourceGroup –n Mynewdemovm –show-details”
- “az find –q plan” – help on commands with "plan”
- “az vm list –o json | jpterm” – show JSON on left side and query results of a JMESPath expression on right side in jpterm
- “az vm list –query ‘[]{JmesExpression}’ – same thing without the tool
- Interactive mode – “az interactive”
- Gives much intellisense-like help, more examples to choose, help text
- “vm create ::1” runs first example for vm create
- Can go into specialized scopes, e.g. “cosmosdb”
- create –name MyCosmosName"….
- Search for “Get started with Azure CLI 2.0” on microsoft.com
- Angular and Typescript – Rob Wormald (Google)
- To be clear: “AngularJS” is Angular 1; Angular 2+ drops the “JS”
- Angular apps are made of components, and put together with decorators
- Everything Google does runs on Angular
- TypeScript and Open Source CLI tools have not been used inside Google – instead were using Google Closure Javascript that no one likes – now transitioning to TypeScript because:
- has inline types
- fast to recompile
- decorators
- is Google Closure-compatible (side-by-side)
- IDE support
- Use bazel.build instead of Grunt/gulp/webpack
- WCF microservices in containers is a work in progress– Jeff Fritz
- WCF is big and heavy, lots of power
- Must use Windows containers for WCF. Linux containers won’t work.
- Windows containers are big but easy to use. Good to get rid of managing VMs. We’ll have better SoAs.
- We support HTTP(S) and TCP bindings, IIS-hosting and self-hosting, anonymous endpoints “very easy” in a container
- Do not support MSMQ or HTTP authentication
- Can’t pass in environment variables on the command line, can’t orchestrate very easily – looking into extending Configuration Manager
- WCF dockerfile example
- Sample code
- Visual Studio with standard ASP.NET project doesn’t understand WCF on Docker, nor debugging it
- Maybe better to use a self-hosted WCF host (“BasicHttpHost” in the sample code) – still can’t debug
- How to do it: Install Docker for Windows, pull the latest microsoft/wcf image, try lift-and-shift an existing service,
- Keynote 2: Windows – Terry Myerson, Joe Belfiore, Abolade Gbadegesin, Alex Kipman
- Windows 10
- Fall Creators Update: new app Windows Story Remix (photos, videos, Paint 3D, work with phones): automatic videos and compositions like Google Photos; automatic sync with phones, ink notes that can be anchored to things in videos; Devs will have access to 3D/mixed reality features via APIs
- Fluent Design System will start influencing apps with light, depth, motion, material
- OneDrive Files On-Demand: mix of file on hard drive, cloud, or both in Windows Explorer; more automatic synching
- Windows Timeline: keeps track of all tasks from earlier; search; automatic syncs tasks across devices
- Connect your Android/iPhone to your Windows Phone
- Cloud-powered clipboard – copy/paste across devices (e.g. integrated into SwiftKey)
- XAML Standard 1.0 coming: will unify UWP + Xamarin UI code
- UWP features: pen integration, material, fluid transitions
- Graph APIs for people, activities, devices – built in to Windows 10, available via “Project Rome SDK” for Android and iOS
- Windows Store + UWP apps
- Visual Studio Test Cloud will have full support for UWP and many devices
- Windows 10 S is a version of windows that is only for Windows Store Apps (for schools, other specialty apps)
- Apps like Spotify, iTunes, SAP Digital Boardroom, Autodesk Sketchbook or will be in Windows store
- Dev Tools
- Ubuntu, SuSE Linux, Fedora soon be apps in Windows Store
- Xamarin Live Player: .NET C# Xamarin apps deployed to iOS device with full debugging capabilities, instant sync on UI changes
- Narration on every Windows 10 PC – can tell what the visually impared will experience; Narrator developer mode to put self in the shoes of a visually-impared person
- Windows Mixed Reality: VR, AR; PCs, Consoles, and holographic computers/headsets
- Motions controllers: optical sensors, trigger, stick, touchpad – no external cameras
- headset + controllers from Acer for $400 coming 2017Q4 – can preorder at http://windows.com/mixedreality
- Private conversation: F# could be good for creating DSLs or anything where composing/manipulating functions would be complicated in C#. Using duck typing-like type inference simplifies coding. Don’t be afraid to have most of an app in C# but a key part in F# if necessary.
- Developer’s Guide to the Galaxy – snippets of various demos or talks
- Mixed reality is hard to develop? Who does all the 3D? It is possible to dev with only a PC and webcam. Using Unity, add a camera and a image to the scene. Add a 3D model from a .fbx (e.g. from Remix via Paint 3D), add to hierarchy, scale and position it.
- Chris Barker on MyPeople in Windows 10 Fall Creator’s Update: API is simple; can use toaster popup with XML
- David from France on WebVR and BabylonJS: full 3D and VR in the browser
- Render 3D scenes
- switch between plain view and stereoscopic fisheye view e.g. for Cardboard
- Can use C# and Typescript;
- Detect gaze, select objects, even gather video texture from webcam
- JD - Progressive web apps:
- A “Service worker” runs independent of a browser frame – can speed up if the feature is available, enables offline functionality, not distruptive otherwise
- Use PWA Builder to help get started – gets a service worker ready for you to drop into your app
- Can also use hardware from Javascript web app
- UWP Community Toolkit Sample App in the Windows Store – can copy XAML code, etc, from it
- .NET Q&A Panel – Damian Edwards, Mike Harsh, Immo Landwerth, Rich Lander
- Portability Analyzer tells us what changes apps need for .NET Core. Tips:
- Use .NET Core 2.0. .NET Core 1.0 has much lower compatibility.
- Error messages have good suggestions (click the triangle)
- Compiler messages might be easier to start
- Be sure to use VS2017 Update 3
- .NET Core still supports P/Invoke, even on Mac & Linux – COM interop is not supported, MSMQ not yet supported but would be Windows-only if it is supported; System.Drawing and Directory Services not supported
- Must call ConfigureAwait(false) all the time on the server? See also this Q. The default of “true” is still better.
- Need Core 2.0 or Framework 4.6 for snappoints/debug snapshots
- Why use .NET Core rather than Framework for web apps:
- Cross-platform (Linux, Mac OS, ARM)
- Self-contained .NET libraries (don’t need to install new framework on server)
- .NET Core is changing quicker and getting more new features (it is also open-source)
- Some performance advantages
- Other Framework vs. Core ideas
- .NET Framework is not going away, support will continue, but it won’t get too many new features
- Can run .NET Framework apps in containers – don’t rewrite things
- Can use a ASP.NET Core API in front of a Framework library
- Not recommended to run ASP.NET Core on .NET Framework—it is really meant for .NET Core
- TLS 1.2 support in Framework 3.5 is in a hotfix, and must be enabled via registry key. It is fully in Framework 4.0
- Web Assembly support in .NET? Nothing decided yet (probably not)
- How to load different versions of the same assembly? e.g. may get TypeEquivalenceExceptions – very hard to overcome with an easy way. Still using the later version is the easiest way.
- There is one specific use case that `async void` is for (event handlers); never use it otherwise. Probably need a way to catch it in Code Analysis.
- Can run Kestrel on Raspberry Pi? Not with UWP on Windows IoT. Can run a C++ Console app on Windows IoT. Not easy.
- Managed Add-in Framework not on .NET Core. No one cares about it.
- Deep Learning demo:
- Started with audio data for leaks in a pipe; using a Jupyter notebook to walk through: run microphone ball through pipe, get WAV file, get integer values from it, Fourier transforms to get an array of arrays, then make images, then colorize them, then build a neural net, then train the model, then run model against any image to predict probability of an image showing a leak; show results in a 2x2 confusion matrix; then figure out ways to improve the model
- Real-world: trained with 2000 images was good enough
- Transfer Learning can help you train the model
- Visual Studio 2017 and the CI pipeline: Ahmed Metwally & Mark Wilson-Thomas
- Can configure CI in Azure and VSTS right from Visual Studio; build failure would happen right in Visual Studio status var - Not useful with Jenkins
- Visual Studio now has tighter feedback: see problems as soon as they are made when coding
- When “in the zone”, don’t always want to fix all the little issues. VS can help us understand what Code quality is at..
- Change pending indicator is in the status bar
- New “Build & Code Analysis results” in the Changes pane helps you commit with confidence (or fix issues before you do)
- Continuous Delivery extension for Visual Studio is new. Road map:
- Today: Support for ASP.NET, CI Build failure notification, link to build results,
- Next: in-IDE pull requests, code analysis in pull request
- join on slack aka.ms/cd4vs_slack
- Visual Studio 2017 Coding at 88 MPH Tips and Tricks: Justin Clareburt and Alison Buchholz
all at aka.ms/vsnavshortcuts, below are the ones that were new to me: - Git Repos from other machines show up on Start Page – easy cloning
- Folder view supported in solution explorer – do not need projects
- Shift+Alt+Enter: full screen mode
- Esc: go to main text editor – Alt+F6 go to recent tool windows
- Shift+Esc: close current tool window
- Suggested mappings:
- Window.Dock: Ctrl+Insert
- Wondow.DockAsTabbed: Ctrl+Shift+insert
- Window.AutoHide: Shift+Insert
- Windows.HideAll: Shift+Alt+Ins
- Move to next/prev tab Ctrl+Alt+PgDn and +PgUp
- Ctrl+T: Go to all box with filters
- Shift+F12: find all references
- Ctrl+Alt+Home: keep previewed doc
- Alt+W, L: Close all documents
- Ctrl+Shift+F12: go to first error
- Solution Explorer: Sync with active document button (or track active document option on )
- Extensions
- Git Diff Margin:
- Solution Error Visualizer
- Fix Mixed Tabs
- Hot Commands
- Open Output Folder
- Add Folder to Solution
- Multi Edit Mode
- The future of Visual Studio – Amanda Silver, Tim Sneath
- Blind coder demo – Saqib Shaikh. Pretty amazing how a blind person can code efficiently.
- Visual Studio is the most popular IDE for web developers; C# is the third-most popular language
- VS2017 version 15.3 will be out soon; lots of new features
- Emphasis: Catching issues early (“shift left”)
- Realtime experiences for unit tests, violations
- New installer, choose only the parts you need
- Live unit testing
- Refactorings: sorts, null checks, string interpolation, many more
- Code Analysis extension
- “Enable Docker Support” in new Project dialog
- True Linux C++ development in Visual Studio
- Visual Studio Data Scientist mode for R
- Visual Studio for Mac
- Experiment: VS can infer EditorConfigFile for style rules
- Linux subsystem – full Linux apps
- The future of C# – Dustin Campbell, Mads Torgensen
- C# 7 and 7.1
- tuples, tuples with named items
- Infer names of Tuple items in C# 7.1
- async Task Main now allowed
- new Task types – ValueTask (good for memory intensive tasks
- Deconstruction: get values underneath a tuple
- underscore for items we don’t care about
- Local functions
- Pattern matching (types or constants), even in switch, even with conditions
- Inline variable declaration `out int i`
- VS features
- New braces connected with faint lines
- depend on C# version autofix in C# 7.1
- “convert to binary” refactoring
- Better “go to references” and “find references”
- Find references of literals
- Auto complete for partially typed namespaces/types
- Suggested parameter names (intellisense)
- Autofix for git-style merge complete
- Press enter to split a long string into concatenated strings
- Refactor to initialize property (like Resharper), separate nibbles
- C# 8
- Default implementations inside interface (avoids requiring all implementations to implement new members)
- Annotated possibly null (e.g. `string? s` as a return value)
- foreach await, using await
- more flexible extension methods
- Records (automatically generated classes)
- Supercharging debugging in Visual Studio – Kaycee Anderson
- Execution Control
- Remember to add command-line args in Project Properties – Debug
- Can start debugging with F10 – first point
- Recent function returned values now show in locals; to see in watch window with “$returnValue1”
- New choice “step into specific” instead of stepping to the first one
- New icon for “run to click” just like run to cursor, but more discoverable
- Can “run to cursor” from call stack window, instead of step out, step out, step out
- `if (debugger.IsAttached) Debugger.Break();` – hardcoded breakpoint
- Data inspection
- Choose among several visualizers in data tips
- Alt+F12 for peek window
- Hold Ctrl to hide intellisense overlays
- Can right-click to add expressions to pinned watch snips
- “Make Object ID” makes a reference $1 that you can use in watch window even when other references change
- Breakpoints & Diagnostics
- Breakpoint actions: make conditional, make tracepoint
- quick and dirty profiling – see pertips at the right side of each recently-executed line
- consider keeping Diagnostics tools window – now has more useful summaries
- take snapshots to compare two points in time e.g. memory
- Coming soon: historical debugging via “Step back”
- Exceptions: New exception helper in debugging – has…
- inner exception scroller
- more information on cause of exception,
- optional exception settings (also there’s an exception settings window)
- Multithreading
- Parallel stacks window: shows visualization of all threads
- Parallel watch window: see values across all threads
- Can freeze thread in parallel watch window, run all other threads
- After a breakpoint is hit, remove breakpoint to avoid hitting the same breakpoint in other threads (step around)
- can filter breakpoint to a thread ID
- aka.ms/vsdiagsamples – the samples for the above
- aka.ms/diagnostics
- aka.ms/SuperChargeYourDebugging
- Miscellaneous notes on the side
- .NET Conf 2017 is Sep 19-21: free online conference
- .NET Fringe conference June 4-6
- Recurring theme: increasing reliance on CLIs, especially ones that look like bash
Sunday, May 7, 2017
Presenting at DevJam's ProductConf 2017 on Tweaking Scrum
It is a mistake to leave the product decisions to the Product Owner alone. Every member of an always-improving, self-organizing Scrum team will help to make the team's work and the product better. This highly collaborative session will have a section on prepared insights on how to tweak typical Scrum practice as learned from several years of software development on Scrum teams; then the bulk of the time will be open for your insights on how you have tweaked Scrum that you might share with the group. However, this discussion will not simply be show-and-tell time; instead, we will think through the suggestions from a product lens in order to see if the potential impact is outweighed by missing out on the benefits from "untweaked" Scrum. We will avoid dogmatic thinking but not controversy as we tweak Scrum together.
If you are coming to ProductConf, be sure to come over and say hi!
Tuesday, March 28, 2017
Tuesday, November 1, 2016
Scrum Guide updated to include valuing commitment, focus, openness, respect, courage
Recently, Ken Schwaber and Jeff Sutherland updated the official Scrum Guide to include the Scrum values, which are:
- Commitment
- Focus
- Openness
- Respect
- Courage
Sutherland emphasizes that teams adopting Scrum must have a commitment to change and to take your company into the future. Without embracing this change, "you can't get there" and Scrum will be of little value to you.
Schwaber highlighted that focus to work on nothing but the sprint goal will yield the best results; working on other items destroys your productivity. Sutherland noted that doing twice the work in half the time is only possible if the teams focus on the sprint goal alone.
Stakeholders and the team alike need to have a spirit of openness. Sutherland stressed that all happenings must be visible; only when everyone knows what is happening can you best decide how to adjust and how long work will take. We should go so far as not to work on anything that isn't visible.
These are only possible with respect for each other; blame and cover-ups result in poor outcomes. If we respect everyone where they are, they can be empowered to grow and achieve. Sutherland says this applies even to high-pressure cutthroat venture capital-driven startups. Schwaber stresses that respect creates a positive hubbub, a buzz that is charged up with work getting done.
Courage, both to do the right thing and to attempt hard things, is necessary because change is risky. Leaders have a big role to encourage taking wise risks and accepting the downside that sometimes results. Schwaber emphasizes that Scrum provides a safety net--you will never waste more than a sprint's worth of work.
Scrum has the power to make your work life more fun, more balanced, and happier.
View the Scrum Guide: http://www.scrumguides.org/scrum-guide.html - The newest changes are near the beginning, under "Scrum Values".
Friday, February 12, 2016
A compact layout bookmarklet for Azure DevOps / Azure Boards work items
UPDATED 2026-09
Do you want your UI controls and whitespace cruft taking up half your browser window, like the default view in the first image? Wouldn’t you like your Azure Boards backlog (in Azure DevOps) to instead show as much info as possible, as on the second image below?
Azure Board fix ← Drag this to your bookmarks/favorites bar (Ctrl+Shift+B to toggle it in Edge/Chrome).

Then, whenever you have Azure DevOps web work items or the task/story board open and you want to see more content and less cruft, click it. Be sure to use "full screen view" in Azure Boards and in your browser as desired.
I’ve also made it available as a gist.
[Bookmarklets are tiny programs stored inside bookmarks or links. Similar to (but simpler than) add-ons and extensions, they add new tools to your web browser. Bookmarklets are shared on web pages as web links. To add a bookmarklet to your browser, right click on its link and choose the bookmark option, or drag it to your bookmark bar. To use it, simply click on the new bookmark you added.]