Category: Dependency Injection

Book Review: C# Smorgasbord by Filip Ekberg


Book Review: C# Smorgasbord by Filip Ekberg

About the Author:
Filip is a Software Engineer working with various techniques such as C#, WPF, WCF, ASP.NET MVC, ASP.NET and much more. Currently working at Star Republic in Sweden as a Software Engineer working with both newer and older technologies in a Windows environment, mainly focusing on ASP.NET MVC development.

During his years of Programming, Filip has managed to accomplish some of the following:
• Software Engineering Degree @ Blekinge Institute of Technology
• Managing the Software Development Company SmartIT eSolutions Sweden which focused mainly on developing software and web solutions.
• Working as an Amanuensis ( Teacher ) @ Blekinge Institute of Technology teaching Java, C++, Sql and Network-programming.

You can read more on his blog here.

I saw a tweet from @daniellangnet who said this book was fantastic and if your looking for something to read over the holidays then give this a go, I actually ordered the book without even reading anything about it, unusual but glad i did!

Chapter 1: Introduction to Parallel Extensions :- Learn the basics of paralleization, use basic Linq, and how to optimize code by introducing parallelization.
Chapter 2: Productivity and Quality with Unit Testing :- Understand why tests are import, create a test project and improve code quality.
Chapter 3: Is upgrading your code a productive step? :- How to find bugs faster, How to use Resharper to get a more manageable project and to get things done faster.
Chapter 4: Creating a challenge out of the trivial tasks :- Challenge yourself to create understandable and higher quality software.
Chapter 5: Asynchronous programming with async and await :- Identify where yo might need asynchronous processing, refactor a synchronous app into becoming more responsive.
Chapter 6: Dynamic program :- Create and extend a dynamic object by using the ExpandObject, also understand why introducing dynamic objects might cause problems long-term.
Chapter 7: Increase readability with anonymous types and methods :identify where you might have single purpose methods that you can replace with anonymous methods for increased readability and lucidity.
Chapter 8: Exploring Reflection :- User reflection to get information about types at runtime and understand more about properties and methods.
Chapter 9: Creating things at runtime :- Create your own method at runtime using Reflection, be able to read IL and understand portions of it.
Chapter 10: Introducing Roslyn :- Create a basic code analysis that suggest issues in your code, run code snippets on entire code files.
Chapter 11: Adapting to Inversion of Control :- Understand the basics of Inversion of Control, introduce a Dependency Injector into your application.
Chapter 12: Are you Mocking me? :- Create a mock of any interface and write tests that introduce

This book as you can see has something for everyone, i have thoroughly enjoyed reading it from cover to cover and will be reading a good few of the chapters again, it’s a very handy reference book and covers a number of topics that as a developer can help you explore, improve and be inspired – just as it says on the front cover.

I picked this book up on Amazon for £19 and its well worth it – recommended reading for 2013.

AspConf – My Review

Last week we had AspConf – “aspConf is a virtual conference focused on one thing: showcasing the ASP.NET stack as the platform for great web applications.

Over 2 days they had 5 virtual rooms used to present lots of fascinating stuff on .Net, including talks about all manner of things in the Asp.Net world.

The sessions on both days covered topics such as, Async in .Net 4.5, Glimpse, TDD, Azure and Cloud Computing and lots lots more, you can read more about the sessions here.

Although it had some technical difficulties, due to its popularity I may add, the conference is an awesome way to learn for free – and free is always good. It’s a superb way to learn about content you havent had time to look at it, or new technologies you havent heard of. Hopefully next year they might try to use something different from livemeeting.

If you missed any of the session then fret not, most of them if not all of them were recorded and put up on Channel 9 here

I only managed to see sessions from day 2 so I am off to go watch more content on Channel 9 – a great resource for free learning.

Book Review:- Dependency Injection in .Net

Dependency Injection in .Net written by Mark Seesman @ploeh on twitter

This book is one of the best books I have read regarding .Net development due to its style – it covers misconceptions, what not to do, and then shows you step by step what to do and why. If you’re looking for the definitive guide to dependency injection as a subject matter within the .net world then buy this book – don’t bother with anything else.

My main reason for reading this book was to basically make sure my understanding of the subject matter wasnt distorted from what dependency injection and IoC is. It’s quite easy to good articles on the subject but I wanted a point of reference I can pick up or go to when I need to refresh my memory on the subject.

I am willing to bet there are a lot of developers who don’t actually understand what dependency injection is used for and what it brings to the table.

Part 1 Putting Dependency injection on he map

  • Chapter 1 – Covers misconceptions about dependency injection and what its purpose and the benefits if it are.
  • Chapter 2 – Explores a comprehensive example, starting by showing you not to do and then discussing why not and then shows you how it should be done properly.
  • Chapter 3 – Explores Dependency Injection containers and DI containers.

Part 2 DI Catalog

  • Chapter 4 – DI Patterns, including constructor injection, property injection, method injection and ambient context, of which I really only understood one before reading this part of the book. Each is taken in turn and described, has a code example, and discusses the advantages and disadvantages of each.
  • Chapter 5 – DI AntiPatterns, covers all the different wrong ways to do dependency injection some of them named by Mark who admits to having done all of them, having read through this chapter I recognised a few.
  • Chapter 6 – DI Refactorings, how to spot issues and basically ways to fix the code so that its using proper dependency injection methods.

Part 3 DIY DI

  • Chapter 7 – Object Composition, how to correctly use and setup object composition in different types of .net applications.
  • Chapter 8 – Object Lifetime, managing dependency lifetime disposable dependencies and more.
  • Chapter 9 – Interception, cross cutting concerns, AOP and dynamic interceptions.

Part 4 DI Containers

  • Chapter 10 – Covers Castle Windsor.
  • Chapter 11 – Covers StructureMap.
  • Chapter 12 – Covers Spring.Net.
  • Chapter 13 – Covers Autofac.
  • Chapter 14 – Covers Unity.
  • Chapter 15 – Covers MEF.

This book was enjoyable to read and is all you need to know about DI in once place – go get it now.