Archive for July, 2007
In this fourth article in my series on applying United States Marine Corps leadership traits and principles to software development team leadership we’ll be looking at the last 4 leadership traits: Endurance, Unselfishness, Loyality, and Judgement.
You can read Part I here, Part II here and Part III here.
Physical endurance plays a big part in the Marines but mental endurance is also important and that’s what we’ll concentrate on here. Endurance is defined as the ability to sustain a prolonged stressful activity. While you probably won’t be leading any 50 mile forced marches we’ve all heard software development projects referred to as ‘death marches’. Quite often a project can become a stressful mental exercise and, in some cases, a physical one as well as long hours are worked. Your ability to endure this misery will test your team leadership ability.
As a team leader the rest of the team will be looking to you to help get them over the hump on these tough projects. If you slack off, what do you think the rest of the team will do? They’ll follow your lead. If you decide that extra hours or even an all-nighter is needed, you’re the one toughing it out to get the job done, leading by example. I’ve known mid to upper level IT managers who’ve worked through the night and into the next day to fix a problem, helping when and where they could, and I’ve also known some who thought making it to the country club early on a Saturday was more important than being in the office for a weekend release. Can you guess which ones I respected as a leader more?
It is a Marine tradition that in a chow line the lower ranking Marines are served first, then the squad leaders, then the staff non-commissioned officers. This is unselfish leadership in action. How can you show this kind of unselfish leadership in your role as a team lead?
An unselfish leader doesn’t grab all the perks for themselves. Sure, you’ll get some of these due to your position but you don’t need to flaunt them. One good example would be the computer system you’re using. If you have a top of the line system and the rest of your team is struggling by on poor performing systems, how do you think they’ll feel about that. As tough as it may be to you, make sure that your team is well supplied with the tools they need to do their job before you are. If you shortchange them, they’re likely to return the favor.
Another key area is in giving and taking credit for work. Nobody likes to work for a manager who takes personal credit for someone else’s achievements. You should always recognize the hard work and great ideas of your subordinates both to them and their peers and to your management as well. Not only does this behavior make them look good but it makes you look good as well.
The Marine Corps motto, Semper Fidelis, a Latin phrase meaning ‘Always Faithful’. This phrase embodies the loyalty Marines have to each other up and down the chain of command and even after they leave active duty in the Corps. Loyalty is a two way street and your words and actions should always reflect your loyalty both your team and to your managers. What are some ways you can show loyalty?
One is to back your team when they’re right and tell them they’re wrong when they’re wrong. A poor team lead will tell the team one thing and their management another and thus, show disloyalty to both. Sometimes it takes moral courage to be loyal in a situation. Have the courage to be loyal.
Another opportunity to show loyalty is when you pass on orders to your team, particularly ones that are distasteful. Don’t be disloyal by blaming the person above you for the situation. To do so only weakens your standing with the team. If you can’t change the situation, make the best of it. If it is something you can fight for, do so. Either way, it’s being loyal to your team and organization.
Never criticize your company leadership or your management peers in front of your team and discourage your team from doing the same. Nor should you allow gossip about personal lives be passed around. Stay loyal to your company and to your team by avoiding this trap.
Another way to show loyalty is to help out your team members if they’re having a problem, personal or professional. Hopefully your company isn’t a real world version of a reality show where you get points for throwing team members under the bus when they’re not up to par for some reason. Instead, help them out. By showing your loyalty this way they’ll have greater loyalty toward you, the team, and the company when the situation has past.
Our last trait, Judgement, is all about applying the other leadership traits and your experiences to make the best decisions. You should avoid thinking rashly and, instead, think through a situation so that you can make a good decision.
Of course, there will be situations outside your experience. In the best cases, you will have someone else you can rely on to give you the benefit of their experience in your organization. This could even be someone who is technically junior to you within the organization but who has more experience there. If there isn’t anyone available to you, which is not the best of situations, you may have to rely on sources further removed or even a book or article. But, if you need help, seek help. This too is good judgement.
That covers our discussion of the leadership traits. Next in this series we’ll be looking at how to apply these traits. As always, feel free to leave a comment or question if you have one.
Here are the other parts of this series:
July 31st, 2007
Rounding, the process of reducing the number of significant digits in a number, should be a simple enough but there are actually several ways of doing this that we need to be concerned about. In this article, I’ll go over the different types of rounding found in VB.NET.
This form of rounding is simple truncation of the number where any digits after the point of precision are dropped. VB.NET provides two functions for doing this to get an integer result, Int and Fix. However these two functions are slightly different. Both remove the fractional part of a number but, when a number is negative, Int returns the nearest negative integer less than or equal to the number while Fix does the opposite. For example, Fix(-10.4) returns a -10 while Int(-10.4) returns -11.
The way the Fix function works is called symmetric rounding since it affects positive and negative numbers the same way. The Int function is considered asymmetric rounding because it affects positive and negative numbers differently.
You can also do truncation rounding using the Format function, like so:
This is method doesn’t take the trailing numbers into account at all so care should be exercised when using it to avoid skewing results.
It is better to use Math functions for rounding rather than using these methods, particularly if statistical precision is required.
When you use simple rounding, always going up or down, you run into the problem about what to do with numbers that are right at the midpoint. What should 1.5 be rounded to? 1 or 2?
In VB.NET we can do this kind of rounding using the Math Namespace, like so:
Math.Round(48.15162342, 2, MidpointRounding.AwayFromZero)
Note the last parameter. This tells the function to perform arithmetic symmetric rounding instead of the default bankers rounding.
This is the kind of rounding used by default in the .NET Math library and by built-in VB.NET functions such as CInt(). In this type of rounding, .5 rounds to the nearest even number. This means that both 1.5 and 2.5 round to 2, and 3.5 and 4.5 both round to 4. The idea behind this method is that it prevents a round up or down bias from entering into a large series of numbers.
This method has caused a lot of confusion over the years because in previous versions of VB this method of rounding was the only one available. Since some project sponsors didn’t like it and some did it often made rounding in a program a pain. Fortunately with the .NET Framework 2.0 we can implement rounding either way in the Math.Round function so that we can please everybody.
I would strongly recommend that you have rounding methods spelled out in your requirements. If you don’t, expect headaches down the road. Also, you should use Math.Round instead of built-in functions that perform rounding so that if there is a last minute change in rounding technique, it’s easier to change.
Stochastic or Statistical Rounding
One last method of rounding we should look at is Stochastic or statistical rounding. In this method, when a number to be rounded falls at the midpoint, the decision to round up or down is determined randomly. In theory, this method prevents large totals from becoming skewed. However, using this method will make statistical analysis hard to replicate and requires more computational time. You can implement this using the .NET Random functions. This method is good for certain types of statistics but is probably overkill for most rounding implementations.
Hopefully this article has helped you gain a better understanding of rounding in VB.NET. If you have any questions or ideas about rounding, please feel free to leave me a comment.
July 31st, 2007
In this third article in my series we will continue to take a look at how to apply United States Marine Corps leadership traits and principles to software development team leadership. (You can read Part I here and Part II here.) In this part I’ll be discussing the leadership traits of Justice, Enthusiasm, and Bearing.
A sense of justice. What does it mean to you? In the context of this discussion this means fair impartiality, of taking actions that are fair and just to all.
For example, to be just in your day-to-day work, this means that you don’t play favorites. If you always give the best assignments to the same person and the worst assignments to other people on the team, how to you think it would affect team morale? It’s easy to guess that those given the bad assignments would probably not think that highly of your leadership ability and it will impact their attitude and productivity.
Being just also means keeping your emotions and prejudices out of your decisions as much as possible. While this is often company policy when in comes to some groups, such as race or sex, just because a particular type of person isn’t on this protected list doesn’t mean that you’re allowed to treat them unjustly. You should treat all of your subordinates justly. If you don’t like someone on a personal level due to an annoying trait that grates your nerves at an emotional level, don’t take it out on them by assigning them all the grunt work or using them as a pawn for layoffs. Instead, work on getting to know them better or, if you can’t treat them justly, help them find a place within the company where you won’t be their supervisor.
In short, unjust treatment will harm team morale and undermine your leadership while just treatment for all will have the opposite effect.
This doesn’t mean that you have to be a rah-rah cheerleader. Software developers typically don’t like phony behavior and such insincere behavior isn’t what you’re looking for here. What you are looking for is showing an interest in the work your team is doing.
Let’s imagine a scenario where a developer on your team wants to show you a new algorithm they’ve developed. Sadly, many a team leader would blow off such a request in favor of other ‘more important’ meetings. This syndrome becomes worse at higher levels where the manager doesn’t have a good feel for the development tools being used and has a tighter schedule. How do you think the enthusiasm level of the developer who’s brushed aside will be afterward? That’s right, not so good. Do this enough and the whole team is in the dumps.
Maintain enthusiasm within your group by being a sincere cheerleader and coach for their efforts. If they’ve worked hard, acknowledge it and applaud their efforts. If they’re struggling, be a mentor and help them find a solution through positive methods.
Also work hard to avoid outside problems from dampening your team’s enthusiasm. While sometimes this is unavoidable, you can do your part by not complaining to them about the direction the company is taking. Try to keep things on a positive note as much as possible in these situations. Doing so enhances your leadership of the team and, at the very least, improves the morale of the team where mutual misery will only weaken it.
Everybody knows the look of a squared away Marine in uniform. Movie characters like Jack Webb’s The D.I. or R. Lee Ermey’s Gunny Hartman in Full Metal Jacket or John Wayne in Sands of Iwo Jima have burned in this image. So, do you need to be all spit and polish, tough as nails, cussing and swearing to have bearing as a software development team leader? No, bearing is really deeper than physical appearance, it’s an attitude, a state of mind.
I don’t want to totally discount physical appearance though. If your company has a dress code, live up to it. Being slack in this area will only encourage yourself, and the rest of the team, to be slack in other areas. If you’re lucky and don’t have a formal dress code, consider casual dressing for success. You might be surprised how much a neat look improves your leadership.
But, beyond the physical, what is bearing? It is how you conduct yourself verbally and emotionally. If you rant and rave at your team, you’ve lost your bearing. If you cut down a team member, that’s loss of bearing. If you make a joke out of handing out work assignments, you’ve lost your bearing. If you engage in sarcasm, you will lose it as well. However, if you conduct yourself with dignity, show that you’re more interested in being understood than impressing others, and make yourself approachable, you will develop excellent bearing.
That’s all for this part. Part IV will be available soon where we’ll be discussing the final 4 leadership traits: Endurance, Unselfishness, Loyalty, and Judgement.
Here are the other parts of this series:
July 30th, 2007
This is the fourth article in my series on the My.Computer.FileSystem Namespace. In this series we’re taking a look at the functions in this namespace and rating their usefulness as compared to related NET Framework functions.
Here are the previous articles in the series:
This function obviously moves a directory from one location to another and it has 4 overloads as shown here:
My.Computer.FileSystem.MoveDirectory(SourceDir, DestDir, True)
My.Computer.FileSystem.MoveDirectory(SourceDir, DestDir, _
My.Computer.FileSystem.MoveDirectory(SourceDir, DestDir, _
It extends this System.IO Function…
…by adding the ability to choose between overwriting or not as well as offering the standard VB UI options.
Since it extends the functionality of the System.IO option, although the base is the same, I’ll give it a 3.5 out of 5.
MoveFile, of course, moves a file from one location to another. This function also has 4 overloads, just like MoveDirectory, as seen here:
My.Computer.FileSystem.MoveFile(SourceFile, DestFile, True)
My.Computer.FileSystem.MoveFile(SourceFile, DestFile, _
My.Computer.FileSystem.MoveFile(SourceFile, DestFile, _
The related System.IO function…
…is just like its directory counterpart and is limited. Likewise, I’ll have to give it a 3.5 out of 5 rating too.
One thing to remember about using these functions, either in the My or System.IO namespaces, is that the security on a file or folder is copied to the new location.
Our next function is OpenTextFieldParser. This is one of the most powerful functions in this namespace since it provides an easy way to parse a wide variety of delimited and fixed column text files. Here are some example calls to this function:
Dim MyParser As FileIO.TextFieldParser = My.Computer.FileSystem.OpenTextFieldParser(DelimitedFilename)
Dim MyParser As FileIO.TextFieldParser = My.Computer.FileSystem.OpenTextFieldParser(DelimitedFilename, ",")
Dim MyParser As FileIO.TextFieldParser = My.Computer.FileSystem.OpenTextFieldParser(DelimitedFilename, 10, 12, 16)
I’ve written a previous article on how to use the TextFieldParser object and I’ll probably write another on it soon. If you’re doing any kind of work with delimited text files you owe it to yourself to check out this object. There is no direct equivalent in the System.IO namespace. To get the same functionality you would have to write considerable code.
I give this function, and its releated object, my highest rating 5 out of 5.
This function opens a FileStream for a target text file. You can optionally select an encoding method (ASCII is the default). Here are examples of the two overloads:
Dim CurrentFileAs System.IO.FileStream = My.Computer.FileSystem.OpenTextFileReader(MyTextFile)
Dim CurrentFile As System.IO.FileStream = My.Computer.FileSystem.OpenTextFileReader(MyTextFile, System.Text.Encoding.UTF8)
The System.IO function that’s closest to this one is…
Dim CurrentFile As System.IO.StreamReader = System.IO.File.OpenText(MyTextFile)
There are differences between the two functions, obvious being the encoding type isn’t available for the System.IO function and that one returns a FileStream and the other a StreamReader. Ultimately, this means that you have to use care in selecting which method to use due to these subtle, but important, differences.
I give this function 3.5 out of 5. While it does bring some new ideas to the table, it may be of greater value in some cases to use the System.IO functions for greater consistancy.
Our last function for today is OpenTextFileWriter. This function opens a StreamWriter and you can chose to overwrite or not overwrite an existing file as well as select the encoding type as shown here:
Dim CurrentFile As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(MyTextFile, True)
Dim CurrentFile As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(MyTextFile, True, System.Text.Encoding.UTF8)
There are several System.IO functions that you can use to achieve the same effect, however, these generally require a few extra steps to configure properly. This function provides a useful shortcut for a commonly called function so I give it a 4 out of 5.
It is important to remember encoding when working with text files. Some implementations will write out the Byte Order Mark and others don’t. For further reference, see my article, Beware of the Byte Order Mark.
This concludes Part IV of this series. I’ll be wrapping this series up with Part V during the next few days. If you’ve found this series useful (or if you didn’t) or if you have another VB.NET topic you would like me to examine, please leave me a comment.
July 30th, 2007
Here’s my next installment on the My.Computer.FileSystem Namespace. This article series takes a look at functions in this namespace and rate their usefulness as compared to related NET Framework functions.
Our first stop today is GetDirectoryInfo:
Dim MyPathInfo As System.IO.DirectoryInfo = My.Computer.FileSystem.GetDirectoryInfo(MyPath)
This function returns a System.IO.DirectoryInfo object. It is exactly the same as this System.IO function:
Dim MyPathInfo As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(MyPath)
Therefore, it doesn’t provide any extra value to the developer. I give it 2 out of 5.
Next we have a related function, GetDriveInfo:
Dim MyDriveInfo As System.IO.DriveInfo = My.Computer.FileSystem.GetDriveInfo(DriveLetter)
As with GetDirectoryInfo, it’s almost an exact duplicate of a System.IO function:
Dim MyDriveInfo As System.IO.DriveInfo = New System.IO.DriveInfo(DriveLetter)
It is a redundant function so it only rates 2 out of 5 as well.
As seen here this is yet another duplicate of a System.IO Info function:
Dim MyFileInfo As System.IO.FileInfo = My.Computer.FileSystem.GetFileInfo(MyFile)
Dim MyFileInfo As System.IO.FileInfo = New System.IO.FileInfo(MyFile)
As such, it also gets a 2 out of 5.
This function parses a path/filename string and returns the base file name, with extension:
Dim BaseFileName As String = My.Computer.FileSystem.GetName(FilenameToParse)
This is a rather useful function since it relieves you of having to manage the string parsing yourself and takes care of spaces and extra periods in filenames, something that often gets overlooked in handmade path parsers. I’ll give this function a 4 out of 5.
This function is the opposite number of GetName. It returns the path portion of the file/path name.
Dim ParentPath As String = My.Computer.FileSystem.GetParentPath(FilenameToParse)
Like its counterpart, its parser handles extra periods and spaces without a hitch. Bear in mind that it doesn’t add a trailing backslash onto the returned path name so don’t forget that when you’re concatinating a path/file string.
This function also rates a 4 out of 5
Our last function for today is GetTempFileName. This function creates a uniquely named temporary file and returns the path/filename for it.
Dim TmpFileName As String = My.Computer.FileSystem.GetTempFileName
Returns: C:\Documents and Settings\[username]\Local Settings\Temp\tmpB3.tmp
I had covered this function previously in my article 3 Quick Examples: Temp File, Topmost Form and Current User Name. The only hitch with the function is that it automatically uses the default temp folder. If you want to use your own folder, which I don’t really recommend, you’ll probably find it better to code this separately from this function.
I give this function a 4 out of 5.
I’ll be covering more functions from My.Computer.FileSystem soon. Please leave me a comment if your rating of these functions is different from mine or if I overlooked something.
July 27th, 2007