Month: March 2014

WebAPI Blitz

Had a good buddy ask me a few minutes ago about exposing data entities in WebAPI. It’s quick, and almost painless…

Start with creating a new project called WebServices or the like in Visual Studio 2013. Select the WebAPI profile – we’ll only need MVC/WebAPI pieces, not webforms, for this sample.

Start with an Entity Framework data model – here I used the Purchasing.Vendor table from AdventureWorks2012. If you don’t have EF, but it’s POCO, no biggie – you can still right-mouse click on any of the entities and generate views/controllers. Build the project – EF uses Reflection so we need to run a build to work with these entities and expose them in WebAPI.


Right mouse click on the Controllers folder and select Add, New Controller.

In the next screen select the Web API 2 Controllers option.

In the following screen, select your exposed table and make sure you generate a new Data Context as below. I always use the async controller actions by default.

Visual studio will think a little, and then you’ll see the auto-generated class. Look at all those scaffolded goodies!

Run a publish, and navigate using one of those handy REST api calls documented above. For example, sending <myserver>/api/Vendor returned this:


I’m going to attach the ZIP folder of the project. So easy, it feels like stealing!!! WebAPISample


For more detail, see the post here –




Architectural patterns in Microsoft-land: Gathering requirements

Currently we’re examining different ways of coming out with a second version of our shopfloor software, and there’s a lot of pressure to start rolling out a UI – even ahead of a stable data layer, or wireframes of how the end users want to have it interact and display information to our user base.

UI code is expensive. Putting a few days into asking some basic questions about unspoken requirements is cheap. Otherwise, you’re faced with the age-old “you gave me what I asked for but not what I wanted” relationship-ender that’s the bane of so many IT projects.

Usually business and user requirements will be defined (to some extent) at the beginning of the process. Let’s talk about system requirements – both functional and non-functional.

Functional requirements (what the system must do – “the system shall notify the administrator when a package fails) include things like the following:

  • Business rules
  • Admin functions
  • Authentication, auditing, security
  • External interfaces
  • Reporting
  • Historical data
  • Regulatory requirements

Non-functional requirements (how the system should operate – “what’s an acceptable amount of uptime?”) include:

  • Scalability
  • Capacity
  • Availability
  • Reliability
  • Recoverability
  • Maintainability
  • Performance
  • Security
  • Regulatory
  • Manageability
  • Usability
  • Interoperability

