Friday, July 25, 2014
Still Stumped: Entity Framework 6 and ‘Bounded Contexts’

Ok, I still can’t figure out how to do this.  It has to be possible.  My Google-Fu is usually phenomenal, but it is failing me here. 

I’ve ‘dumbed it down’ to a very simple scenario.  Suppose I have two EF contexts.  Each one references two tables, the same two tables, from the same database, and I use the ‘Generate from Database’ option in EF 6.  In this case, I am mimicking  two bounded contexts, the shopping BC and the checkout BC.  Each one needs to reference the Cart and CartItem tables and generate those entities accordingly.  Here are some pictures to illustrate.

Shopping BC:


Here’s the Checkout BC:


What I expect, and what was possible using EF 5 and before, using the Legacy ObjectContext option, was that by adding custom namespaces, I could have, e.g., a Shopping.Cart object and a Checkout.Cart object, which will be created using different contexts, and used in different scenarios.  It should be obvious why this is important.

However, what actually happens is this:


Depending on I know not what (what file is in focus?  Barometric pressure?  The Yankees’ pitching staff’s ERA?), the Cart and CartItem classes will be generated by T4 either under or  Always together, but always under one.  They should be generated under both, with different namespaces.

As readers of this blog know, I am lazy, stupid, slow and old.  Something just out of the box should work here.  But, even though I am lazy, stupid, slow and old, I’m willing to hack some .tt files if needed to get this to work, as I don’t want to be ‘stuck’ using Entity Framework 5 for the rest of my fricking life. 

I was hoping, as has happened in the past, that by writing this blog post out, I would stumble upon the obvious solution.  I’m still hoping for that, as it often happens after the ‘publish’ button is pressed.

Why doesn’t this just work?

posted @ Friday, July 25, 2014 7:57 PM | Feedback (2)
Thursday, July 24, 2014
Quick Surface Pro 3 Review

Summary: mostly good.

I was able to trade in an old MacBook Air for about $600 and use it toward an i5/8 GB/256 GB Surface Pro 3 about a month ago.  After having used it for a month, and after having used MBAs for 3 years or so (running Windows mainly on them), I have a few comments.

I realize that Retina MBAs are coming in the fall (supposedly), so it is a bit of an unfair comparison at this point, but the “pixel free” (or however the hell Microsoft describes it) ultra dense display is really quite fantastic.  I looked at a Retina MacBook Pro in an Apple store a couple of years ago and didn’t immediately notice a difference, but you really can tell the difference with this sort of display.  There is the occasional app that can’t quite look right in Windows, and since I’m old (and slow and stupid) I have to blow things up a bit more than others might, I love it.

I use it as my main dev laptop, and I can’t really complain about anything in that regard.  I don’t run VMs, but my equivalent is still the 100+ browser tabs I have open (I’m currently using Chrome Canary and Waterfox) and I almost always have 3-5 Visual Studio instances open at one time, and everything seems peppy.

There are a few quirks.  Despite the fixes that have been pushed out, I still have to manually disconnect and reconnect my home wireless connection when I come home at the end of the day (otherwise, I don’t have internet access).  The keyboard itself is okay, I’ve gotten used to the actual tactile feel of it, but I will still have an issue where the side charms will activate for unknown and unintended reasons (update: if you swipe on the trackpad as if you were swiping the screen, this happens.  However, it is a little sensitive for my tastes, as the trackpad is a bit small and so it is happening accidentally more than I’d like.  But, at least I know why now.  Duh.).  Also, within the last week or so, I have trouble putting the sucker to sleep unless the keyboard is attached (it wants to shut it down instead when the power button is pressed).  The world would be a better place if these annoyances didn’t exist, but I can live with them fine.

And I like reading online magazines and other things while riding the train into work and all that stuff.  It is a bit large for a tablet, but that doesn’t really bother me either.

So, overall, I like the thing, quite a bit.  Kinda interested in the new Retina MBAs, but still…..

