Category: Programming
General thoughts and stories about programming and life as a programmer.
How to collect return values from Parallel.ForEach?
Today I took 10 minutes to answer the 9 years old stackoverflow’s question: How do I collect return values from Parallel.ForEach? I though the improved solution deserved a quick blog...
How to Plan Large-Scale Refactoring?
The .NET platform exists for two decades and nowadays the technology is evolving faster than ever. It is now time for serious .NET applications to be refactored to run...
10 Reasons Why You Should Write Tests
As many, I started programming when I was a child 3 decades years ago. With no doubt, the most important practice I’ve adopted during my professional career is to write...
Include IL Offset into Production Exception Stack Traces
In a previous post The proper usages of Exceptions in C# I explained that it is important to get as much information as possible from production crash logs. One such...
Is Artificial Intelligence Assisted Coding the Next Developer Productivity Silver Bullet?
The famous Fred Brooks paper “No Silver Bullet – Essence and Accident in Software Engineering“ published in 1987 stated that: “there is no single development, in either technology or management technique,...
Visual Studio IntelliCode : AI Assisted Coding
We are all amazed by recent progresses made possible thanks to Artificial Intelligence (AI). In 2017 Microsoft announced Visual Studio IntelliCode which used Machine Learning (ML) to predict code completions,...
How we quickly refactored with Resharper more than 23.000 calls to Debug.Assert() into more meaningful assertions
Since the NDepend inception more than 15 years ago, we stuffed our code with calls to Debug.Assert(). This results today in more than 23.000 assertions calls. Few developers realize that...
The proper usages of Exceptions in C#
The C# exception basics are generally well understood. However exceptions are often used as a way to sweep error handling duty under the carpet. As I did in The proper...
The proper usages of the keyword ‘static’ in C#
The keyword static is somewhat awkward in a pure Oriented-Object world. I would like to explain here what are the right usages of static I came up after 25 years of...
When your brain can’t handle the complexity: NDepend and PostSharp
The size and complexity of codebases have exploded in the last decade. What can you do when your codebase no longer fits your brain? In this article I’ll suggest two...
Strategies to Catch Regression Bugs before Production: A Case Study
That’s quite a coincidence that a few days after promoting the joy of immutability in the post C#9 records: immutable classes we stumbled on a bug due to a mutable...
New C#9 keywords ‘and’ ‘or’ ‘not’
HoweverThe C#9 language introduces new controversial keywords: and keyword: Conjunctive patterns. Require both patterns to match or keyword: Disjunctive patterns. Require either pattern to match not keyword: Negative patterns. Require...
10 Visual Studio Ninja Code Editor Productivity Tips
Among the multiple daily development tasks (planning, testing, refactoring, bug fix…) code edition is arguably the most satisfying one. Code edition can be even more satisfying and productive by mastering...
Case Study : Complex UI Testing
In the previous post Case Study: 2 Simple Principles to achieve High Code Maintainability I explained that the principles layered code + high coverage ratio by test are 2 simple...
SOLID Design: The Interface Segregation Principle (ISP)
After having covered The Open-Close Principle (OCP), The Liskov Substitution Principle (LSP) and the Single Responsibility Principle (SRP) let’s talk about the Interface Segregation Principle (ISP) which is the I...
SOLID Design: The Open-Close Principle (OCP)
The Open-Close principle (OCP) is the O in the well known SOLID acronym. Bertrand Meyer is generally credited for having originated the term open/closed principle, which appeared in his 1988...
SOLID design: The Liskov Substitution Principle (LSP)
The Liskov substitution principle is the L in the well known SOLID acronym. The original principle definition is: Methods that use references to base classes must be able to use...
Service Oriented Architecture: A Dead Simple Explanation
Service-oriented architecture (SOA) has been with us for a long time. The term first appeared in 1998, and since then it’s grown in popularity. It’s also branched into several variants,...
C# Features: An Exhaustive List of the Best Ones
The first post I wrote for the NDepend blog was about C# 8.0 features. That post inspired a sequel, followed by the series’ final chapter. Those posts dealt with the...
REST vs. RESTful: The Difference and Why the Difference Doesn’t Matter
REST API is one of the most popular APIs in the web development community. What’s the difference between a REST API and a RESTful one? Is there a difference? This...
Coupling in Programming: What This Means and How Not to Get Burned
What is coupling in programming? Is it something we want to avoid when we design and write code? If so, why? And more importantly, how? Let’s take a look at...
Mentoring Software Developers as an Architect
A while back we discussed the unique career path architects have to travel. We wrote that article for developers who want to advance their careers and aren’t sure which way...
Self Documenting Code vs. Comments? Turns Out It’s Both or Neither
It’s been about a month since my last research post, and I’ve been musing about the next topic. What should it be? Well, I’ve decided. Since I love nothing more...
Visual Studio Enterprise vs. Professional: Essential Differences
If you’re a .NET developer, then it’s overwhelmingly likely that you’re a Visual Studio user. There are alternatives to it, sure. But the product from the Redmond giant is the...
Should Architects Write Code? You Bet They Should!
There’s a common misconception that’s permeated our profession: Architects don’t need to write code to do their jobs. Now, this may seem like a harmless approach. After all, writing code...
When Is It Okay to Use a C# Partial Class?
Today’s post attempts to answer a very simple and straightforward question: “When is it OK to use a C# partial class?” And the answer as straightforward as this: “When you need...
Extension Methods and the Decline of Traditional OOP
A bunch of years ago, I wrote a post on my own personal blog titled, “Why I Don’t Like C# Extension Methods.” Over the years, I’ve updated that post a...
Linq Tutorial: A Complete Beginner’s Gentle Introduction
There was a time when Linq was a mystery to me. But, now that I’ve learned how to use it, I don’t know how I ever lived without it! You’ll...
Programming to an Interface: A Simple Explanation
As an architect, you know that programming to an interface is good. It’s what everyone should do. But what does that mean? And why should you do it? Searching the...
What Is a Good Unit Test? 5 Must-Haves
In this day and age, unit testing isn’t as controversial as it once was. Sure, you still see the occasional inflammatory, clickbait-y, confrontational “unit testing is garbage” type of post...