Magenic Technologies Community Blog

Welcome to

Magenic Technologies Community Blog

Sign in | Join | Help
in Search

Pauli

  • Back to work

    I just returned to work from an unplanned 3 month medical leave.  Had I known that I was going to be away from work for 3 months before my medical mishap occurred I may have done some additional things on that last Friday that I had worked.  Of course you never know when the unexpected is going to happen but it would sure make life easier.  Here are the things that I would have done on that Friday:

    Check in the code and database changes that I had worked on that day.
    I am usually good about checking my code back in but I had just started working on an item that required some database changes before I had completed the all the required code changes.  So I made the needed changes in the database and was ready to start the coding changes but the weekend had arrived and I would be able to wrap up the changes the following Monday morning which by then I was starting on my medical leave.

    About three weeks after I was discharged from my 1 month hospital stay I received a phone call from someone at work.  This was someone that I had not known and did not recognize the number on caller ID so I let the call go the answering machine.   As I was listening to the message being left the phrase that jumped out at me was “ I need to stop by your home to pick up your laptop”.  What?  That’s one thing you never want to hear from your employer, especially when you are on leave.   So I immediately ran to the phone and picked it up to find out what this was all about.  As it turned out the architect on the project I was on was getting ready to prepare for the deployment of the next release and noticed that there was still code checked-out by me.  Because they didn’t want to bother me while I was on leave, they figured they would just have someone stop by to get my laptop to get the code changes.  When I found out that was all they really needed I went back through the VS project and checked in the changes within a couple of hours.  I assured the project manager it was OK to bother me.  Much better than asking for my laptop.

    Documented what was left to complete on the associated work item.
    This would have been a great help when I was checking in the code changes since I did not want to check in changes that were only partially completed or would negatively impact the application.  I had to review all my code changes and reconstruct in my mind what I was doing on that last day. I was able to determine that the code and database changes could be safely checked-in but had discovered that there were still some important code and database changes that still needed to be done.  This exercise was actually quite helpful in my recovery process as it forced me back into using the skills I would need once I returned back to work.

    Make a note of the numerous passwords being used on the various systems in the project I was working on.
    Sometimes I’m hard pressed to remember some passwords on a long weekend or a week off but after being off for 3 months my mind went blank when attempting to login in to the VPN and SQL Server database.  Thankfully one of the project team members was working offsite (from the client) in the office that day and helped where my memory had failed.   It’s funny how things you do numerous times everyday becomes so automatic to you.  I guess you need to use it or lose it.  Once I “relearned” the passwords I needed, it was like I had never forgotten them in the first place.  (On a side note I also forgot my password for signing into my blog site.  The list goes on.)

    Shutdown my laptop rather than putting it into standby
    It seems that without power the laptop cannot remain in the standby mode forever so upon first turning on the laptop Outlook had to recover from an improper shutdown.  Now this did not cause much of a problem but you never like to see that you potentially have a corrupted Outlook file.

    Clearing all the unneeded emails in outlook
    The hospital I was at had a wireless internet connection so I was able to use my laptop to check my work and personal emails.   One day I started to receive the dreaded “Your Inbox is full” message warning me that I could stop receiving or sending any more emails unless I archived or deleted past emails so as not to exceed the stated storage limit.   So for the next few days I tried to delete all the messages I didn’t need and even emptied the deleted folder but I was still getting the “Your Inbox is full” message every day. So I moved all my emails, which I had been placing in several different folders, over to my personal folders.  Now because of the total size of the emails I was moving this took a few hours but at least I got the total size of my Outlook storage down.

    Things could have been a whole lot worse but thinking of the things I would have done before going on a leave makes me want to think about how I could change me weekly routine to make things easier even If I do am not gone on leave.

  • Code Refactoring Etiquette

    I attended the Magenic Technology Summit last week and one of the sessions talked about good code design.  It was a pretty good session but it got me to thinking of how we often improve existing code to get it to that more “perfect” state.   Often when working on legacy code or taken over a project from another team there is plenty of opportunities to make improvements to the code.  However, there are plenty of opportunities for making future maintenance of the code a little more difficult.

    How can improving the code make future maintenance harder when better coding and design should make it easier to maintain?    Well, it will make it easier to maintain but there are certain circumstances where frustration can be introduced.

    I was on a project trying to fix a reported bug that was related to a recent enhancement change.   I did not perform the change for the enhancement so I wanted to look at the changes that were made to the code to implement the enhancement.  I found this almost impossible to do.  When I did a comparison on the version of the file before and after the change was made I discovered several changes in the code were done.  Much more than I anticipated would have been needed for the enhancement at hand.

    It seems that the developer who coded the changes for the enhancement also did some refactoring of the code.  It’s hard to argue against that as long as there was no impact on the project schedule or budget especially considering you can quickly and painlessly refactor the code using the refactor options in Visual Studio.

    However life would be much simpler for future developers if the refactoring is done separately from the enhancement or bug changes.  That way you  can actually see the changes made for a particular bug fix or enhancement change rather than having the code changes being lost with all the code changes from refactoring. 

    And please, don’t try refactoring the code when you are going to have to merge your changes to code that was already checked in.  It won’t be pretty and you can easily lose someone else’s code changes.

    So refactoring code and making improvements is great.  Just do it as a separate check-in.

  • And I wasn't even trying

    The users of one of the applications I have been supporting reported a bug which I had repeatedly tried to recreate.  Of course, I was unsuccessful in doing so.  I even watched how the users where making updates on the web page so that I could perform the same steps when trying but I still couldn’t recreate the bug. 

    Having put the bug aside I was later testing another issue I just resolved and lo and behold I was finally able to recreate the bug.  And I wasn’t even trying!  Not only did I finally recreate the bug but I was able to now recreate the bug almost on demand. 

    Why was it that I was not able to recreate the bug the first time but then was easily able to do so later when I wasn’t trying to recreate it?  Was I trying too hard?  Perhaps.  Maybe I was focusing too hard on the details of the reported bug and not stepping back and looking at the whole picture.  Ultimately it came down to performing a certain step in the process that caused the bug to appear.  It wasn’t something I had noticed when the users were making updates on the page.

    Sometimes the smallest things can be the biggest clues.  Once I knew what that step was that led to the error being recreated I was able to find the problem in the code.  I had another issue that was reported that I had trouble tracking down and was happening very sporadically.  I had asked the users to email me a screenshot of the error message to me whenever it occurred.  This not only gives me an idea of the frequency of the error but seeing the actual error message could provide some additional clues. 

    Sure enough I was able to find a clue in one of screenshots that was sent to me.  In one case I had noticed that the networked appeared to be having a connection problem by the appearance of one of the icons on the far right of the task bar.  Had I not been sent the screen shots I would be focusing on the content of the error message.  But I was able to see additional clues in viewing the entire desktop.

    Some bugs do not provide clues like these to help find the cause or help recreate the bug but for those that are tough to track down we must be like detectives.  And sometimes you will find clues in the most strangest of places.

  • Those who cannot learn from history are doomed to repeat it

    What happens when one company takes over the development and support of a system that was originally developed by another company and whose developers are no longer around to provide any historical knowledge about decisions and design considerations in the course of the development of the system?  And of course there is little or no code documentation.   Well, you are doomed to repeat many of the mistakes that they previously experienced.

    I have been part of such a project recently and there were many time where I was wondering why certain design decisions were made and was very cautious about making changes without understanding the “why’s” behind things.  We eventually started to learn some of those “why’s” after implementing some changes and witnessing some unintended side effects and other undesirable functionality.

    In one case we implemented some functionality that was left out when the original system was deployed.  The code changes required to implement this was minimal and it seemed strange that this could not originally have been included since it seemed to be part of the original requirements and was such an easy code change.  Well, after being deployed for a couple of weeks we quickly found out why it was not part of the original deployment.    We began seeing orders that should not have been processed correctly being denied but credit cards still being billed.   So, we quickly reversed out the changes to prevent customers from being billed for orders not processed.

    Well, it seems that the previous developers went through the same experience as we did including the backing out of the functionality.  Had we been aware of this we could have known that maybe there was a different approach that needed to be looked at.  Sure enough, after doing some research we discovered that there was a configuration change needed in a business partner’s system rather than code changes on our part.

    What can you do other than repeating the mistakes of others to minimize risk when implement new and enhanced functionality? You really need to start asking a lot of questions.  Although the original developers may not be around you can often talk to those who were around when the development occurred.  They may not have been coding but there are probably business people around who helped provide input to the requirements or helped test the system.  When you start talking about possible enhancements to a system to them you might hear responses like “Oh yeah.  They tried adding that change before but it started to do this … and had to be backed out.”

    You will need to act like a detective to understand any potential pitfalls for making changes.  You do not have the original players but plenty of “witnesses” so don’t be afraid to ask.  Because, without knowing the past, you are surely going to repeat it.

  • Back to the Future

    An article in a newspaper this week brought back memories of a position I was a interviewing for almost exactly 4 years ago where I was one of three final candidates being considered.   The position required both technical and managerial skills along with good customer relationship experience which just happened to fit my background as my previous 2 jobs at that time had required a pretty good mixture of those attributes. 

     

    During the interview process I had learned that the project for which the position would be part of involved the development and support of a backend system for a government agency.  Apparently things were not going well with this client which prompted the creation of the position I was interviewing for.

     

    I was not offered that job but fortunately got an offer from another company that led to greater opportunities.  After reading this article, all I could think was “Wow, I’m glad things worked out the way they did.”

     

    It seems that things never really got better with this company and client.  Not only was this company replaced by the government agency for another contractor a couple of years ago but have been blamed for a series of delays as the project was transitioned.

     

    Now I would like to think that perhaps the outcome would have been different had I been offered the position but that project may had already been doomed at that point.  Hindsight is always 20/20 but as I have now been looking back I can say I wasn’t really surprised by what I read.

     

    The impact of the project’s failure and resultant transition has been largely felt by many and has given this government agency a black eye.  For the past year problems have been reported in the newspapers as thousands of people have been incorrectly billed and fined for incidences occurring more than a year ago.

     

    From what I remember during the interview process and what I surmise from the article there seemed to be some communication problems. But to be fair the agency did admit to being part of the blame as they had added requirements to the contract.  Wow, you hardly ever see that happen.    

     

    Communication problems and changing requirements.  Now that’s a sure recipe for failure.  And we all have been there, maybe not on projects so noticeable but I’m sure it happens more than we know.

     

    But as far as the position I was interviewing for, sometimes you don’t immediately see how a decision of a company not to hire you can turn out.  In this case bad for the company and client and good for my professional career in more ways then one.

  • Low Impact Coding

    Have you ever been in a situation where the project you were a part of is 9 hours from deployment and a serious bug is found from some final testing?  I had the experience a couple of days ago and needed to fix quickly fix the problem.  Well it actually seemed like a quick fix because there was another page on the website which had some similar functionality and I remembered that a similar bug was fixed on that page.  So I will just go to that page copy the portion of code over and everything should be fine, right?

    Well, no.  When the call was made to a function in the code I added the expectant result was not returned.  Stepping through the code revealed that the parameters being passed to the function were not all populated.  It seems that although the page I got the code fix from uses the same objects they are not apparently populated the same way. 

    Well I can certainly go and fix this solution by updating the stored procedure to added the missing columns to get the data I needed and then update the data objects in the DLL and everything should be fine, right?  But we now have less then 9 hours to deployment and having to update a stored procedure in the db along with a dll change could pose some risk.  At this point in the game it would be ideal to only make an update to the ASPX page and isolate that change.  This is were "Low Impact Coding" comes into play.

    The Boys Scouts of America" have a term known as "Low Impact Camping" where when you are camping you try to leave no trace behind and not damage the environment you are in more than absolutely needed.  When applied to coding, we need to make an update but with the absolute minimum changes necessary as not to impose risk to the rest of the "environment".

    So to address the bug found and to not risk the web app with updates to the database and dll's I took the Low Impact Coding approach and figured a way to only make a change in one function in the web page code behind to return the desired results.  I was able to successully resolve the bug and drastically reduced the risk without making any Database or DLL changes.

    Of course this is not the preferred way of resolving bugs or making any code changes but sometime the situation you are in may dictate it.  But of course it should never stop there.  The next step is to make sure there is a work item to "finish" resolving this bug in the proper way in the next release where changes to the database and dll's can getting fully tested.

    Now I am not trying to advocate Low Impact Coding as an alternative to development but I just wanted to highlight the fact that when making code changes at at time sensitive part of a project that sometimes the approach taken to address an issue may require some creative approaches to ensure that you are not putting the rest of the project to risk.

    But when time allows we should always strive to do the "best" solution.  I'm sure we have all seen code where it looks like the developers may have taken this approach for the entire development of the project.  But that can be a topic for another day.

Powered by Community Server, by Telligent Systems