Evan J Palmer's Blog

A blog about learning (code, improv, film and, anything else).

TDD – Testing [internal] classes from an external project


In Visual Studio, to access a C# class marked as internal from an external project, add this line to your properties\AssemblyInfo.cs file:

[assembly: InternalsVisibleTo("NameOfProjectAsString")]

The longer version:

When I’m doing Test Driven Development I tend end up with a lot of classes – each with a single well defined responsibility and no external dependencies*. Usually I’d write each class with a public access modifier so they can be tested, even though in the majority of cases the class will only be used in this project, and internal access should suffice.

For example consider the following simplified case for a class that might be used in a NuGetPackage:

namespace MyNugetPackage.Logic
    public class SpecialStringFormatter
        ValueRetreiver _valueRetreiver = new ValueRetreiver();
        ContextDeterminer _contextDeterminer = new ContextDeterminer();

        public string FormatTheString()
            // DO Something

    public class ValueRetreiver
        public int GetInt()
            // DO Something

        public string GetString()
            // DO Something

    public class ContextDeterminer
        public object DetermineTheContext(string username)
            // DO Something

With the above example, when accessing it from a project that includes that NuGet package, you’ll get the following Intellisense:


In this example, the only time ValueRetreiver and ContextDeterminer are used is in SpecialStringFormatter so really they are just obfuscating the intent.

Usually this isn’t a big problem since the class will probably be used by team members who would would probably know what to use, but I’m currently working on a nuget package and and I want the usage of my package to be easily discoverable with Intellisense (which is proabably a noble goal for all your code anyway).

If I switch these to internal the Intellisense looks like this:


Much nicer, don’t you agree?

Now the problem is, that my classes aren’t visible to my testing project. The solution to this it to allow access to a different project via the attribute:

[assembly: InternalsVisibleTo("NameOfProjectAsString")]

which I added to my properties\AssemblyInfo.cs file.

I also needed to give access to my mocking frame work (Moq) with this attribute, including that very specific string:

