I’ve been toying with writing an application that would be a review engine of sorts. This would be useful on my headphone review site www.headphonereviewhq.com and I have ideas of other places I could use this. It would also allow me to do some meaningful coding that I could use for examples on this site so it’s a win-win-win situation. In thinking of this design though, I’ve been trying to come up with a flexible database design that would work without creating massive amounts of overhead to manage. So, let’s get started with my thoughts… [Read more…]
In some environments, using dependency injection (DI) and inversion of control (IoC) are not only a nice-to-have, but an expected requirement. And while DI and IoC can provide a nice abstraction away from your concrete classes, there are times, when working in a brownfield application for example, that you might find yourself in the position of simply not having the luxury of time to wire in one of these frameworks. However, that does not mean that we can not strive to accomplish what these frameworks aim to provide for us: loose coupling.
So with that in mind, I want to share a method of loosely coupled classes by way of reflection. And in the spirit of three letter acronyms (TLA), I call this pattern reflection of control (RoC).
I could start by telling you that wrapping a value type in an Object is boxing. There, we’re done right? I mean, you now know what that means, yeah?! So, you could probably then deduce that unboxing would be taking that variable back out of the object?! SIMPLE! Cool…so then…why do we care? Good question. Let’s see if we can go ahead and answer that! [Read more…]
Unlike Java, C# has a unified type system. Both reference types AND values inherit from system.object which means that you can have a method that takes in both value and reference types by their common parent, System.Object.
These methods are really convenient, but unfortunately boxing occurs when you pass in value types.
However, we’ve come across a nice trick for skipping those operations. [Read more…]
You might have had the anti boxing and unboxing rhetoric pounded into your head.
In the .NET world they’re often mentioned as an unfortunate side-effect of backwards compatibility. A reminder of life before generics…
…before Linq. *shudder*
Let’s take a look at 7 of the reasons why programmers beat up on boxing. [Read more…]
There used to have a wonderful series of “What If?” comics that pondered a few of the important hypothetical questions in the Marvel universe.
We talked about a few of the limitations of interfaces in C# on episode 1, and I wanted to provide a few examples of what we were on about with this fun little twist.
Let’s see what it could look if interfaces, static classes, and anonymous classes supported constructors and some theoretical workarounds for these limitations. [Read more…]