birdman and becoming polyglot

Birdman is an American black comdy that features a faded Hollywood actor famous for his superhero role. While seeing the film, I kind of thought I have something in common with the character. He doesn’t wanted to be labelled as Hollywood superhero junkie, but to be seen as an artist, a Broadway actor.

I like the word, “polyglot programming”. I’m fascinated by people who code in different language on cross-platforms. Though I mostly use C# and .NET framework on windows at work. I strive to be polyglot. Also I want to be seen as a polyglot developer, capable of using multiple sets of language. On my linkedin profile, I proudly wrote that I’ve got skills of F#, javascript (includindg Node.js), Python, and Ruby. I consciously spend time to learn those languages. For my side projects, I use Node.js, express, and angular. I wrote a couple of simple android apps in Java. I spent quite bit of time learning ruby, went through Ruby Koans twice, and did one project in ruby and rails.

However, I often did so, because I loved the glorious title of “polyglot programmer.” I had hope that one day I will be like a magician with spinning dishes on poles, using different languages and platforms skilfully.

At the end of the film, the actor finally accepts that he is a Birdman. Accepting the identity frees him. Working hard to be polyglot for the sake of its glory was tiring, I confess. It’s like you get exhausted if you try to be cool or impressive all the time. Like the birdman, I need to accept that I might not be polyglot, if being polyglot has minimum requirements, like you have to know at least 4 different major languages on different platforms. If the word, “polyglot”, enslaves you, I must fell. I don’t have to cool or awesome. I just want to be a programmer, who is good at what he’s doing. I don’t have to a guru. I’m happy to be a journeyman

A good developer would eventually be polyglot. You need a right tool for the job, and if you know more tools, and then you can do the job much better more effectively, For example,

“Using Java to solve a clearly functional problem, when Clojure would be simpler. Or building a Rails app when your users want the kind of fluid interface a single page JavaScript framework can give them.”(

So, to be polyglot for the sake of being polyglot doesn’t give you much benefit. It may make you rather arrogant. Just try to know different languages, tools, and environments enough that you can decide which would be the best tool for the job you have now. Use the language and tool for job and deepen your understanding and knowledge along. Don’t be afraid of using different toolsets. Then along the journey, at some point, you will find you have become truly polyglot.

Being polyglot can’t be the purpose. It’s the end result you become, when you try to be good at your job.

When to use static methods?

This is a question that hanuts me since I installed Resharper recently. Resharper keeps suggesting that the method can be static. I can see that it can be static. The method does not depend on any properties or methods of the class. But does that mean it should change to static?

I wasn’t sure, so I asked google. Often, I think google is like a wizard or rabbi. I ask a question, and it answers. Anyway, there were people who were curios and thought about it.

Kristofer Gafvert says,

Does this method belong to an object, or the class itself?
A method belongs to an object, if it modifies the state of the object. If
the method does not modify a specific object, it can most likely be static.

I really agree. if the method does not modifies the state of the object, it just belongs to the class, not the object. What do you think?

Please have a look on this discussion.

Create a random strong password

This is to create a random strong password. I don’t want to make it too strong, for example password with special character. 1 number and 1 upper case will be sufficient.

There are a few good articles. I get the idea from these posts.

If you use ASP.Net 2, you can use System.Web.Security: MemberShip.GeneratePassword(…). This will be handy, readily available method. This password this method generate actually include special characters and punction letters such as (, {, ; :, and so on. This didn’t cause an issue to me, but in some cases like you want to generate DB connection string automatically, it will be a problem because ; will break it.

Anyway, the method wasn’t cool as I expected, and I wrote my own method. Well, it is not really my original one. I used a part of example codes from MSDN.

const string LOWERCASESET = "abcdefghijklmnopqrstuvwxyz";
const string NUMBERSET = "1234567890";
const int SALTLENGTH = 8;

public static string CreateNewPasswordSalt()
    return GeneratePasswordSet(SALTLENGTH, UPPERCASESET + NUMBERSET);

public static string GenerateRandomStrongPassword(int length, int numberOfUppercaseChar, int numberOfNumeric)
    return GeneratePasswordSet(numberOfUppercaseChar, UPPERCASESET) +
        GeneratePasswordSet(length - (numberOfUppercaseChar + numberOfNumeric), UPPERCASESET + LOWERCASESET + NUMBERSET) +
        GeneratePasswordSet(numberOfNumeric, NUMBERSET);

private static string GeneratePasswordSet(int length, string ALPHANUMERICSET)
    string password = string.Empty;
    int position;
    byte[] data = new byte[length];

    RandomNumberGenerator random = RandomNumberGenerator.Create();

    for (int i = 0; i < length; i++)
        position = (data[i] % ALPHANUMERICSET.Length);
        password = password + ALPHANUMERICSET.Substring(position, 1);
    return password;