Actual users will help you with the functional requirements; non-functional requirements will come from stakeholders. Once stakeholders are identified, you can gather requirements with a variety of methods (interviews, focus groups, questionnaires, observation (either direct or indirect), documentation, and researching similar projects.

Once this is done, you could split up your target audience into personas (including a name, photo, demographics, a descriptive paragraph, and needs/goals/features from a user perspective). Once this is done, you can refine your broad list of requirements into a very fine-tuned list of requirements – including a rationale, success criteria, and a level of importance. This key and often overlooked step will help you deliver a project that the users need, instead of just what they want.

For my project, I doubt I’m going to go as deep into the sensy-style personality demographics that some do – for an internal system we’re not customer-focused enough to care where someone falls on the liberal-conservative or trendy-status quo axis. But I will take the time to recognize that we have three user types – Operator, Engineer, Admin, and Executive – and split up broad requirements into a more focused matrix. This will give us an actionable list of to-do’s, so we won’t waste time writing UI code that doesn’t fill a specific need. Something like this…


As I refine this and get a survey going – our stakeholders are tied up 90% of the time in meetings, so an online survey on SharePoint or SurveyMonkey may be the go-to solution – I’ll create some new posts. I’m happy that we’re being a little more methodical in our second version of the software. Nothing’s worse than thrash when it comes to developer happiness and productivity!


Helpful links:

Hot interview tips.


Here’s some good interview tips when you sit down in front of a panel:

  • Use first names. Most people only want to talk about themselves. Me, me, me…. WRONG! On a single sheet of paper, as large as possible, you write down the interviewer(s) name – and refer to that person by FIRST NAME. “You know, Jim….” This is powerful – since people that are referred to by their first name are friends, this tends to break down walls.
  • Clarify. When they ask a question, ALWAYS ask them to clarify that to narrow scope. This shows you’re listening and gives you time to respond. To a question about what you’d do if it started to rain, you say – “You know, Jim, I want to know what the nature of the rain is and what time of day it’s raining.”
  • Have 3 STAR stories, memorized. A STAR story is a Situation/Task/Action/Result, about 20 second long success stories – SPECIFIC to that position. “What I did with the team was… the result was we figured it out.” Keep them short but powerful.
  • Always be closing. For your close, when the interviewer asks if you have any questions, say something like – “First of all, I’m so excited about the opening and to meet the team. In the short term, if I was to come onboard, what do I need to accomplish for you in the first 60 days?” Then go back to your STAR story and tell them you’re confident you could do that. Your second question is, “Over the next year, what do I need to do to get you a gold star with your boss? Is there a project or initiative that you’ll need me to take care of?”
  • Handshake. Look them in the eye, a firm handshake, “Hey, thanks so much, I would like to work with and learn from you.” That phrasing is very important. There’s going to be people you’ll meet that’ll feel threatened by you – if you use the word “learn from”, that is saying you’re humble and ready to learn – as a subordinate, not a threat.

Does this feel sneaky? Dishonest? It shouldn’t. You genuinely do want the position, right? And isn’t it in everyone’s best interests to keep your responses short and not fill the room with a lot of hot air? If you are projecting the image of who you are, that’s not dishonesty – it’s putting your best foot forward. These tips came from a life coach – a psychologist – and a friend of mine paid thousands of dollars for these five tips. Try them, and see if you don’t have easier interviews that actually go somewhere.

Dave Barry’s 15 things


This is floating around the internet; there’s different versions (anywhere from 15 to 19 to 25) – all are funny.

Dave Barry’s 15 Rules To Live By (That Took Me 50 Years To Learn)

  1. Never, under any circumstances, take a sleeping pill and a laxative on the same night.
  2. If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be ‘meetings.’
  3. There is a very fine line between ‘hobby’ and ‘mental illness.’
  4. People who want to share their religious views with you almost never want you to share yours with them.
  5. You should not confuse your career with your life.
  6. Nobody cares if you can’t dance well. Just get up and dance.
  7. Never lick a steak knife.
  8. The most destructive force in the universe is gossip.
  9. You will never find anybody who can give you a clear and compelling reason why we observe daylight savings time.
  10. You should never say anything to a woman that even remotely suggests that you think she’s pregnant unless you can see an actual baby emerging from her at that moment.
  11. There comes a time when you should stop expecting other people to make a big deal about your birthday. That time is age eleven.
  12. The one thing that unites all human beings, regardless of age, gender, religion, economic status or ethnic background, is that, deep down inside, we ALL believe that we are above average drivers.
  13. A person who is nice to you, but rude to the waiter, is not a nice person. (This is very important. Pay attention. It never fails.)
  14. Your friends love you anyway.
  15. Never be afraid to try something new. Remember that a lone amateur built the Ark. A large group of professionals built the Titanic.


Honorable Mention Rules:

  1. People who feel the need to tell you that they have an excellent sense of humor are telling you that they have no sense of humor.
  2. The most valuable function performed by the federal government is entertainment.
  3. The main accomplishment of almost all organized protests is to annoy people who are not in them.
  4. No matter what happens, somebody will find a way to take it too seriously.
  5. When trouble arises and things look bad, there is always one individual who perceives a solution and is willing to take command. Very often, that individual is crazy.
  6. The value of advertising is that it tells you the exact opposite of what the advertiser actually thinks. For example:
  • If the advertisement says “This is not your father’s Oldsmobile,” the advertiser is desperately concerned that this Oldsmobile, like all other Oldsmobiles, appeals primarily to old farts like your father.
  • If Coke and Pepsi spend billions of dollars to convince you that there are significant differences between these two products, both companies realize that Pepsi and Coke are virtually identical.
  • If the advertisement strongly suggests that Nike shoes enable athletes to perform amazing feats, Nike wants you to disregard the fact that shoe brand is unrelated to athletic ability.
  • If Budweiser runs an elaborate advertising campaign stressing the critical importance of a beer’s “born-on” date, Budweiser knows this factor has virtually nothing to do with how good a beer tastes.
  1. Nobody cares if you can’t dance well. Just get up and dance.