tag: programming

You are mocking it wrong.

on 2017-12-23

Well, probably you are not, but let me grumble a little bit anyway. Mockingbird knows how to mock. I’ve been working with various code bases throughout of my career, and there is one pattern which I see rather often. As you may have already guessed it’s the unit-tests and mocking I’m going to talk about here. To give it a nice catchy start, I’d claim here, that mocks should be used when you have to, but not when you can.

#programming

Read more of You are mocking it wrong.

Write code for the reviewer, not for the compiler

on 2016-09-24

I’ve been doing code reviews on a daily basis for several years for now. This activity is very different from what I do as a developer. Most of the time I try to understand, debug, fix or update existing code. Less often developers write new code from scratch. I think it’s safe to say that we all know how to work with a code written by another human. One might want to say that if we know how to work with other people’s code, we can be good at reading and understanding it during the code review process.

#programming

Read more of Write code for the reviewer, not for the compiler

Thoughts on C# 7 Local Functions

on 2016-04-15

Frankly when I first saw that C# 7 will come with new local functions I thought that that’s just a nice and a compact way of defining local helpers. In fact, it’s much more interesting and useful feature. Today I’m going to talk about it in more details. Let’s start with a brief overview of the current situation. Current options Private methods The first option that existed in C# 1 is having a private method.

#programming

Read more of Thoughts on C# 7 Local Functions

C# 7 features preview

on 2016-04-02

Last week my twitter feed exploded with lots of entries about Microsoft //Build 2016 conference. As it’s one of the most important events for .NET dev community MSFT prepared quite a few awesome announcements for us: Visual Studio “15” preview C# 7 preview Xamarin going open source and free Ubuntu workspace running natively on Windows 10 And lot more Since I got a bit sick this weekend I had plenty of time to play with new VS15 and C# 7.

#programming

Read more of C# 7 features preview

ReSharper Annotations. Can it be null?

on 2015-08-16

Hi, ReSharper is doing great job when it comes to semantics of your code and control flow graph analysis. The special edge case I want to talk about is nullness analysis. Unfortunately sometimes it’s hard to predict whether the method returns null or it doesn’t. To solve this problem R# provides an option to annotate your code. Let’s look at this snippet: public Bar Foo() { return Random.NextDouble() < 0.1 ?

#resharper #programming

Read more of ReSharper Annotations. Can it be null?

Reactive Extensions. Api client with Cache-Aside & Refresh-Ahead strategy. Part 2.

on 2015-08-14

Hi, In the previous post I told you how to implement the Reactive Api client with caching. Well, to prove that our code works we might want to have some unit tests. To do so let’s create a new project (Class Library), add a reference to the main project, and install few NuGet packages. Rx-Main, Rx-Testing, xUnit.Net and Moq. Install-Package Rx-Main Install-Package Rx-Testing Install-Package xunit Install-Package Moq Then we’ll create a class RxGitHubClientTest, inherited from ReactiveTest.

#programming

Read more of Reactive Extensions. Api client with Cache-Aside & Refresh-Ahead strategy. Part 2.

AsyncSuffix ReSharper extension

on 2015-08-02

There is a tendency in a .NET world to build asynchronous CPU bounded or IO related API. We also can see that some APIs support both asynchronous and synchronous versions for the backward compatibility reasons. That puts us in a situation where we should be able to distinguish between async and non-async versions of method. Microsoft suggests us to follow the naming convention where every asynchronous method include Async suffix after the operation name.

#programming #resharper

Read more of AsyncSuffix ReSharper extension

Reactive Extensions. Api client with Cache-Aside & Refresh-Ahead strategy. Part 1.

on 2015-07-26

Hi, Today I want to talk about the development of the api client library. Let’s say it is an imaginary GitHub RESTfull Api that returns user’s rating. To make this routine more interesting we’ll add caching and mix it with Reactive Extensions. In fact the article is a summary of my Windows Phone development experience, and the approach in question was taken in a several applications with different modifications. Note: In this article I assume that the reader is familiar with the concept of Reactive Programming and Reactive Extensions.

#programming

Read more of Reactive Extensions. Api client with Cache-Aside & Refresh-Ahead strategy. Part 1.

Sharing ReSharper settings and Live Templates

on 2015-07-05

In my previous post I’ve described how to create your own Live Templates for ReSharper. Today I’m going to tell how to share your ReSharper settings and Live Templates with your team. All the plug-ins for ReSharper are regular NuGet packages. That means that we can pack and publish it to the official ReSharper NuGet feed or to your own company’s private feed (in case you want to keep it away from the rest of the world).

#resharper #programming

Read more of Sharing ReSharper settings and Live Templates

Custom live templates for ReSharper

on 2015-06-27

Hi! As a .NET developer I’m enjoying to use an intelligent plug-in for Visual Studio which is called ReSharper. It saves me time, provides me a static analysis and generates code for me. In fact code completion and code generation is a very crucial part of this product. By default ReSharper goes with more than 20 Live Templates. The good fact is that it’s easy to customize, and you can introduce your own templates.

#programming #resharper

Read more of Custom live templates for ReSharper