Books

Code Complete, 2nd edition. It’s about the construction of software and the design that goes in the small parts of the code you write. The book is huge, so reading it might take a while, but it’s still very relevant and useful. The Clean series (Code, Coder, Architecture), those 3 books deal with different aspects of the … Read moreBooks

Replace switch statement with strategy pattern

using NLog; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Http; using System.Net.Http.Formatting; using System.Web.Http.Filters; using TaxMs.DTOs; using TaxMs.Infrastructure.CustomExceptions; using TaxMs.Infrastructure.Extensions; namespace TaxMs.ApiNet.Filters { public class AlertServiceFilter : ExceptionFilterAttribute { private readonly Logger _logger = LogManager.GetCurrentClassLogger(); public HttpStatusCode GetStatusCodeFromException(Exception exc) { if (exc is ArgumentException || exc is FileNotFoundException) return HttpStatusCode.BadRequest; if … Read moreReplace switch statement with strategy pattern