[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

Do you know of a better way of achieving this?

* well, I try.


Ranting is fun and useful


In our last improv jam we did a pretty cool exercise from Del Close’s book, Truth in Comedy.

In the exercise, both players (or, all players if you like) are to rant for the entire scene. So no pauses at all. If there’s a pause, just jump in and say something, anything, keep it moving.

The idea of the exercise is to help get yourself out of your head. To just keep pushing the scene forward, and for me it it was a real eye opener. All the scenes we did turned out really well. I think this is because we started getting all this extra detail that transformed into offers – emotion, conflict and resolution all sprung out in full force with players not holding back by over thinking.

Great fun.

We also did a variation of it in which a normal scene is played, but a the jam director yells out “rant about it” and one of the players just goes on an awesome rant. This progressed the scene in the same useful way.

[Chrome Extension] TPB IMDB Pirate Bay Seach Plugin

I wrote a Chrome Extension that adds a drop down list of the top five torrents to an IMDB page.


Check it out here:


The links are ordered by seeders, so what ever has the most seeders will be at position one and the least at position five.

You can see how big the file is too, so that’s handy.


Take a look at a movie page, an artist page, a list page and a TV series page. The links are on there too!

I think this plug in covers the majority of cases, but I plan to add a preference page, so we can do things like exclude pron, have more items in the drop down list or optionally use the http://bayproxy.me/. Stuff like that.

I also have plans to hook this into Wikipedia, and Rotten Tomatoes, Google etc. Any movie page I can think of.

If you’d like to help with any of that, send me a pull request!

Initial Thoughts on Hot Desking

whoooooooooo-oooo-ooooo your desk is on fire

I’ve recently started working a company that “Hot desks” – that’s when you don’t have a designated desk when you come in to work. Instead you can sit anywhere you like.

I’ve found a few pros and cons.

Desks are clean – you can’t leave your crap over them, which means you don’t have dirty mugs (or sensitive documents) sitting around everywhere.
If you come in early you can get a cool spot near a window or something
You can sit with your team members, or however it’s most convienient for you
Saves money for the company. If only 75% of people are in the office on any given day, they can save 25% on seating

When you’re new you dont know who anyone is
I’ve heard of people missing stuff (leaving stuff on their desk that’s gone missing)
It takes me longer to get set up in the morning
I’ve heard two (overly loud) arguments regarding someone sitting in someone else’s spot both of which I found amusing, so could probably be a PRO too.
You can’t keep good personal things on your desk – like a pot plant or your cool drink bottle etc

Aspect Oriented Programming Sounds Scary


When I started my new job a few days ago and was asked to learn Aspect Oriented Programming (AOP) I was scared. I thought it would be a big paradigm shift from Object Oriented Programming (OOP).

This is not true at all.

In a nutshell, all AOP is is creating attributes on Classes/Methods/Members/Events that help move common code out of the body of the method or class, helping to keep everything DRY and honoring the Single Responsibility Principle.

If you’ve written a custom attribute, you’ve done AOP*.

The meatier part of AOP is when you use a framework (like PostSharp). If you use a framework, the attributes have more knowledge of the caller. We can get arguments, return values and, method/class names (without costly reflection). We can even alter the flow of the method (or other) that was decorated with the attribute. We can also add compile-time options which don’t exist for regular custom attributes.

So to be 100% clear, as far as I can tell, AOP is a subset of OOP. You need to know how to program in OOP to be able to do AOP.

AOP cannot replace OOP – being a subset, AOP only does a subset of the work. It’s an idea for making you a better OOP developer.

AOP is not a difficult concept – and is pretty cool… and you’re already probably familiar with it if you’ve used/written attributes.

So relax. Have a beer. Don’t go in to work today. Why not watch a movie? Or old Jerry Springer episodes on YouTube?**

Also, stay tuned for more AOP stuff as I learn about it.

* I’m actually over simplyfying it here. I think technically, if you don’t have the cool shit that frameworks offer – like access to members, arguments, return values, compile-time overrirde- you’re probably not doing AOP. BUT the concept is so friggen similar, I’d argue little distinction needs to be made.

** Not actual advice. You should go to work.

Examples of Context Switching

poison cup challenge

Context switching is bad – try to do it as little as possible if you want to be productive and really benefit from Kaizen.

What I’m talking about when I say “context switching” is changing what your brain is focusing on. The more often your brain has to drop out of “The Zone” and switch into something then back to the original task, the more engery you’ll burn and the harder it’ll be.

So the typical context switch I’m talking about is when you’re at work, and you’re deep into the Henderson Account and it sucks. You really don’t care about The Hendersons or their accounts, but The Man buying your lifeforce so you have to do it. It’s boring and you remember that movie with… what’s his name… it was his first movie… the budget was like $7000 oh yeah, it was Primer. Has his new film come out yet – quick Google and your mind is no longer immersed in the Henderson Account, but is thinking about a cool movie. The context has been switched and you’ll need to exert effort to get back up to speed.

So this is a thing that you should try not to do. Which is easier than it sounds.

Anyway, I’ve been thinking recently about different types of context switches that happen to human beings. Firstly, we have the mind wandering one, which I talk about above. Here are a couple of other examples, that I think of as context switches.

When you’re working on something almost every alt+tab is going to be a physical manifestation of a mental context switch – whether you’re checking emails or Reddit.

Reddit, Instagram etc- flicking between little images 
So you go to Intstgram or Reddit or Facebook and you’re greeted with tonnes of little snippets of information that is generally not related to each other. You’ll see a picture of a cat, then a status about Cheryl’s boy trouble, then a photo of Mark at a party, then a video of a guy skating. All these amazing unrelated thing are little context switches that make your brain expel energy … and don’t really give you much benefit.

Working on a large project or little tasks
At your work do you generally have a big project to sink your teeth into or lots of little projects that take up your day. I am proposing that the poeple with the larger projects are more useful to the company and are gaining skills at a faster rate than those who are doing smaller jobs, and I put this down to context switching.

Changing jobs and careers
Do you change jobs regularly? Or even careers? I suggest that the more you do this the more energy is expelled making the switch and the more slowly you’ll be gaining useful skills. I’m not suggesting you stay in a job or career you hate, nor am I suggesting we work for the same company our entire lives. What I am thinking is that maybe we should think, until I can do a  job with something like an 80% efficiency, I should not look for more work. Or, once I feel I haven’t learnt anything new for a while, it’s time to move on. Rather than “screw this, too hard” change jobs.

Yeah, that’s all. This is just opinion. Not sure if there’s any real truth in it, but it’s worth considering how this concept could also be applied to sports and physical training. Do you think this could be applied to relationships as well? Is being friends with someone for a long time better than bouncing between groups of friends? Do you get more out of being with the one person for a long time, or having shorter relationships?

ASYNC as a parameter


Just a small, useless thought I had today regarding using async as a parameter – for example in an asynchronous jquery ajax call:

  url: "file.php",
  type: "POST",
  async: true

Considering the word “asynchronous” is the antonym of its root “synchronous” – it means, “not synchronous” – shouldn’t we use “sync” and invert the defaults? I mean, you would never give any other parameter or method a negated name. You’d never see this for example:

public void UpdateStatus(bool unsuccessful){ ...


public bool DetermineRecordIsNotNew(RecordType record){...


public class Performance {
string Name { get; set; }
DateTime StartDate {get; set;}
bool IsNotCancelled {get; set;}

Anywho, that’s what I think.

I also don’t think that asynchronicity should be true as a default in most cases either.

Meh, whatever.

How does it feel, like?

ChemicalFuckinBrothers 905

I recently did a small weekend course with Jason Chin – a cool IO improv guy from Chigaco.

He taught us a bunch of really interesting stuff, but there was one exercise we did that I thought was particularly useful. I don’t know if it has a name, but I’m going to call it “How Does It Feel, Like” (HDIFL).

Now, the purpose of HDIFL is to cut past the leading crap at the beginning of a scene and cut right to the emotions between the two players – Shoot the Grandma, as Steen would say. We did the exercise a lot and Jason really pulled us up on it when we didn’t hit the nail on the head.

To play HDIFL It’s straight forward. Get two lines of people, two people walk to centre stage. Person 1 says a line – anything relatively meaningless will do. The second player has to say how that line makes them feel about the other player. Eg:

“I brought you some cheese”
“That makes me feel happy that you remembered my birthday”

“I have a two camels”
“That makes me feel angry that you don’t care about animal rights like I do”

This is so important, because it sets the stage for some real conflict.

Speaking of conflict. When you choose the “correct” emotions, Jason pointed out that we tend to have a dramatic, real scene. If we choose the wrong emotion, we can have a more comical scene. So for example:

“My grandma is dead” + “That makes me feel sorry for you” = a dramatic scene.


“My grandma is dead” + “LOL that makes me feel happy, let’s do a small dance on her grave” = a comedic scene.

It’s worth noting that Jason recommended that for beginner players, it’s cool to just say how you feel: “That makes me feel sad” or “That makes me feel happy” is okay for a junior player. The important part is being affected. Once we get the it stuck in our heads that we need to be affected, then we can move on to saying the emotion AND showing it. And eventually, we’ll be so good at showing it, we won’t need to say it as well.

Improv Etiquette


When my friends and I practice our improv techniques out of class, and away from the stage, it can be great fun. It can also put you in a weird vibe because people act differently when there’s less pressure. I guess because it’s a more relaxed environment.

Here are a couple of observations that I think will help keep everyone on track when there are no teachers or directors keeping everything rolling along.

1) If you’re in the audience, pay attention
It’s respectful to watch the people on the ‘stage’ even if there’s no physical stage there. If you’re chatting or not looking at them, it can be distracting for them and throw them off. Also, if you pay attention you can give useful notes at the end.

2) No joking from the audience
DId someone miss an hilarious pun? Feel the need to bust a joke real loud to get a laugh? Please don’t. Like in (1) it might throw the players off and doesn’t acheive much.

3) Don’t laugh at people’s mistakes
If someone missed an offer, or just walked through a mimed table and didn’t realise. Please let it slide. Depending on who you practice with, they might like a note on it after the scene, but try to hold it until then.

4) Don’t break character
I find that when I’m practicing with friends, I tend to break character pretty easily. I laugh, or just speak to another player about what my intent is. That’s not so good. Even though the audience are your friends, if you’re going to practice, you should try your best.

