Functional C#: Primitive obsession
The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. This is the second article in my Functional C# blog post series. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors What is primitive obsession? Primitive obsession stands for using primitive types to model domain.
Functional C#: Immutability
The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. I’m starting a series of articles in which I want to show how to program in C# in a more functional way. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors Why immutability?
Exceptions for flow control in C#
The use of exceptions for flow control was raised quite a few times already (here’s a c2 discussion and here is a great question on SO). I’d like to summarize this topic and provide some common use cases along with code examples to handle them. Exceptions for flow control: why not? Generally, code is read more often than written. Most of the best practices aimed to simplify understanding and reasoning about the code: the simpler code, the fewer bugs it contains, and the easier it becomes to maintain the software.
C# code contracts vs input validation
Input validation rules are often taken for code contracts. In this post, I’ll try to cover their differences and show what their common use cases are.
Shared library vs Enterprise development
Most of the development principles are applicable to any software you might develop. Nevertheless, there are some differences between building a reusable library and an enterprise application. Those differences often become sticking points as we try to apply experience gained in one type of project to projects of the other type.
The differences between shared library and enterprise development grow from differences in requirements and lifetime support cycle.
When inheritance is not an inheritance
Nowadays, notion of composition over inheritance is quite widely accepted. It basically means that when designing a software, you should prefer composition to inheritance, although you could use either one. But what if several classes do have some common attributes? Do you need to extract a base class for them? When inheritance is not an inheritance In OOP, inheritance stands for "is-a" relation. That is, a class A can be treated as a sub-class of a class B if A *is* a B in a way that makes sense for our particular domain.
IEnumerable interface in .NET and LSP
I often see developers saying that in most cases, use of IEnumerable breaks LSP. Does it? Let’s find out. This is the continuation of my article Read-Only Collections and LSP. It this post, I’d like to discuss IEnumerable interface from a Liskov Substitution Principle (LSP) perspective. Liskov Substitution Principle and IEnumerable interface To answer the question whether or not use of IEnumerable breaks LSP, we should step back and see what it means to break LSP.
How to increase your value as a developer
Did you think about what traits make developers great? Which one is the most valuable for the companies they are working for?
While there might be quite a few of them, I believe there’s one that employers value the most. I also believe getting that characteristic can drastically increase your value as a software developer.
How to build Microservices wrong
Microservices have got a lot of traction last year. It’s always interesting to read about success stories other people have; they tend to inspire you to try this new trend out in your own project.
However, there are several traps you can fall into if you follow this trend without deep understanding of its fundamentals. Today, I’ll share some bad practices I saw one particular company used on its way to adopt microservices architecture.
Value Objects explained
I’ve already written about base entity class. Today, I’d like to continue with Value Object base class I use in my projects. Also, I’ll share some best practices regarding Value Objects implementation. Value Objects: what is it? An object that represents a descriptive aspect of the domain with no conceptual identity is called a Value Object. Value Objects are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.