Search: in  

Rob Kennedy's Blog

Rob Kennedy is an avid and active .NET software developer who tends to have an opinion about everything. In the windows developer community for over 10 years, he has grown his career and opinions through experience.

August 2008 - Posts

  • 10 Things I want in a Job

    I've had it. I quit. I'm done. It can't be done here. I'm tired. Help!

    All of the previous statements have been said by me in the past few years here at my current job as a Sr. Software Engineer at a local government contractor. Our company attrition rate has gone almost into double digits. Even the morale boosting plans of the office Olympics day (non-chargeable time of course) can't boost morale here since after the fun, employees come back to the reality that we all still work here. It's the same old story once again and it's not making things any better. In fact, things are pretty much the same since I started here almost 5 years ago. That is in my opinion why the attrition rate will remain steady in the near future. Aside from the company finally adjusting salaries to match the cost of living here (too little, too late for most), I personally feel there is still something wrong; I feel like I'm stuck in a job rut. Like I'm a mouse in a maze and I'm looking to get out; looking to find a better path, but always coming up short. Staying in one area of the maze is comforting almost because I know that part of the maze there is a "steady pay check" or what appears to be a steady amount of cheese so to speak. In fact, this whole maze blabber reminds me of the "who moved my cheese" book. I've become the mouse with the dwindling cheese pile. In fact, everyone here seems to be a mouse with a dwindling pile of cheese.

    Well I'm not fearing change anymore! I'm going to embrace it!

    In the standard way of doing things I wrote down what I didn't like about my current job and what I did like about it. It seemed that I liked the people but disliked the work itself. So below is a list of things I want to have in the next place I work with examples of why I want them and/or examples of what I have now.

    The Environment

    1. Open Air: I want to work in a place where I can see what everyone is doing within the general area whether they are at their desk or not, etc. I want it to be a relaxed environment with lots of windows. Currently, the work environment I am in is not conducive to collaboration or working together. Managers are stowed away in individual offices with doors, and each developer is located in a 7x7 cube with 5 foot tall walls. There's a "seniority complex" with management and other employees around me who think that they "deserve" to be located near the office windows as apposed to those employees with less tenure. The idea of being in an enclosed cube near a window as some sort of job perk is asinine.
    2. A real Cafeteria: I want to work in a place that has or is near a real cafeteria; one where meals are prepared daily. The food is affordable (free preferred) and healthy. Currently, we have a small room called a "cafeteria", with no prepared food, only a couple of candy vending machines. Two refrigerators and three microwaves are in the kitchen area where we are to prepare our own microwave meals. Because the cafeteria is on the other side of the building, fridges are strategically placed throughout to make storing our own food easier on us, but the extremely lazy are not allowed to have their own microwave for reasons that they cause "power draining" issues.
    3. Dress Code: I want to work in a place that would let me wear a t-shirt if I felt like it. Currently, we have a casual business dress code. This dress code is pretty flexible as a few of us are on the cutting edge wearing blue jeans each day. If we even thought of coming in wearing even a company-logo'ed t-shirt, we'd be pointed out as pariahs. I'm not totally complaining because I know there may be a customer walking through, but I want to work in a place where the customers don't mind the attire. A person shouldn't be judged on whether they are dressed in a suit but on the results of their work. To say a t-shirt is going to make me look like less of a business person or less reliable is old-school thought and should be abandoned.
    4. Mixing of management and workers: I want to work in a place where I have access to upper management. We currently have managers who I've never met, or see only in the hallway. They will never go out of their way to ask what I'm doing to make the company profitable, nor would they attempt to go out of their way to say hello. I want to work in a company where I can eat lunch with the CEO (at least in the same room) and let him know what kind of a job I think he's doing. A CEO or boss who doesn't have time to meet with the troops at least once a week or month is a boss who's out of touch. If I were in charge, I'd want to know what my employees were thinking first hand. This may be tough to do if you have many remote offices, but the leadership of each office location should be doing the same thing to know exactly what's going on in the minds of their people. We used to have a managers luncheon but it made no sense because they would randomly choose a group of 3 to 4 people and a manager from a division they weren't even associated with, then send them all out to lunch. This was so random that it wound up being a meet and greet other employees as apposed to talking to your own managers about the company in a relaxed setting. I believe they stopped these lunches as a cost cutting tactic.
    5. Embraces and acknowledges Ingenuity: I want to work in a place where research and development are the primary goals of the company. Researching and developing new ways of doing things and writing applications that implement these new ideas. Currently I work in a situation where all development being brought in is for a standardized "cookie-cutter" web-based data entry and retrieval application. The only innovation is only really made by a few of us and even then there is no money or input in allowing us to build on those innovations allowing them to grow. It's left up to us to use our own personal time to make any progress with the innovations and in turn the ideas become quickly outdated. The company is not looking to write the next killer application as they usually only spend the money they win on a contractual basis. I've only been subtly acknowledged for innovation here either through un-announced awards or e-mail letters saying "good job" from my boss. The reasoning being that others would be upset if they saw one person winning awards or being acknowledged constantly. I want everyone innovating and being awarded publicly. This furthers innovation and/or competition to achieve in the minds of those who want to be acknowledged amount their peers.
    6. A "hip" culture: I want to work in a place where I'm not the youngest or the oldest person on the team. There needs to be a balance of tech-savvy individuals. I want to work with people who are smarter than me. Who are a wealth of knowledge but are friendly enough to share it with others. Ideally people with similar thoughts on business and worldly events. Who are active and have an appreciation for the outdoors. Currently, I'm surrounded by a 50-something who sounds like he's dying from some sort of lung ailment, and a 40-something who's more concerned about her kid's sports team than the work she's tasked to do. There are a few of us here who are "hip" but that's not enough to change the hearts and minds of the entire group. I need to be among like-minded individuals who are all in the know, have a grasp on what's cool/fresh, and can bring that knowledge into the work they produce.


    Adoption of Technology

    1. Proper Use of Security: I want to work in a place that has a IT-security department that isn't run by the gestapo. They would be knowledgeable of best security practices but wouldn't dare think of wholesale blocking all outbound traffic for all users. Currently where I work we can't do much of anything when it comes to connecting to a resource outside of the company network. Web traffic is filtered using Websense, but not fairly; in fact very disproportionately. My personal blog is blocked (in fact my server IP and all it's websites are blocked), as are several blogs that are labeled as "personal", but YouTube.com and other mind-numbing time-wasting sites are not. I want to work for a company who has faith in their employees that they will do their job because they love their job. If an employee feels that what they're doing is going to make a difference in the world, they're going to pour every ounce of time they have into it; not surf YouTube. Since I work for a Government contractor I can understand why they would want to operate at a heightened state of security; not trusting their employees to be smart enough to not visit certain sites, but that's only part of a problem. My website expresses my opinions (99% technical) and provides software tools that developers can download and use. However, my co-workers could get the same opinions and tools directly from me, so what's the point of having my website blocked? You can't force people to be productive by blocking websites (I understand blocking nefarious sites) because you usually wind up throwing the baby out with the bath water. Besides, I sit next to a woman who will talk for an average of 2 of her 8 scheduled hours a day on non-work related topics. How do you filter her to make her productive?
    2. Allow a worker to work remotely: I want to work in a place where I can work from home. Maybe not 100% but at least have the option not looked down upon as being a money waster. If a company has invested correctly in the technologies allowing their employees to telecommute, then I propose they would see no difference (perhaps even a savings) in costs than if the employee was taking up a space in the corporate building. A Virtual Private Network, video conferencing, and/or video/voice/text instant messaging along with standard e-mail all would provide the equivilant capabilities of having an employee on location. The only exception would be meeting a client outside of the corporate network infrastructure... but even then a conference call could be made. Studies I have read show that employees who work from home tend to work harder and longer hours rather than the perception that they don't do any work at all. Again, if the employee's heart is in the work, they will do the work no matter where they are. Where I currently work we do have VPN and conferencing capabilities, but the managers will only allow telecommuting for those who have moved away to another state. They don't embrace the concept of having people work at home. Even if it's proven that doing so saves the company money via less power, resources, and consumables usage at the corporate office. I want a company who can appreciate these concepts, embrace them, and not be fearful that their employees are off shopping for pampers or fishing on some lake while on the clock.
    3. Bleeding edge technologies: I want to work in a place where we are not only using the latest technologies but we are creating them. I want to develop code that is new, or at least is going to be integrated into something that's new. Create a product that has never been seen before or has innovations that leap over the previous versions. Currently where I work, we have slow adoption of new technologies and development concepts mainly because of developer learning curves and restrictions on the technologies we are allowed to implement for our (mainly government) clients. I don't want to have to be the one constantly pushing management to have employees learn new technologies or adopt new theories. I want to work for a company that embraces the concept that their employees need to be always learning the latest consumer trends and technologies. This allows the employees to use the latest technologies to better their own processes, capabilities, and/or development results.
    4. Encourages community outreach: I want to work in a place where I'm encouraged to communicate with others and help them in using our products. A company should embrace the concepts of blogging and message forums. Currently we are prohibited from running any sort of public message forum or blog; period. I assume it's considered as a task of the marketing department, and frankly there really is no need for me to do so since the company I work for is a government contractor. I however want to work in a place where I can talk directly to the customers, get their uncoated-sugar-free feedback and let them know they're important. Having the ear of the folks creating the product they spent a fortune on is a big plus in the minds of customers. Currently, I don't even know why I'm coding a website or who is going to be using it, I just do it.

    So there's a few things I would like in my next job. If anyone can comment and let me know of a place where they need an expert C#/.NET/C++ developer, I'll gladly consider their recommendation as my next (and probably final) job. As for my current company, I don't expect them to change their policies any time soon or spend the money to make the necessary upgrades in environment or technologies. They are a steady paycheck that is for sure as are most government related jobs, but remember that the pile of cheese eventually runs out.

    Share this post: E-mail 10+Things+I+want+in+a+Job | Submit 10+Things+I+want+in+a+Job to Technorati | Submit 10+Things+I+want+in+a+Job to del.icio.us | Submit 10+Things+I+want+in+a+Job to digg.com | Submit 10+Things+I+want+in+a+Job to reddit.com | Submit 10+Things+I+want+in+a+Job to DotNetKicks | Add 10+Things+I+want+in+a+Job to Live Bookmarks
  • C# Best Coding Practices

    Below is the bulk of the content from a standard procedure I recently wrote for my open source project .Mail Server Suite. Often when you have a group of people working on a single project, it makes sense to have an expectation of consistent code design from each developer. A standard procedure document is just that; a standard way of doing something. Thus many projects should develop a standard procedure document to instruct their developers on the best practice for developing in the language used. I am partial to C# in all my projects these days, and thus wrote the SP for C#. Enjoy.

    C# Coding Standards

    1.0           File Naming Conventions

    1.1 Namespace Folders

    For each namespace, a sub-folder shall exist within the main project folder with the same name as the namespace. Source files for each class that resides in the namespace shall reside in the appropriate namespace sub-folder.

    1.2 C# Source Files

    a.       Files will be named by the class object that they implement.

    b.      The source file will be labeled as “ClassName.cs”

    c.       Classes should be given meaningful names.

    d.      Class names should follow UpperCamelCase naming convention with the first letter of the class in uppercase.

    e.      Interface class names should begin with the capital letter “I

    1.3 XML Configuration Files

    a.       Configuration files shall reside in either the root project folder or a designated configuration files sub-folder; e.g. \Config\

    b.      Configuration file names shall have the extension “.config”

    c.       Configuration files shall follow the XML schema standard designated by the developer.

    1.4 Documentation

    a.       All documentation shall be written clearly and in a format designated by the Software Task Manager or designee.

    b.      Documentation should be stored in a format easily accessible from any machine. If rich text/content is required, the document should be stored in Microsoft Word format or Adobe Acrobat PDF format for final documents.  Otherwise, documentation should be stored in a text file with standard ASCII CR-LF line breaks.

    1.5 Database Scripts

    a.       All scripts to update related database systems shall be stored is a project sub-folder named “SQL”. Under this sub-folder, a sub-folder shall be created for the particular build version.

    b.      SQL script files shall be in a standard ASCII text file format with CR-LF line breaks. A script file should be created for each relevant database management system (e.g. SQL Server, mySQL, Oracle, etc.)

    c.       SQL script files should follow standard commenting practices as well as a standard SQL-92 format unless a specific requirement must be made for a particular database management system.

    1.6 Optional Resources

    a.       Any additional resources such as internal resx files or images shall be stored in a sub-folder named “Resources” under the project root folder.

    b.      Either any files that will not be compiled or distributed should reside in the Documentation sub-folder or a separate sub-folder named “Misc”.

    2.0           Source Comments

    All source code files shall contain a “page-level” documentation block at the top of each file and “class-level” documentation block(s) immediately above each class. Block-level comments should be liberally used throughout the code where needed.

    2.1 Page-Level Comments

     

    2.2 Class-Level Comments

    This comment header will be placed above every class:

     

    2.3 Class-Property & Method Comments

    Additionally, at a minimum a summary comment header should be placed before every public property and method within a class:

    2.4 Trailing Comments

    Very short comments can appear on the same line as the code they describe, but should be shifted far enough to separate them from the statements. If more than one short comment appears in a block of code, they should all be indented to the same tab column. If a comment is lengthy in wording it should always be placed above the block or line of code it is describing.

    Desired – Easy associate follow comments

    // The following code shall add two numbers

    // and passing the result into an integer.

    iResult = iNum1 + iNum2;

     

    Not Acceptable – Comments can get winded and scroll off screen

    iResult = iNum1 + iNum2; // The following code shall add two numbers...

    2.5 Single-Line Comments

    Short comments can appear on a single line indented to the level of the code that follows. If a comment cannot be written in a single line, it should follow the block comment format. A blank line should precede a single-line comment.

    Desired – Easy associate follow comments

    if (bCondition)
    {
        // and passing the result into an integer.
    }

     

    2.6 Multi-Line Comments

    The // comment delimiter should be used for multi-line comments that do not precede a large block of code. To facilitate commenting out lines of code during debug and test phases of software development, the /* ... */ comment delimiters should not be used for multi-line comments unless at the beginning of a large block comment. A blank line should precede multi-line comments.

    Desired – Easy associate follow comments

    if (bCondition)
    {
        // The following if statement will compare the
        // value of bar to 1 and if it’s greater then it will
        // execute additional code.
        if (bar > 1)
        { ...
        }
    }

    3.0           Code Layout

    3.1 Code Block Indenting

    a.       When indenting blocks of code use a tab character or 4 spaces per sub-block of code.

    b.      Opening and closing parentheses should be lined up at the same indentation level.

    Desired – Easy associate brace with if statement

    if (bEvaluate)
    {
        if (bEvaluate2 >= 1) // operators are neatly spaced
        {
        }
    }

     

    Not Acceptable – Not easy to associate braces with if statement, no space after if

    if(bEvaluate)
       {
         if(bEvaluate>=1){ // operators are not neatly spaced :(
         }
       }

     

    c.       Single-line code executions do not require braces but cannot exist on the same line.

    Desired  – Easy to process, can easily add more code lines in an if-result

    if (bEvaluate)
    {
        Console.WriteLine("The value was true");
    }
    else
    {
        Console.WriteLine("The value was false");
    }

     

    Acceptable – Easy to process braces, compact

    if (bEvaluate)
       
    Console.WriteLine("The value was true");
    else
       
    Console.WriteLine("The value was false");

     

    Not Acceptable – Not easy to process braces or execution

    if (bEvaluate) {
         Console.WriteLine("The value was true");
    }
    else Console.WriteLine("The value was false");
     

    3.2 Statements

    3.2.1       Simple Statements

    Each line should contain at most only one argument.

    Desired

    iVariable++;  // Correct
    iVariable2++; // Correct

     

    Not Acceptable

    iVariable++; iVariable2++; // Not-Correct

    3.2.2       Compound Statements

    Compound statements are statements that contain lists of statements enclosed in braces “{ statements }”.

    a.       The enclosed statements should be indented one more level than the compound statement.

    b.      The opening brace should be on a new line below the compound statement; the closing brace should be on a separate line and be indented to the the opening brace.

    c.       Braces are used around all statements, even single statements, when they are part of a control structure, such as an if-else or for statement. This makes it easier to add statements without accidentally introducing bugs by forgetting to add braces.

    3.2.3       Return Statements

    Return statements should usually only occur once and should reside at the end of a method or property call. Placing them in multiple locations in the body of methods makes code execution paths harder to follow.

    Desired – single return point, easy to process code flow

    virtual public bool CanUserDoSomething
    {
        get
        {
            bool returnResult = true;
            if (evaluate)
            {
                returnResult = false;
            }
            else
            {
            }
            return returnResult;
        }
    }

     

    Not Acceptable – multiple return points can cause confusion, possible unused code.

    virtual public bool CanUserDoSomething
    {
        get
        {
            if (evaluate)
                return false;  
            else
            {
                return true;
            }
        }
    }

    3.2.4       If/Else If/Else Statements

    If/Else If/Else statements should use braces following the operator to delimit their block of code. Operators should be neatly separated by a single space. See 3.1.c for examples.

    3.2.5       Switch Statements

    A switch statement that allows one of its cases to fall through to the next case should be commented as such. A default case should always be implemented even if it contains no further statements.

    3.2.6       Do/While/For Loop Statements

    Do/While loop statements are similar to if-statements in that braces should be used following the operator in all cases. Use of similar indentation and brace usage should be also be adhered to. A while-statement should be used when continually looping (checking a Boolean status for break). A foreach-loop should be used on collections and arrays where an index is not required. For-loops should be used where an element index is required.

    Desired – Easy to process braces

    while (evaluate)
    {
       ...
    }

     

    Acceptable – Post-test loops are not desirable

    do
    {
       ...
    }
    while (evaluate)

     

    Not Acceptable – Not easy to process braces or execution

    do {
        ...
    } while (evaluate)

     

    Desired – Easy to process braces

    foreach (string s in strings)
    {

    }

     

    Acceptable – required only when index check required

    for (int i = 0; i < strings.length; i++)
    {
         if(i == 0)
         {

            stringsIdea += "-first";
         }

    }

     

    Not Acceptable – Not easy to process, out of loop variable initialization, end of loop check lengthy

    int l = 0;
    for (l;l<=strings.length-1;l++) {
        if(l == 0) strings[l]; }

     

    4.0           Declarations

    4.1 Number per Line

    One declaration should be placed per line as this encourages commenting.

    4.2 Placement

    Put declarations only at the beginning of code blocks. Don’t wait to declare variables until their first use; it can confuse a programmer and decrease code portability within the scope.

    Desired  – Variables are defined early

    void someMethod()
    {
        int intResult = 0; // begging of method block
        ...
        if (condition)
        {  int intValue2 = 0; // beginning of if-block
           ...
        }
        ...
    }


    The one exception to this rule is indexes of for-loop, which in C# can be declared in the for-loop statement:

    Desired  – index variable defined in for loop

    for (int i = 0; i < 100; i++)
    { ...
    }

    4.3 Namespaces

    Namespaces should in most cases be a name that follows a domain structure similar to a hierarchal folder structure. In fact, namespaces should correspond with the sub-folders within the project root folder. Namespace names should have their first letter capitalized followed by lowercase letters. E.g. namespace Server.Network {...}

    4.4 Class and Interface Declarations

    When coding C# classes and interfaces, the following formatting rules should be followed:

    a.       No space must exist between a method name and the parenthesis “(“ starting its parameter list.

    b.      The opening brace “{“ appears on the line below the declaration statement.

    c.       The closing brace “}” appears on a line by itself indented to match the corresponding opening brace, unless the brace is initializing an empty array property.

    d.      Class and interface names should use an UpperCamelCase naming convention.

    e.      Abbreviations should be avoided, but can be used when the meaning is clear (e.g. Url, Html, Xml, Org, etc.)

    Desired  – Easy to process, braces align correctly.

    public class CanUserDoSomething
    {
        void DoSomeMethod(...)
        {
            ...
        }
    }

     

    Not Acceptable – Not easy to process braces

    public class CanUserDoSomething {
        void DoSomeMethod(...) {
            ...
        }
    }

    4.4.1       Private Properties

    a.       Private property (member) variables should  named using lowerCamelCase conventions.

    b.      Avoid abbreviations, one-character names, and non-alphanumeric characters like the underscore “_”.

    4.4.2       Public Properties

    a.       Public property variables should be named using UpperCamelCase naming conventions.

    b.      In most all cases, get and set code-methods should be used for setting and retrieving a given value.  

    c.       All public properties should be commented using the specification provided at 2.3.

    Desired – Easy to process braces, hides exposure to internal variable.

    private string hostName;
    public string ReadOnlyHostName
    {
        get 
        {
            return this.hostName;
        }

        set
        {
            this.hostName = value;
        }
    }

     

    4.4.3       Public & Private Methods