5) No blaming
In a more relaxed environment it’s easy to blame someone out loud – in oppose to your inside thoughts. By that I mean, during or after the scene, saying something like “how did you miss my offer?” or “you didn’t stick to your character”. I’m a massive fan of giving your peers notes, but they should be constructive and blame free.

Probably try not to blame people with your inside thoughts either – I think that’s how you get brain blisters.

6) No excuses
Before or after a scene, it’s easy to say “oh, I can’t do this” or “I’m really bad at physical stuff”, or “I can’t mime” or, “that sucked because I’m tired” etc etc. I don’t think that’s a worthwhile thing to do/say because you’re either setting yourself up for a failure, or distracting people from your actual performance. Basically it’s unconstructive, and lowers the bar. We should keep the bar high and always try our best.

Often I watch scenes that people think are rubbish, and make excuses about, and it kinda taints an otherwise cool scene.

Actually, I think a lot of those points are worth considering in real life context too.

I hope this post doesn’t read as too negative. I think they are points worth considering to keep an excellent practice session excellent.

Book Review: Pragmatic Thinking and Learning


I was looking to learn more about Agile practices and asked around to a few of my friends. One guy recommended Pragmatic Thinking and Learning by Andy Hunt.


Funnily enough, I wouldn’t call this a book on Agile per se. It’s more like a discussion on some excellent ways of finding problems with your learning or productivity with the goal of being aware of them and correcting them.

Now, this is something that I’ve been looking for for a long time and was extremely happy to find it. I couldn’t recommend this book more highly – it’s full of excellent tips to make your brain work better and faster.

For me it also highlighted the importance of some things I am already doing (eg. blogging) and helped me solidify some ideas I’ve already had around situations in the workplace/learning – for example, defining skill stages of novices, advanced beginner, competent,  proficient and experts, and the role and importance of each in the work place.