Let me start with saying that in this post I will explain why I think Dependency Injection is a better way to solve cross cutting concerns than AOP. I know there are heavy debates for each side, but I will try to explain my motives. I will only be talking about DI in the context [...]
Blog
The N-layer myth and basic Dependency Injection
Dividing an application in N layers is considered a standard and a best practice. It is often thought that this automatically creates a decoupled application. However, just creating layers doesn’t make your code loosely coupled. A typical N-layer application Let’s take a simple layered application: 1. A typical N-layer architecture In the above image you [...]
JavaScript Namespaces and Modules
Namespaces In most programming languages we know the concept of namespaces (or packages). Namespaces allow us to group code and help us to avoid name-collisions. In c# for example you have this declaration namespace MyNameSpace { public class MyClass { } } If you want to use MyClass, you need to do explicitly say in [...]
Javascript hoisting explained
Often I see problems arise when people try to tackle Javascript. Taking a certain behavior for granted can get them frustrated. Javascript has little differences but they can cause unexpected results if not taken into account. One of those differences is the way it handles scope. What is hoisting? In Javascript, you can have multiple [...]
Must-have NuGet packages
NuGet is awesome! There are so many packages though that it’s very difficult to know which ones are useful and which can be missed. Therefore I have created a list of the NuGet packages that I find most useful when developing for Windows Phone and Windows 8. So here you go: JSON.NET Although JSON serialization [...]
Portable class libraries or source code sharing?
Earlier I wrote a blog post on a specific method to implement code sharing between Windows Store and Windows Phone applications. In this post I want to zoom out a little bit and look at the different techniques available and explain what the differences and advantages are. That way you can employ these techniques in [...]
Tombstoning made easy in Windows Phone MVVM
Tombstoning your application data in Windows Phone can be tricky when you are using the MVVM pattern. In order to save your data you have to do it between the NavigatedTo and NavigatedFrom events of the page. In your ViewModel you don’t have access to these events. So in order to do that you need [...]
Patterns for sharing code in Windows Phone and Windows 8 Applications
Background With the latest batch of releases in Windows Phone 8 and Windows 8 Microsoft has been trying to close the gap between both development platforms. (The old “write once, run everywhere”-idea)Although both platforms are based on the same Windows 8 kernel, there certainly are quite a few differences. One key piece of interoperability between [...]
Breaking dependencies to make your code testable
This entry is part 4 of 4 in the series Effective Unit testingIn my previous post I explained how you could use “Extract Interface” and “Subclass and override” as effective techniques for breaking dependencies and get existing code under test. In some situations there are other methods either more appropriate or easier to implement. Simplify [...]
How to unit test and refactor legacy code?
This entry is part 3 of 4 in the series Effective Unit testingWhen you first start writing unit tests, you probably already have quite a large working codebase. Now, how can you start writing tests for this code? Usually this code isn’t written with testing in mind and it’s probably very hard to test. Your [...]