December 14, 2021

Tips for .NET Dev, Part III

.NET Professionals

IT Tips & Insights: A Softensity Senior Software Developer wraps up his three-part series on .Net development. 

By Gabriel Cordeiro, Senior Software Developer

The following is the third part in a three-part series. Get tips on Object Initializers in C# in Part I, and learn about magic strings and regions in Part II here.

Learn Concepts and Know When To Use Them

During my career, I’ve met many professionals that say “I know SOLID, clean code, clean architecture. I use design patterns.” I usually ask them a question about inheritance or abstraction, and they are often not able to answer it, or even explain. Don’t get me wrong, you don’t need to know a very complex explanation about those concepts, but when you have a scenario where you can apply the strategy pattern or maybe a factory and you can’t see it, you don’t know design patterns. Same rule for a class that has more than one responsibility; it’s not closed to modifications and hard to test.

Programming principles are very important, and in my opinion, we often don’t take them seriously. In many cases, we don’t learn them very well, we hit the surface and tell ourselves “that’s enough.” We think that we know, but we don’t. At least that’s what happened to me when I had around three years of experience. I told myself “I know OOP,” but I wasn’t using inheritance correctly, abstract class and generics (in .Net). So I decided to study OOP, design patterns and SOLID.

I had to read books and articles. I had to watch videos, and take web courses from popular platforms. But I have truly learned by coding, creating new projects and repositories on Github with a few design patterns. Basically, everything I could do to practice my skills, trying a new architecture using DDD concepts or event-architecture approach. After some time I found myself overkilling the architecture, or some feature, and here it’s a question for you: 

Where is the limit between fast deliveries and quality?

The answer? A concept called KISS: “Keep It Simple, Stupid.” Or, if you prefer, “Keep it short and simple.” Of course you can keep it simple using all of the concepts above, you just need to have experience and know when/where to use them. 

How can we create simpler code? Using abstractions, yes — one of the four pillars of OOP. How can we make a testable class? Using the SOLID principle, like single responsibility and open/closed principle. And finally, how can we make good architecture? Understanding the level of complexity in your project and drawing a design that is no more complex than required.

To make a long story short, learn OOP, SOLID and design patterns. Create projects using those concepts, and try different ways to fix the same problem. And the most difficult: Learn when you need to use them.

About

Hey there, I’m Gabriel. I’m 24 years old and I’ve been a software engineer for almost 7 years. Currently, I’m a Senior Software Developer at Softensity. Most of my experience has been coding with C# from Microsoft, and I’ve learned a lot of cool things in this amazing language, so I thought I’d share some tips, both for C#, and programming in general. 

Join Softensity’s Team

BACK TO MAIN PAGE

Let’s Talk