Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Tracking difficult bugs, the programmer / customer relationship

If you've been programming for a while, you have probably come across one or two of those code bugs that are really really really hard to reproduce, track down and fix. And yet - when you do track them down / fix them from live (production) code, your users / customers just shrug their shoulders and you get comments like "if it only took you a minute or two to fix when you found what it was, why on earth did it take you so long to find what it was in the first place?"

I've had one of these 'incidents' running over the last few days.

The support pledge to ask people who are in favour of, and would use and benefit from, an improved TransWilts train service (www.transwilts.org.uk) is backed up by a page that includes a list of signatories so far.

When I wrote it, it worked.

When I tested it, it worked.

When I revisited it, it worked.

When others visited it, it worked.

Then someone report it had failed - a big gap between the two columns of names, and the right-most column so squished that the names folded - fault.

I tested it again - visited the page and ... it worked.

Correspondence - "which browser are you using" and "what's your screen resolution, but the problem went away - even for the reporter, it worked.

I tried it the next day to make sure, and it worked.

Another failure report came in - fault.

And deciding that there had to be *something* in these reports I visited the page and (to be honest, to my surprise) I got fault using exactly the same browser that had previously been working. But at least I now had evidence on my screen, and I was able to capture the HTML of that evidence and see just WHY it was happening.

Here's the excuse explanation:

Around 10% of our signups ask that their name be withheld rather than appearing on our page. That's for people in the railway industry, for example, who want to show their support but can't have their names out on our site because of their jobs. As each name is added on to the display, our code says "am I exactly halfway through the names I have to display" and if the answer is 'yes', it starts a new column - thus giving two columns.

However, if there happened to be a "name withheld" exactly halfway through, the answer to that question will be 'yes' not once ... but twice (the program loop before AND the program loop after the name to be hidden) and so the new column code is run twice, and we ended up with an extra blank column; we also ended up with columns with a total width or 150% of the width of the table, which browsers may get confused about.

When you think about it, the explanation makes logical sense when looked at against the evidence, with more people signing up as the campaign runs, so the problem appearing and disappearing as a certain Mr M..... (name withheld!) is exactly halfway through or slides forwards or back a couple of places.

The solution was to replace:
if (($nsf + $anonc -1) == $halfway)
$names .= "<td><td width=50% valign=top class=nonitaltext>";

by:
if ($split == 0 and ($nsf + $anonc -1) == $halfway) {
$names .= "<td><td width=50% valign=top class=nonitaltext>";
$split=1; }

which rather brutally ensures only a single new column by adding a flag variable (which, yes, I have initialised before the start of the loop).

The solution doesn't answer he question "if the problem was so small, why did it take you so long?", but I hope that this article does - as a whole go some way to providing that answer.




As a footnote, I want to add further comment:

It is very easy - far TOO easy - for the programmer in these circumstances to assume that the problem is caused by user error - indeed, I incorrectly did so at first, and I apologise. The strong consideration must be given to user error, but not to the extend of it becoming an assumption.

It is hard on the user experiencing the problems too; should he / should he not keep reporting them - especially if intermittent - so a programmer who's dubious as to their validity.

And IN THIS PARTICULAR CASE, I want to thank L** who has been the primary reporter for his positive approach and good nature while we have been sorting it. L** - you're quite exceptional and I'm proud to have you as a friend as well as a colleague in campaign.

(written 2009-03-20)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Q100 - Object Orientation and General technical topics - Learning to Progam
  [4575] Learning not just what a program does, but how to design it in the first place. - (2015-11-06)
  [4337] Learning to program sample program - past its prime, but still useful - (2014-12-02)
  [4326] Learning to program - comments, documentation and test code - (2014-11-22)
  [4325] Learning to program - what are algorithms and design patterns? - (2014-11-22)
  [4324] Learning to program - variables and constants - (2014-11-22)
  [4323] Learning to program - Loop statements such as while - (2014-11-22)
  [4322] Learning to Program - the conditional statement (if) - (2014-11-21)
  [4318] Learning to Program - how we start to teach you at Well House Consultants - (2014-11-16)
  [4008] Reading and checking user inputs - first lessons - Ruby - (2013-02-17)
  [3895] Flowchart to program - learning to program with Well House - (2012-10-14)
  [3551] Some terms used in programming (Biased towards Python) - (2011-12-12)
  [3120] Learning to write good programs in C and C++ - separating out repeated code - (2011-01-04)
  [2973] Learning to program - where to start if you have never programmed before - (2010-09-28)
  [2898] Programming Standards from the start! - (2010-08-02)
  [2505] I almost put the bins out this morning - (2009-11-16)
  [2504] Learning to program in ... - (2009-11-15)
  [2326] Learn a new programming language this summer. - (2009-08-06)
  [2294] Can you learn to program in 4 days? - (2009-07-16)
  [2286] New to programming? It is natural (but needless) for you to be nervous - (2009-07-14)
  [2048] Learning to program in PHP, Python, Java or Lua ... - (2009-02-19)
  [2001] I have not programmed before, and need to learn - (2009-01-19)
  [1985] Learning to program as a part of your job - (2009-01-10)
  [1963] Best source to learn Java (or Perl or PHP or Python) - (2008-12-28)
  [1605] Learning and understanding scripting programming techniques - (2008-04-08)
  [116] The next generation of programmer - (2004-11-13)

Q914 - Object Orientation and General technical topics - Principles of Code Optimisation

Back to
C, C++ and C# ... Java and JavaScript
Previous and next
or
Horse's mouth home
Forward to
Leading Lines
Some other Articles
Where is my new Apache httpd installed
Blue Ridge and Melksham Chambers of Commerce
If you have a spelling mistake in your URL / page name
Leading Lines
Tracking difficult bugs, the programmer / customer relationship
C, C++ and C# ... Java and JavaScript
Melksham to Georgia
The Longest Day - Wednesday, 28th September
Changing the 404 - file not found - page in Tomcat
Comparing Java Courses - what can we do?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2092_Tra ... nship.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat