Crazy Long C# Class Names

One of my colleagues, Michael Patricios, emailed a link to a funny Daily WTF article around the office yesterday. It made a passing reference to very very long class and interface names such as IEnterpriseAuthenticationProviderFactoryManagementFactory. This struck up both my curiosity and my desire to maser the Unix shell so I spent 5 minutes knocking up this set of commands:

admin ~ $ find . -name "*.cs" |  xargs  basename | awk '{ print length($0),$0 | "sort -n"}' 

What does it do? It find all C# files underneath the current directory, sorts them by ascending filename length and finally prints out the filename and its length. I was expecting all sorts of insane filenames, but in fact the uSwitch code base was relatively sane.

The results

NB: If you wrote any of these classes don’t be offended – this is only a bit of fun. I have been guilty of plenty of odd naming too!

Comment as class name

This longest non test class name was mine. I am a bit disappointed that I never went back to delete it though:

65 TemporaryClassSoThatExistingCmsContentWontBreakBetweenReleases.cs


This one scream of IEnterpriseAuthenticationProviderFactoryManagementFactory style patternitis :

41 DynamicUrlManagerDataRepositoryFactory.cs

(A handy web site exists if you fancy more names like this.)


Whilst this next one looks like a bad case of nhibernatisis:

37 NHibernateSessionFactoryRepository.cs


The longest filename were from our BDD test-obsessed phase a year or two ago:

57 specs_for_CustomerSatisfactionOverallSummaryController.cs
59 specs_for_LastLinkHasLastChildCssClassSiteMapTransformer.cs
62 specs_for_SendResultsEmailImmediatelyToMyFriendEventHandler.cs
72 specs_for_CurrentNodeHasCurrentCategoryCssClassSiteMapLinkTransformer.cs



At the other end of the spectrum, were some short and intriguing zen-like class names:

8 Party.cs
8 Smurf.cs
8 Water.cs
8 motor.cs
8 Logic.cs
8 Fresh.cs


And finally several cases where people just could not be bothered to either name or delete the file:


If you have a large code base why not run the command above? Let me know if you find anything interesting!

Programming language stereotypes venn diagram

Inspired by Blame it on the voices’
Religions venn diagram of the day, I put together a programming language stereotypes venn diagram. Stereotypes are supplied by the Google instant search results for the questions: why is language? and why is language so?:
I drew the venn diagram together using a little processing.js script which was pretty straightforward and fun.

  var circleSize = 300;
  void setup()
    size(900, 600)
    stroke(204, 102, 0);

  void draw()
    ellipse(400, 200, circleSize, circleSize)
    ellipse(300, 400, circleSize, circleSize);
    ellipse(500, 400, circleSize, circleSize);

    ellipse(800, 200, 150, 150);

    language = createFont("Helvetica",12,true);

    fill(0, 0, 0);
    text("Lisp", 800, 100)
    text("Java", 400, 30)
    text("Ruby", 100, 400)
    text("Javascript", 720, 400)

    text("Great", 800, 180)
    text("Used for AI", 800, 220)

    text("slow", 400, 330)

    text("hard", 400, 170)
    text("always updating", 400, 210)

    text("popular", 330, 300)
    text("red", 280, 400)

    text("used", 470, 300)

    text("bad", 520, 380)
    text("important", 520, 420)