Technodrone

there's some good in this world, Mr. Frodo... and it's worth fighting for.

  Home  |   Contact  |   Syndication    |   Login
  17 Posts | 2 Stories | 37 Comments | 0 Trackbacks

News

Article Categories

Archives

Post Categories

Image Galleries

agile development

Code hacks

Face Book Profile

LinkedIn Profile

Recommended Products

Tuesday, November 24, 2009 #

Someone confronted me about Ideal vs Necessary Evil in regard to coding to best practices. 
Today there was a loud debate among myself and two other developers regarding how to handle some legacy code. One developer wants the the legacy code refactored and testable the other wanted to modify the code quickly since the company plans to rewrite the application after the next deployment in a month.  I wanted to make a code branch of existing code then refactor as much as possible as long as the new functionality was working first.  At the end of the long discussion there was still no agreement. One of the developers sent me this email after the meeting. (yes I have his permission to post)

 

"In few years back, Dental flossing is Ideal, but now enough studies are done to prove it’s necessary now. But still some people with bad habits, (sometimes including myself), think that it’s  not necessary.
Whatever view we have, the reality of dental impact on the health doesn’t change. Same goes to SOLID principle in specific, agile practices, values in generals.
An agile developer expresses values through practices. Like daily dental flossing for health.  For some, dental flossing is ideal ( I used to have that view). Now I know enough, it’s not ideal for me anymore. My point is that you learn agile practices, principles till the point you see there are necessary for your professional development. The danger of view of Idealism where necessity is demanding is that as long as we have that conviction, our minds can trick us to give up easily in daily pressured activities. There were cases in my learning experience, I got tricked , and I paid for it. This is from my years of observation.  I am writing this to elaborate more on my point on ideal, and its impact on us. "
 
I was trying to find a way to refactor the code and to not break existing code.  Lesson learned: Making everyone happy makes no one happy it seems.

 

Over all I think the best indication that someone will be a good agile
team member is:

  • Demonstrates  a long-term desire to move from journeyman to craftsman. (study groups, software related blogging, seeks out training)
  • Demonstrates that they will share knowledge insights with others.(mentoring,being mentored not just for newbies all team members)
  • Open to debate and new ideas. (question whenever a quick solution does not follow solid principles, or adds unnecessary technical debt)
  • Willingness to work closely with non-developers (users, business owners, managers)
  • Patience with the process (complex problems are not easily solved it takes time and investigation).
  • Can make the argument for refactoring code.

Sunday, November 22, 2009 #

I am learning all I can about the solid principles. Currently I am
reading about the Single Responsibility Principle (A class should have
only one reason to change).  If a class has more than one
responsibility, the responsibilities become coupled. This kind of
coupling leads to fragile designs that beak in unexpected ways when
changed according to Bob Martin. An example I have seen lately is the
case of the widget.com public site and the widget.com customer site
having the exact same code base except for the part code that deals
specifically with customer service. The team debated whether the
customer service code should be pulled out of the customer service
site and placed into the public site so that two almost exact code
repositories needing to be maintained. There was disagreement among
the team. Some felt this would be efficient others felt that this was
breaking SRP. Others thought combining the code together violates the
DRY principle. What do you think?


Friday, October 23, 2009 #

Someone that I respect in software development recommended this book to me. Pragramatic Thinking & Learning by Andy Hunt. I got it in the mail last evening and have already read half of it. He talks about the Dreyfus Model Stages. These stages apply to any profession and were first implemented in the early 1980s with nurses.  He says skills in a profession are distributed in 5 levels from lowest to highest: Novice, Advanced Beginner, Competent, Proficient, and Expert. Most people don't get past Advanced Beginner. After reading this chapter I now see why implementation of agile will likely fail if any of the team members are at the Novice or Advanced Beginner stage.  I would recommend to any developer interested in maximizing their skills and mental sharpness read this book.  It is an enjoyable book to read as well.

Saturday, October 03, 2009 #

I am currently working with a company that has a 40 million dollar contract that will be lost if the code is buggy and incomplete. We have just started writing unit tests. TDD is foreign to most of the team members. Most of the code is contained in the code behind of aspx pages. I am using selenium to write the unit test. Team members are getting frustrated because of the tight deadline; they feel they don't have the time to unit test. While this is going on the company has decided the team should use the agile methodology yet they have no training/mentoring so it is causing them more frustration and anxiety. We have a consultant telling them they must learn TDD and agile while at the same time they have an extremely tight deadline. The deadline will not budge. I want the team to be able to produce quality code within the timeline. At the point it is too late to eliminate the spaghetti code and lack of domain objects. I still want as much test coverage as possible. I am the go between the developers, an agile consultant and the management. Any ideas?

Tuesday, July 28, 2009 #

My bank/credit card company is jerking me around. I mail my bill in on the 1st it is due on the 12th but magically it always gets posted to my account on the 13th making it late.  This has me extremely p*ssed off. To make a long story short, I think they are purposely posting the payment the day after the bill is due. I would like to meet the programmer(s) who agreed with this as a user story see want kind of jerk thinks this is ok to do to their customers.

You would think they would use a random function to make my payment post on a day other than the oh so predictable 13th.  This way their customers don't pick up on the pattern. Mine ALWAYS posts on the thirteenth no matter how early I send it in.  A good random function could make it sometimes post the 10th just to make me think the mail was running fast that month . It could have a range of 5 days. How about from the 10th - the 15th. Then most of the time the bank can get that $39.00 late fee and jack up my interest.

