Archive

Archive for July, 2009

Distraction free development department.

July 6th, 2009 Paul 2 comments

keybord

One of the things that drove me absolutely nuts when our department was in the same building as the rest of the company was the fact that nobody could quite understand what we were doing. Quite often we would get a data entry person storm into our office and demand that we fix their Outlook or install Unix on their machine (it turned out that he needed Putty, not a true Unix install). Usually these conversation started with “You guys are not doing anything, right?”. So many times I was trying to explain to everyone that it just does not work like this. We are not just sitting here pressing keys at random most of the time. Best and by far most common argument to support their need for our involvement that I heard was something like this: “It is not going to take long, could you just do this for me right now”. One of our duties was writing a variety of Excel macros for people(I should probably post some tutorials on this subject). After all when dealing with massive amounts of data, it is faster to write a macro then do something by hand. We did not mind doing macros at all, what we did not like is when the person was sitting on the project for weeks and then decided to approach us at the last minute. Client expects the project to be completed at 5 PM, so the analyst strolls into our office at 4:45. Never mind that it takes him about 3 hours to explain to us what on earth does he want macro to do. Never mind that it takes me couple of hours to code the macro in some cases(trust me, there were some huge macros). It had to be done and that is it.

Number of times we attempted to find a solution to this annoyances. For instance we created a little internal web site that would, in theory, help users solve many issues like setting their “Away” message on Outlook and server connection through Putty and such. I did this web site in about 3 days when my computer was send away for repair and I was working on an antiquated piece of hardware we found berried in a storage. Was this web site ever used? No, it was not. Office people would still storm into our office saying that they did not read the instructions as they would not understand it anyway.

The worst part of these interruptions was that it would completely break my line of thought. So you are working away on a complex algorithm with close to no documentation on the objects that have to interact together available. You are concentrated on the task 100 percent, not even noticing that that cup of coffee is now cold, and then all of a sudden you have someone storms in and demanding that you fix their radio right away, or else.

The idea that you just had about this nice piece optimized piece you are about to write is gone now. I must admit that couple of times I flipped. It ended up with me yelling at a poor data entry person, calling them names, questioning their intelligence and so on. After I usually worked from home for a day, but at home there was a urgent need for a game of soccer or emergency epic hide-and-seek battle with my kids. I do enjoy those, but working from home was not a big option from the point of getting any work done.

Few years have passed and then our lease was up. I knew that was the moment when inaction would cost me dearly; I begged and pleaded with my boss to get us a separate office. Likely he agreed with me, and for the last two years we are in a different building, about 40 minute drive away from the main office. At first, main office was really concerned with who would be helping them out with daily tasks, but after about a month they learned to do it themselves. That little web site was finally used on the regular basis. We were not bothered with those requests and could finally spent close to a hundred percent of our time on coding and related things. Our productivity sky rocketed, we were producing better code more quickly and everyone was much happier.

The point is – developers can’t be disturbed. It is a process where ideas and thoughts need to be followed and processed carefully to produce what could be considered good code. You must create a barrier between your coders and outside distraction to produce quality software, and after all it is the purpose of any development team.

Twitter API with C# example(part 1)

July 1st, 2009 Paul No comments

sunflower

Currently I am involved in a project where number of things have to be done using Twitter API. What really amazes me today is the quality of API’s available to developers. Twitter is a perfect example of such API. I will try to publish some code that I used to accomplish several tasks starting with getting the details of a Twitter user providing you are aware of the user password and username.

Following code will retrieve a variety of information about a Twitter account:

public string FetchUserDetailsAsXml(string userName, string password, string IDorScreenName)
{

if(string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
{
throw new ArgumentException("userName or Password are not supplied, that is not good.");
}

string url = string.Format(TwitterBaseUrlFormat, "users", "show" + "/" + IDorScreenName, "xml");

using (var client = new WebClient())
{
client.Credentials = new NetworkCredential(userName, password);

try
{
using (var stream = client.OpenRead(url))
{
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
catch (WebException weex)
{
if (weex.Response is HttpWebResponse)
{
if ((weex.Response as HttpWebResponse).StatusCode == HttpStatusCode.NotFound)
{
return null;
}
}
throw;
}
}

}

That’s pretty much it. Need System.Net and System.Web for this, obviously. What you get out of that looks like this:

-
14381487
pzubkov
pzubkov
Ontario, Canada
Coder, mostly .net

http://s3.amazonaws.com/twitter_production/profile_images/56116140/Me_normal.jpg http://www.paul-zubkov.com

false 39

709397 333333 FF3300 A0C5C7 86A4A6 61
Mon Apr 14 05:08:22 +0000 2008
0
-18000
Eastern Time (US Canada)

http://static.twitter.com/images/themes/theme6/bg.gif false 49
false
false
false
-
Wed Jul 01 19:15:11 +0000 2009
2424620582
twitter api rocks, this is sweet
web

false

false



As we can see from above, I am not an avid Twitter user myself, but I find that the API produced by Twitter is extremely well done. In Part 2 and 3 I will cover sending new update and getting followers.