CodeProject

/CodeProject

Abstract Class VS Interface in C#

You can open any C# tutorial and you’ll find some information about abstract classes and interfaces. Most likely, you’ll not find any information about what is the difference between abstract class and interface. This theme was discussed earlier on the Internet several times but I want to consolidate all the most important thoughts regarding the problem of choosing between an abstract class and interface [...]

By |2016-07-23T15:40:21+00:00July 22nd, 2016|.NET, Best Practices, C#, CodeProject, Design|5 Comments

Objects Equality in C#. Important Facts That You Should Know

Don’t forget that if you want to get my upcoming video courses with 50% discount, then fill the following  form. C# provides many ways to compare objects, not only to compare class instances, but also structures. Actually, there are so many ways, that it requires to put them in order. All those possible options of comparing confuse people in case of misunderstanding them and [...]

By |2016-04-26T16:47:23+00:00April 2nd, 2016|.NET, Best Practices, C#, CodeProject|0 Comments

Cryptography in .NET for Beginners

This is a brief introduction into .NET cryptography. Hashes Hashing is a transformation process of some input data of an arbitrary length into an array of bytes of fixed size. Hash is a one-side transformation function, the result of which cannot be reversed for receiving original input data. Very often it is used to store passwords. Even if an attacker gets a hash, he [...]

By |2016-04-26T16:36:17+00:00March 18th, 2016|.NET, CodeProject, Security & Cryptography|0 Comments

Hidden Dependencies as a Smell

Mark Seemann has written a nice post  “Service Locator violates encapsulation”. The name of the post speaks for itself that it’s about a pattern (anti-pattern) named Service Locator. When a programmer arbitrarily inside the code base calls for the IoC-container to resolve a dependency of an object – he uses a Service Locator anti-pattern. Mark provides the following example: public class OrderProcessor : IOrderProcessor [...]

By |2017-09-13T08:48:13+00:00October 27th, 2015|.NET, Best Practices, CodeProject, Design, Refactoring|4 Comments

Handling Exceptions and Errors. Part 1 – Intro.

In this article we will discuss exception handling best practices. There is a lack of meaningful information about exception handling on the Internet, so let’s go. Have you ever seen that recommendation to avoid exception handling like this: try { //do something } catch(Exception ex) { } Well, indeed, I agree that this exception handler looks pretty bad. But is it helpful [...]

By |2016-07-27T17:38:53+00:00September 21st, 2015|.NET, Best Practices, C#, CodeProject, Design|2 Comments

UpdateableSpin Synchronization Primitive

Today we are going to look at a relatively rare case of synchronization. There are no appropriate C# synchronization primitives out of the box. In order to understand the case we’re going to talk about you can imagine the following case: “Your code makes a call to the third-party library’s method and you have to wait that method until the end. That method performs [...]

By |2016-04-26T18:47:45+00:00August 22nd, 2015|.NET, C#, CodeProject, Multithreading|0 Comments

Refactoring: Extract a Method, When It’s Meaningful

Big Functions Hell Well, now it’s hard to remember the moment, when I first time realized that it’s actually a good idea to extract functions from the massive chunks of useful code. Either I got this knowledge from the “Complete Code” or “Clean Code” – it’s hard to recall. Actually, it does not matter so much. We all know that we should split the [...]

By |2016-08-17T13:54:50+00:00July 20th, 2015|.NET, Best Practices, C#, CodeProject, Design, Refactoring|0 Comments