Hi Paul
> Have you any examples of poor or even terrible code that has really left you scrambling for a resolution to a weird error?
I don't worry about little segments of code so much. I seem to be more interested in reuse than most people. I'll make even a single line of code a module. I'll start with a small example:
x = m.tdDate - DAY(m.tdDate) + 1
Even that small sample would be much more comprehensible / coherent as:
x = FirstDayOfMonth(m.tdDate)
Then LastDayOfMonth reuses FirstDayOfMonth, making the inner workings of LastDayOfMonth obvious.
But what about overall system design? I inherited an application late last year. I like the previous programmer, but it was a single user application built in 2006!?! As it was supposed to be multi-user he tried to shoehorn in multi-user. I was called in to help as it went downhill. His system consisted of at least 87 scxs.
I redid the application with minor data-structure changes. I created only 17 screens. The 17 are providing more functionality than the 87. Consistency is extremely high. Reliability is also very high. Users are already doing things I didn't think of or even expect. That is supposed to be a hallmark of good tool design. IMO, most applications do too many screens.
When this programmer saw how even two of my screens interact, he knew it would be better for the user so he introduced me to them. We were supposed to continue working together, but the client ended their relationship with him after some time passed.
Before that I worked for a local health care organization. I pointed out that their "homegrown" system was putting patient lives at risk. They used the default datasession and a public variable to specify which set of aliases represented which patient's data. One slip of that variable and a nurse could have ended up giving blood thinners to a hemophealiac. Luckily it didn't go live.
As a result they went to a third party system. That system also has far too many screens and does not do as much as it could for the users.
Mike Yearwood
www.foxridgesoftware.comPresident: Toronto Ontario FoxPro User's Group