Posts

Showing posts from 2016

How to unit Test Entity Framework

So, now we have the picked the best ORM for our purposes, chances are, you want to test it. We all test our code all of the time with close to 100% coverage, right? Yea, that's what I thought. Throughout the years, I've found that most developers don't test their code thoroughly because a handful of reasons: The tests written are too brittle and break with every new feature. It's too tedious to try to and mock out every little thing Its just too difficult; things are abstracted out way too much nowadays and I cant get them to pass  You know, they're not entirely wrong; I've seen code written to perform CRUD on a table that could only be described as 'awful'. Firstly, the amount of code to do that simple operation was just absurd. Secondly, the repository pattern needs to go; it just doesn't make any sense to me to try to anticipate every possible request that's needed and create a member for it (read over-complicating things). Thi

The Never-Ending ORM debate and why its a waste of everybodys time

Image
Whether you are in a startup, an established company or just tinkering around, you've probably come across the same question: "How do I get data from my database?"  Theres always the "hand-rolled" option, but, once again, I will have to reach into my bag of Eddie-isms and pull out: If you want to make an apple pie you can always grab a shovel, a handful of seeds and a big warm pile of horse$@#$ and do it all yourself. Or, you could just go to the store and grab a bunch of apples and start from there. Well, now that that is out of the way, lets assume we don't want to waste our time reinventing the wheel and go with an ORM that gets us past the repetitive cruft of getting the data and mapping it manually. Lets follow the process I outlined in my previous blog ( The Magic Formula to choosing the right piece of software ) and see where the lines take us. OK, I'm a .NET guy, so that limits our scope to a few products. Lets list out the most popular:

The Magic Formula to choosing the right piece of software

Image
Throughout my career software has come and gone and trends flare up and disappear like a shadow into the night and before you know it, there's a new shiny toy sitting on your desktop. That's really what makes our industry exciting and why more and more people are getting into it every day. With that though, there is always the question of which horse do I hitch up to? Do I latch on to the cool ReactJS framework or stick with Angular? Do I move to DapperORM, NHibernate, EFx, Telerik ORM etc etc etc. The options seems endless! and most of the time they are... which is great! but also kinda sucks; how do I pick one over the other?! How do I go to my boss and get them to invest thousands of hours and dollars into a new piece of technology. Well, I've been doing this a long time, and there really is no magic formula (gotcha!) I can recall a blog post by   Chris Aitchison   titled: You are NOT a Software Engineer!  that really resonated with me. The argument is that we ar