8 Tips for Writing Clean Code – Refactoring Exercise

8 Tips for Writing Clean Code – Refactoring Exercise

HomeMilan Jovanović8 Tips for Writing Clean Code – Refactoring Exercise
8 Tips for Writing Clean Code – Refactoring Exercise
ChannelPublish DateThumbnail & View CountDownload Video
Channel AvatarPublish Date not found Thumbnail
0 Views
Get the source code for this video for FREE https://the-dotnet-weekly.ck.page/clean-code
️ Master the modular monolith architecture: https://bit.ly/3SXlzSt
Accelerate your Clean Architecture knowledge: https://bit.ly/3PupkOJ
Support me on Patreon to access the source code: https://www.patreon.com/milanjovanovic

Writing clean code should be your goal when you sit in front of a keyboard. But making your code clean is a matter of experience and practice. I'll show you 8 tips for writing clean code that I've learned throughout my career.

Subscribe to my weekly .NET newsletter:
https://www.milanjovanovic.tech

Read my blog here:
https://www.milanjovanovic.tech/blog

Subscribe for more:
https://www.youtube.com/@MilanJovanovicTech

Chapter
0:00 Code Kata Starting point
0:39 Tip 1 – Principle of early return
2:33 Tip 2 – Merge multiple if statements
3:23 Tip 3 – Use LINQ Any instead of checking the count
3:43 Tip 4 – Replace Boolean expressions with descriptive methods
4:52 Tip 5 – Trigger custom exceptions instead
8:16 Tip 6 – Replace magic numbers with a constant
9:31 Tip 7 – Replace magic strings with an enum
11:00 Tip 8 – Use a result object that conveys meaning

Please take the opportunity to connect with your friends and family and share this video with them if you find it useful.