The Perfect C# Console Application…Or Not.



There are certain best practices every C# application should follow, right? Probably DRY, SOLID, Logging, Dependency Injection, Localization, Separation of Concerns, and Unit Testing at the very least. These seem like obvious things that every application should have. In this video, we are going to do something a bit unique. I am going to show you how to do all of those things, and I am going to show you why you shouldn’t always do those things. We are going to build the ultimate Hello World application. You won’t want to miss it.

Full Training Courses: https://www.IAmTimCorey.com
Source Code: https://leadmagnets.app/?Resource=PerfectConsoleApp
Patreon: https://www.patreon.com/IAmTimCorey
Mailing List: https://signup.iamtimcorey.com/

31 Comments

  1. Thanks for the video. Is there a way to log messages to a separate console? I found a few examples where the instruction .AddConsole() is used, but it does not seem to create a saperate console..

  2. A very good video. I don’t like the exception-driven development—if you can’t find the language or the key, log the error and then throw the exception to exit the program.

  3. "We're gonna build. . . the ultimate hello world application."

    Me: puts popcorn in the microwave and turns off phone.

  4. Instead of looping args:

    string result = "en";

    int i = Array.FindIndex(args, m => m.StartsWith("-lang="));

    if (i > -1) result = args[i].Split('=')[1];

  5. I have been working as desktop application developer since 2018, so far I learned C#, Entity Framework, WPF with MVVM pattern , LINQ & Microsoft SQL server

    now I want to learn and explore web development in .NET however I don't understand where to begin, especially in backend. I need your guidance Tim Corey

  6. I really appreciated your comments in the last 10 minutes of the video about being pragmatic. In some cases, the added complexity is justified (or even necessary). In other cases, the simple approach is best. It depends. Thanks for having the guts to say it.

  7. Awesome video, I do agree with you, a developer must knows the best practices but must not have it in every project. However, the developer must be careful with being pragmatic like this, depending on the company or the position of this dev, this may sounds lazy and lack of dev skills.

  8. Am I the only one who finds it ironic that it takes an hour video to explain yet another best practice- YAGNI (You Aren't Gonna Need It)? I do love the video, but the irony amuses me.

  9. I love this. This is an incredibly valuable lesson that usually can only be learned from making mistakes and learning the hard costly way. Been there many times. Lured by delusions of grandeur. Thanks Tim awesome video.

  10. So Tim here just built a bionic arm that can find and scratch the back of his head even tough he has a perfectly healthy hand. I love it.

  11. A CommandLine parser (such as commandlineparser package) to simplify the syntax of manipulating passed arguments would add to perfection!!
    In fact, this was the only part of your app, where you saw some minor inconvenience!

  12. I noticed that you didn't create an interface for App and just instantiated the concrete type directly. Is this a case where an interface is overkill or is it a shortcut and a real app should have the IApp interface?

  13. Hi Tim.
    I totally agree with you that adhering to all practices and principles should come with requirement and not suggestions. I like that phrase so much I put it on my social media status 😂.
    I inherited a project recently that implemented mediator pattern and a few other techniques that could have been avoided, don't get me wrong I think mediator pattern is fantastic but just like you I also like to write simple code to the point that a new developer should be able to understand my code without stress hence my preference to avoid unnecessary complexity and techniques. I think a lot of developers start to adopt complexity into projects from inception of the project because they always want to create room for the extensibility when the project grows to a massive scale, but not all projects grow to that point. How then can a developer identify a project that may or may not require complex principles and patterns? because introducing such principles after the early stage of a project could require more work.

  14. I am new to your channel and with your extended absence I started thinking I came too late as you clearly took your early retirement ! This didn't surprise me given my usual bad lack, always late to the party 😡
    Now, with this good stuffs, not only you showed me wrong, but also it was worth the wait… Thank you Tim, keep it up <3

  15. 17:32 I recently discovered that one can simply use First with a conditional, like so:

    CustomText? messages = messageSets?.First(x => x.Language == language);

    I haven't done any performance comparisons, but I feel like it's cleaner. One could argue that it's not as clear as Where –> First.

  16. Hi Tim, the request isn't related to video.
    I have a class library with repository, but this repository needs settings that are in Ui project, because are stored in settings.settings file and I can't pass this static class to repository, so I have created a dictionary with informations and passed to the repository, is a good way to proceed or you suggest another strategy?
    Thanks in advance.

Leave a Reply

© 2023 53GB