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.
Don't use Ids in your domain entities!
How often do you see code like this in your domain model? public void Ship(int orderId, int customerId, string address) { Shipment shipment = _existingShipments.Single(x => x.OrderId == orderId); if (shipment.CustomerId == customerId) { // Do something } } Seems pretty good, doesn’t it? Well, it doesn’t. I’ve already pointed using Ids in domain entities as a bad practice, but I see developers - even sophisticated ones - write such code over and over again, so this topic definitely deserves a separate article.
Async/await in C#: pitfalls
I’d like to discuss some common pitfalls of async/await feature in C# and provide you with workarounds for them.
I/O Threads Explained
Microsoft has released async/await feature in .Net 4.5. It’s a really great stuff as it significantly simplifies one of the most painful areas - asynchronous programming. Before that, Task Parallel Library (TPL) and Parallel LINQ (PLINQ) were released in .Net 4.0. They address problems with parallel programming - another painful area in .Net.
I often see programmers struggling with a question when to use each of these features. Let’s step back and recall what does it actually mean to be asynchronous or parallel.
Separation of Concerns in ORM
Last week we compared Entity Framework and NHibernate from a DDD perspective. Today, I’d like to dive deeper into what Separation of Concerns (SoC) is and why it is so important. We’ll look at some code examples and features that break the boundaries between the domain and persistence logic. Separation of concerns in ORM There are several concerns we deal with in software development. In most applications, there are at least three of them clearly defined: UI, business logic and database.