Welcome to the eighth episode of my course “Becoming a software developer”, which does focus on the good patterns and practices used on a daily basis in the world of the software development.
All of the materials including videos and sample projects can be downloaded from here.
- Good patterns and practices
- Design patterns
Good patterns and practices
There are a lot of good patterns in the world of the software development and I’d like you to beware especially of the following ones:
- KISS (Keep It Simple Stupid) – whatever you do, especially when you write a code, tend to create the small and granular methods, do not name them or variable using meaningless names or single characters, focus only on what’s important and do not introduce complexity if it’s completely unnecessary.
- DRY (Don’t Repeat Yourself) – if there’s a duplicated code (or whenever you see the same code in the N different places) it means that it should be refactored and put into a single class or method. By doing so, you will have just a single place that will need to be maintained (in terms of further development or potential issues).
- YAGNI (You Aren’t Gonna Need It) – we, being the programmers quite often tend to think about the features that might be needed in the future. Not only this, but we tend to write a code, that is currently not needed (and probably won’t be needed for a long time, or maybe even at all). Remember to focus on delivering the features that are part of the current scope, cause the scope of the application tends to change rather often and you don’t want to spend time on something that will have to be completed removed later on.
- SOLID – this one is big, as it stand for a 5 very important practices, which have been greatly covered by many articles and tutorials, so just take a loot at it on your own.
There are tons of patterns, and honestly, I remember just a small part of them that I’m using on a daily basis. Anyway, whenever I need to look for some sophisticated solution and can’t figure it on my own, I would look for a specialized pattern that would help me solve my problem. I do encourage you to get familiar with the design patterns in general, yet do not be afraid if you can’t memorize them all at once, it doesn’t really matter. Once you get enough experience as a software developer, you will quickly realize, that writing a proper and well-designed code is something that comes naturally, and some of these patterns will be applied to your source code even without thinking about it.
However, there a few patterns that are my favorites, so take a look at the following:
- Dependency Injection – part of Inversion of Control using IoC Container, where you can declare a specific interfaces and classes that do implement them that shall be injected by the library into the other parts of your code.
- Strategy Pattern – a way to distinguish between different implemtantations of the particular interface (e.g. SQLDatabase, InMemoryDatabase etc.), works great with DI.
- CQS – command & query segregation, I did describe it already here.
- Commands – I also did describe it already here.
- Events – guess what, I also described it already here.
In the next episode, we’ll finally start working on the application. We’ll also discuss the way that the work will be done in terms of managing tasks and so on.