Mock jQuery Ajax Calls with Jasmine

Suppose you have a function that hits Google’s book service to conduct a search. You would like to test this function for various cases: no results, one result, lots of results, or even a service failure. But you don’t want to be dependent on Google’s service in your unit tests. I’ll show you how to use jasmine’s spies to mock the service so that you can get the test coverage you desire.

What's Your Biggest Weakness?

Even if you have never had to answer this classic interview question, it’s one that you should occassionally ask yourself. By thinking through an honest answer, you can uncover, and therefore correct, weaknesses that may be holding you back. When I ask myself this question, I have to give myself some context. When interviewing, the context is usually the position for which you are interviewing for. To set the stage for my answer, I imagine that I’m interviewing as a programmer, manager, product owner, husband, father, etc.

Always Use `var`

This isn’t an article about the var keyword in JavaScript. There’s nothing controversial about that. Just use it. This post is about C#’s var keyword. How is that Controversial? Most people cop out say that the use of var is simply a preference. This is because the compiler figures out the type of the variable, and then compiles it just as if var was never present. However, by always using var, you will create more readable code, and find new insights to your code that you may not have noticed otherwise.

Simplicity Challenged

It’s difficult to rein in your ideas and take baby steps when designing anything. The problem is compounded when you build something that is so well known - like a blog. This second post was quite a challenge for me from that perspective. Features! Features! Features! Now that I have multiple posts, I want to include the ability for a visitor to go back and forth between them. I also want to make sure that the most recent post is shown first on the home page.

Getting Naked

Learning about agile methodologies has had an effect on how I view many aspects of my life. Prioritizing the high value items, working incrementally towards goals, and having a shared vision with those around you are good things to remember regardless of what you are doing. If I know this so well, then how come I haven’t applied this knowledge to blogging? Analysis Paralysis For as much as I know about splitting apart complex systems into complete and independent User Stories, I get way too caught up in what I want my blog to be.

Lean on the Interactive Window

One of the first things I noticed about working in a functional language versus an object-oriented one is that I can start writing code without worrying about which object should have that code. I imagine that this is more a result of working with a language with an interpreter (F# Interactive) readily available than with Step 1: Break the problem down: 1 2 3 4 // Given a directory // 1.