If you are dealing with a bank that treats you like dirt , file a complaint on them. The bank has to reply to your complaint in writing within 30 days. They won't admit fault but at least they had to spend some money dealing with your complaint. If enough people do it it may not be worth the money they are getting by jerking you around.  By the way the bank I am dealing with got a big bail out.  I guess when your bank is ran like amtrack this is what you get. Programmers that are too stupid to effectively rip their customers off.  Run of the mill thugs I tell ya.

File your compliant here:

http://www.helpwithmybank.gov/

 

 


Wednesday, January 28, 2009 #

I enjoyed this article this morning. I observe and play the chicken game constantly. I always called it the "Is it done yet game".  As the recession worsens we are afraid to say "that enhancement to the web site will say 2 weeks to code and a two weeks to test/fix".  Instead we are told do it all in 40 hours knowing there is no stinkin way that is gonna happen.  If you tell the project manager is going to take longer because of testing and integration you are told. "That is not part of the time estimate.'   If your team uses agile sometimes this game is played on a daily basis at the morning stand up meeting.  One of the most popular strategies is to say we are 95% done.  I will admit I have sometimes fibbed and said I was making progress when instead I was behind schedule.  It buys a little time but only works a time or two. In these cases everyone is playing chicken with everyone else just because the team is unwilling or afraid to be honest about time estimates. I think this kind of behavior worsens as we try to do more with less.  In the long run the project still takes as long as it takes. If people are truly striving to do a good job. The  developer may have originally estimated 40 hours the project manager said no do it in 12 hours. In the long run it still takes 40 hours or possibly more due to lack of communication. Why can't we just communicate more honestly . That is just not in vogue in today's climate of fear of retribution.  We just keep playing this time wasting non-productive game.  Here is a link to the article on Stickyminds.com.

Managing the Chicken Game

Disclaimer: References to the Chicken Game do not reflect upon current or past employers. It is just a half thought out editorial based on lack of sleep. No animals were harmed and I only consumed 2 carbon credits creating this post. I put my redbull can in the recycle bin by the way.

 


Friday, January 02, 2009 #

I came into the office on January 2, 2009 and found out one of my applications was not finding files that have names based on the day of year and month of year.  Here is the problem, my code was looking for a file called  'thepreciousfile200911.txt" instead of "thepreciousfile200901001.  This worked 12/28/2008 but when the day of year changed to a single digit on the new year I could no longer check for file existence because the string I was using for the file name was now wrong. When I retrieved the day of year from the current month I blanked out and did not think it would return as 1 and if it did that was the correct file name anyway. Well it was wrong.  Here is what I did to fix it and it was extremely easy.

 

In this example the 3 is the number of characters I want the resulting string to have and the '0' is the character you want to use for padding if the day of year does not equal 3 characters. 

string dayofyear = Convert.ToString(DateTime.Now.DayOfYear).PadLeft(3, 0);

Friday, December 19, 2008 #

The following code adds an attachment to an email if the attachment file exists. If the file does not exist the the email informs the recipient that the file was not found. The recipients are read in from a text file. This sample sets the priority of the email to high and sets the body of the email to html so you can do some formatting. You will need a "Using" statement for System.IO and System.Configuration since things like email server and path to the list of recipients are stored in a config file.  This particular example is from a console application. "EmailBody" is a string builder that as added to as various processes are checked. Note of caution: be the email can be sent from "valid" looking email address and be beware of getting your "Send" portion of the code in a loop.  I know how embarrasing that can be. Have fun, be careful.

        protected static void EmailNotification(string FileName)

         {

            //name of email server

            string emailserver = ConfigurationSettings.AppSettings["emailserver"];

            //path to file that will be added as an attachment if it exists.

        string gl_daily_transactions = ConfigurationSettings.AppSettings ["gl_daily_transactions"];

        var devemail = new System.Net.Mail.MailMessage();

        var mailClient = new System.Net.Mail.SmtpClient(emailserver);

        devemail.From = new System.Net.Mail.MailAddress("XYZInterfaceMonitor@notarealcompany.com");

        string subjectline;

        if (Success)

        {

            subjectline = "XYZ Interface process completed successfully. ";

        }

        else

        {

            subjectline = "XYZ Interface process did not complete successfully. ";

        }

     

            devemail.Subject = subjectline;

    

        devemail.Priority = System.Net.Mail.MailPriority.High;

        if (File.Exists(gl_daily_transactions))

        {

            System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(gl_daily_transactions);

            devemail.Attachments.Add(attachment);

        }

        else

        {

            //append to string builder object

            emailBody.Append("<hr />The GL Daily Transaction File was not found.");

        }

 

        devemail.IsBodyHtml = true;

        emailBody.Append("<hr/>End of Notification");

        devemail.Body = emailBody.ToString();

      //FileReader returns an array of recipients from a text file

        string[] recipients = FileReader.ReadFile(FileName);

 

        for (int index = 0; index < recipients.Length; index++)

        {

 

            if (recipients.Length > 0)

            {

                devemail.To.Add(recipients[index].Trim());

            }

        }

        mailClient.Send(devemail);

 

    }

 

       

 


Friday, December 12, 2008 #

I have been hacking at this for two days. I could use a little help here. I am rewriting a console application that uses a com object named transaut.tlb.  This object exposes cognos transformer functionality. I used tlbimp.exe and imported it.  When I make reference to this dll and use it in my code, the code compiles but I get the runtime error "CLSID{blah ,blah...} failed due to the following error: 80040154".  I tried making a reference to the orginal com object transaut.tlb I tried registering the imported dll but got the error  "cognostransformer.dll was loaded but the DLL Register Server entry point was not found. This object worked with .net version 1. Any help would be appreciated.   Thanks