Oh, and about battery life, I have almost nothing useful to say.  My entirely unscientific results from riding the train suggests I use between 10-15% an hour, but I don’t really know what I’m doing with my power settings, by which I mean I have the thing to use high performance, but set those settings to be more like battery saver (or whatever it is called) when it is unplugged.  But until I have a transatlantic flight, I can’t really say how it is.

posted @ Thursday, July 24, 2014 7:31 PM | Feedback (0)
Wednesday, July 23, 2014
Installation problem: Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2013

This download appears to have an issue with Visual Studio 2013.  I installed it last night, then was worried when I found that some of my projects were now marked as being incompatible with Visual Studio 2013 (Premium, if it matters).

Turns out that it rolls back Visual Studio 2013 to RC3 version.   Actually, I’m not sure what it does, I misread that I have Update 3 RC installed, maybe they are incompatible or something.

Thank God for System Restore.  Ugh, I take that back.  Even with System Restore, things are totally horked.  It seems to be because it installed VS 2012 and so all sorts of associations are messed up, and System Restore didn’t fix it, probably because I didn’t have enough system restore check points.  Will probably have to wipe and restore.  Sigh.


posted @ Wednesday, July 23, 2014 10:55 AM | Feedback (0)
Tuesday, July 15, 2014
I hate enclosed/extra commas in comma delimited files

The end.

posted @ Tuesday, July 15, 2014 11:05 AM | Feedback (0)
Saturday, July 05, 2014
Testing your developer skills – Rewrite some code from a language you don’t know into a language you know

Here’s something that I had to do today, but which it occurs to me is something that I could try to do more often.

I needed to write some code to do X.  For whatever reason, the only sample code that I could find that did X was written in language Y, except that I don’t really know much about language Y.  I didn’t know how to run it or debug it or anything, though I was able to read it enough to see roughly what it did and how it did it, so that I could re-write it in language Z, which in my case is C#.

By doing so, I now know a little bit more about language Y.  I don’t care about language Y, so it isn’t that much of a gain, but it was a slightly taxing test of abilities.

posted @ Saturday, July 05, 2014 10:42 PM | Feedback (0)
Friday, July 04, 2014
Brief review – Pluralsight’s Pragmatic Behavior-driven Design with .Net

I had a much longer review planned initially, but am instead just going to write down a few notes here.

Really short version: do not watch this thinking you are going to learn how to do BDD. 

Rob’s latest entry concerning BDD is really disappointing on a number of levels.  He ‘introduced me’ to BDD through his Kona webcast originally, and so I generally look forward to anything he has to say about the subject, but the overall quality of this online course was pretty lackluster, in many respects.

He starts off strong, pointing out that BDD really has nothing to do with tools or frameworks, which is spot on.

He then undercuts this throughout the rest of the webcast with his use and championing of NCrunch, a tool in search of a need <digression>seriously, I’m sure that someone could make an argument for this tool, but if you are developing such that you need ‘instantaneous’ feedback on whether your tests pass, you are doing it wrong</digression>, that also doesn’t appear to work as expected (there’s a seeming litany of “I wonder if this is working right” comments in the webcast, which seems significantly less polished than many of his previous efforts).

But moreover, a developer dicking around writing code in the absence of clear requirements and interaction with business users is what I would currently consider to be the antithesis of what BDD is all about (and no one gives a shit about emailer code anyway).  There’s nothing worse than a developer designing any sort of significant business impacting code without working with the business.  Ok, I take that back, a group of developers doing this is worse (which I experienced recently).

Some developers seem to regard the end users of the software they write as idiots who don’t know what they are doing.  I understand this, because, let’s face it, sometimes it seems pretty accurate.  But, more often than not, it’s the end users that know what they are doing, regardless of how technologically savvy they may happen to be, and it is they who know what code needs to be written (even if/though they wouldn’t know how to write code to save their lives, but I digress).

To be (somewhat) fair, it would be difficult to create an easily consumable webcast that shows how proper BDD is to be done.  “Hey Bob, how should this software work?”  “Well, Steve, it needs to do thus and so.” “Well, thanks Bob!”  Not very compelling on the face of it.

But, caricatures aside, that is what proper software development is really all about, a collaborative interaction between developers, end users, stakeholders, and the like. 

