Dependency Injection best practices and anti-patterns

I really enjoyed this article regarding DI, as it’s targeted towards people who don’t have a ton of DI experience, or don’t even know what it is. https://mtaulty.com/2009/08/10/m_11554/ What’s Unity? It’s a “dependency injection container”. Now, at that point a bunch of folks reading this will say “Yes, we know and we’re already using it … Read more

the significance of java RMI please? [closed]

You really should not be using RMI for any application you build today, basically for the reasons you just laid out. In some cases (diving into legacy or “enterprise” applications) you just have no choice. However, if you are starting a new project, other options are: REST + JSON over HTTP The de-facto standard for … Read more

Ravioli code – why an anti-pattern? [closed]

Spaghhetti: Spaghetti code is a pejorative term for source code Ravioli: Ravioli code is a type of computer program structure, characterized by a number of small and (ideally) loosely-coupled software components. The term is in comparison with spaghetti code, comparing program structure to pasta; It’s comparing them. It isn’t saying it’s an anti-pattern. But I … Read more

Embedded systems worst practices?

Uninitialized exception vectors (you know, for the ones that “will never be reached”) Say it with me: Global variables. Especially ones shared between ISRs and tasks (or foreground loops) without protection. Failure to use “volatile” where necessary. Having routines that DisableInterrupts() and then EnableInterrupts() paired up. Got that? Not RestoreInterrupts(), but ENABLE. Yeah, nesting. No … Read more

How to prevent the arrowhead anti-pattern

I’d go for the multiple return statements. This makes the code easy to read and understand. Don’t use goto for obvious reasons. Don’t use exceptions because the check you are doing isn’t exceptional, it’s something you can expect so you should just take that into account. Programming against exceptions is also an anti-pattern.

C# Antipatterns

Rethrowing the exception incorrectly. To rethrow an exception : try { // do some stuff here } catch (Exception ex) { throw ex; // INCORRECT throw; // CORRECT throw new Exception(“There was an error”); // INCORRECT throw new Exception(“There was an error”, ex); // CORRECT }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)