Switching across branches can sometimes become annoying, especially if you’re currently working on different fixes or features or similar features that require you to keep continually changing branches for reference.
Of course, you could clone the repo somewhere else and maintain these two copies, but there’s also an integrated approach available since Git 2.5+: git-worktree.
This command allows you to checkout different branches on different working trees attached to the main repository.
Add a new worktree
git worktree add ../new-worktree-dir existing-branch
This command will create a new worktree on the specified directory checking out the instructed branch.
Remove a worktree
git worktree remove ../new-worktree-dir
When you finish with a worktree, you can remove it with this command. If you delete the worktree using the filesystem without using the remove option, it’s associated administrative files will eventually be removed automatically.
If you don’t like unit testing your product, most likely your customers won’t like to test it, either.
A unit test is intended to perform testing for a single method of your code, these methods should be atomic, this means that they should only perform one operation and have a single responsibility. Atomicity help us improve our testing, makes our code more reusable and easier to maintain.
Unit tests don’t care about dependencies and infrastructure, because of this, unit tests should run very quickly, this allows us to integrate unit tests into our continuous integration processes and deployments to discover bugs early on our development process.
All of this is great right? I don’t want to extend this post talking all about the perks of unit testing since most probably you are already aware of unit testing importance and want to get started right away.
Recently I came across a few series of videos from Visual Studio about getting started with unit testing for .NET and I think they’re a useful guide to enter the world of unit testing.
Unit Testing: Test Driven and Scenario Based Testing
Unit Testing: xUnit
Unit Testing: MOQ Framework
Unit Testing: Existing Code
If you think good architecture is expensive, try bad architecture.
Recently, I’ve been looking for learning resources on software architecture, especially for .NET, and I’ve found this very good series of completely free e-books from Microsoft about software architecture. They provide a nice overview of different architecture approaches, the latest technologies and trends, like containers, CI/CD processes, cloud, microservices, and serverless applications.
You can read all of them online or download in different formats to read on any device.
This guide is an introduction to the recommended end to end lifecycle processes you’ll use to develop, validate, and deploy containerized Docker applications using Visual Studio and Microsoft Azure.
This guide is an introduction to the strategies you’ll need to migrate existing web applications to the Azure cloud and Windows containers. You’ll learn about code strategies, data migration, orchestrators, and CI/CD processes.
This guide is an introduction to the recommended architecture, design, and deployment processes you’ll use to build ASP.NET and ASP.NET Core applications and host those applications in Azure.
This guide is an introduction to developing microservices-based applications and managing them using containers. It discusses architectural design and implementation approaches using .NET Core and Docker containers.
This is a guide for building serverless applications with examples using Azure. It discusses various architecture and design approaches, the benefits and challenges that come with serverless, and provides scenarios and use cases for serverless apps.
You can find all available e-books and downloads here.
Hashing is an important concept, it has numerous applications, and it’s at the core of many other computer science concepts.
HashUtils.kt is a very simple, yet very helpful snippet I’ve used in some of my applications when I need some basic hashing. It’s an extension function, one of Kotlin neat features.
val text = "hello"
val hashedText = text.hash(Algorithm.SHA256)