posted @ Friday, July 04, 2014 4:41 AM | Feedback (0)
Thursday, July 03, 2014
Backing up OSX with Time Machine to a Windows Server

The steps are pretty basic.  This works up to Mavericks, as of this writing.

  1. Tell Time Machine to support unsupported volumes.
  2. Create a sparsebundle
  3. Move the sparsebundle to the unsupported volume.
  4. If necessary, increase the size of the sparsebundle
  5. Mount it
  6. Tell Time Machine that the unsupported volume is the destination
  7. Run Time Machine

This is mainly for me, I’ll update the specifics as I care to.

posted @ Thursday, July 03, 2014 2:08 AM | Feedback (0)
Sunday, June 29, 2014
Microsoft Surface Pro 3 Macbook Air Trade In Value

When it came out that Microsoft was offering up to $650 trade-in value for a Macbook Air to apply to the cost of a new Microsoft Surface Pro 3, I decided to take a look.

I had a 2011 2 GB MBA, and was concerned how much it would bring, but was happy to find I got around $550 for it, so I now have a mid-level i5, 8 GB RAM, 256 GB SSD Surface Pro 3.

Just starting to play with it, I can see things I don’t like as much as with an MBA, but other things that I do like.  The biggest immediate issue is that the screen is very reflective, so I have to pay more attention to ambient lighting, but I think that is manageable.

Minor tip: when setting up the Pen, put the battery in the right way, it tends not to work as well if you don’t.

posted @ Sunday, June 29, 2014 3:53 PM | Feedback (0)
Monday, June 23, 2014
TDD isn’t dead, it’s dumb

DHH had a post about TDD which apparently has raised a lot of comments.  The usual suspects have replied, showing once again they don’t get it (and in this case adding one of the dumber discussions of monogamy I’ve seen in a while….then again, he’s a developer sort, so, you can’t really expect much).

DHH says:

But first of all take a deep breath. We're herding some sacred cows to the slaughter right now. That's painful and bloody. TDD has been so successful that it's interwoven in a lot of programmer identities. TDD is not just what they do, it's who they are. We have some serious deprogramming ahead of us as a community to get out from under that, and it's going to take some time.

I certainly agree that TDD is a sacred cow for some, and a part of some programmer identities, but I most certainly do not agree that it has been “so successful”, going so far as to posit that it hasn’t been successful at all, from almost any perspective.  The vast majority of test suites that I have encountered have been inadequate, unmaintained, meager, or even worse, have created horribly conceived code bases that are based on myopic opinions about testability, as opposed to what makes for well conceived code or properly driven software development.

Uncle Bob’s response is enlightening in ways he certainly didn’t intend, but I want to focus on one thing he says in particular, what he apparently thinks is the most important thing:

If you have a test suite that you trust so much that you are willing to deploy the system based solely on those tests passing; and if that test suite can be executed in seconds, or minutes, then you can quickly and easily clean the code without fear.

Think about this for a minute.

Cleaning code doesn’t even make it into the top five on the list of most important developer practices, and most definitely not even in the top twenty of most important software development practices.

He talks about how clean code allows developers to code quickly, and without fear.  Simply for the sake of argument, I will accept this for the moment.

But being able to quickly code poorly conceived code is not a good thing.  Most importantly, it’s the wrong focus.

Let me repeat for emphasis, it is the wrong focus.

The proper focus involves determining the proper business requirements and executing them. 

Testing itself, properly conceived, is within the top five of most important developer practices, and at least cracks the top ten of most important software development practices.

But TDD, paradoxically, typically (though not always) leads not only to bad code development, but bad testing itself.

To be a good developer, one really needs to stop thinking and being just a developer, and learning the techniques of TDD but abandoning the dogma of it is probably a necessary step in that direction.

posted @ Monday, June 23, 2014 12:09 AM | Feedback (0)
Thursday, March 27, 2014
Date UTC format has zero index months

So, like, if you have January, it, like, is 0, not, like, 1.  And, like, so on.

Just in case you run into this.

posted @ Thursday, June 05, 2014 8:35 PM | Feedback (0)