Posted on Leave a comment

What is legacy code anyway?

Legacy code is software that was written previously by yourself or another developer, left to rot probably undocumented, then after a time brought back to the table as a project to be improved upon.

Code ages. And quickly! Low budget projects tend to be created with little documentation and lots of hacks or workarounds. "This will do for now. We’ll fix it in the next version." Only the developer saying that does not document the need for a fix or revision. This is called firefighting or bandaiding. As time passes techniques or functions that were once hot and vogue become passé and deprecated and sometimes altogether unsupported. One of my recent projects left me scratching my head for a week because the php function session_register() is deprecated and excluded from version php 6.

These legacy apps are also known as evolutionary prototypes. Evolutionary prototypes build features and changes upon the existing functioning application. They have a limited life. After a number of revisions, the application starts to fail miserably. It is like adding more and more plumbing to the house. Eventually you forget what that one pipe does but it exists therefore it must be important. Unfortunately, most clients just see the number of dollars spent building up to the current revision of their application and have trouble justifying the expense of a total rewrite.

Legacy code can be extremely painful to troubleshoot and down right painful to modify since the modifications might mean having to work in the awful practices the previous developer employed rather than using good, professional coding techniques even when the previous developer was yourself. However, most applications will fall into the category of legacy code so a good developer should treat all projects, even the small and under budgeted, as ongoing large scale applications with appropriate documentation of assumptions, explanations of hacks and workarounds, suggestions for future updates, test documents, and so forth. Clients should plan on a total rewrite after 3-7 evolutions.

Posted on 1 Comment

And they call themselves programmers…

Coding Horror by Jeff Atwood made me cry today. I wanted to laugh but it was so painful all I could do is shake my head and cry. Two days ago he made a very good post asking "Why can’t programmers.. Program?" He referenced Imran on Tech who uses a simple problem to figure out if his prospective candidates can code. Imran also has good tastes in WordPress themes. One of Imran’s test questions:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. [Source]

The result was programming types completely missing the point of his post. The tears come in the comments. The first commenter rushed to get his solution to the problem before anyone else. Naturally, many other commenters followed with solutions in different languages or varying degrees of optimization. Why did I cry? Almost every solution has an error!

I also like the debate between the academics and the professionals about recursion. And yes, my view is that recursion belongs in academia and rarely (if ever) in commercial software.

Sadly, it appears that indeed programmers cannot program and, better yet, they cannot even read for comprehension!

Posted on 5 Comments

On Programmers – you are one or you aren’t

I started college as a computer science student. I switched to the college of engineering because I knew "electrical engineers make all the money." One of the professors (actually, I think he was a department head) tried to convince me to stay in computers or "at least take one more class" to which I declined and he said, "you’ll be back." True to his word I returned, battered and bruised with a diminished gpa, to the college of liberal arts to study computer science. I asked why out of 500 students he tried to encourage me in such a way. He simply said, "you have a knack for computers." That remains on of the biggest compliments I have received.

I read more frequently articles that reference programmers and non-programmers. I read one that documented my case claiming that early in an intro to computer science course you can separate which students will succeed as programmers and the ones that will never understand.

But the dirty little secret of the software development industry is that this is also true even for people who can program: there’s a vast divide between good developers and mediocre developers. A mediocre developer can program his or her heart out for four years, but that won’t magically transform them into a good developer. And the good developers always seem to have a natural knack for the stuff from the very beginning. [Source]

I don’t have the ego to say I am a great programmer but my work frequently has me altering code done by lesser programmers and, although the teacher in me wants to reach out to them, I have to wonder if they wouldn’t be better served by a career change.

Posted on Leave a comment

Get with the times! Web 2.0 er no 3.0 keep going Web 4!

So, I offered that the masses of confused people still arguing over the controversial Web2.0 are falling behind because Web 3.0 is here! "Lynx is the official browser of the ICW3." makes it sound like a joke but Web 3.0 has its own Wikipedia page (which doesn’t lessen the joke potential).

Web 3 is the brainchild of Tim Berners-Lee, largely credited for inventing the world wide web in the first place. It’s more commonly called the Semantic Web. [Source]

Ok. Maybe Web 3.0 is real. Seth Godin has suggested Web 4!

Posted on 2 Comments

Are you Web 2.0? Get with the times!

Have you followed the Web2.0 craze? (Don’t tell anyone but it’s just a buzzword..) Did Web2.0 overwhelm you? Still feel like maybe you aren’t sure what Web2.0 is? Get ahead of the game for the next round! Web3.0 is here!

Web 3.0? Still not sure what Web 2.0 is? In short, Web 3.0 is the opposite of Web 2.0. This web site is devoted to explaining what exactly Web 3.0 is and how it will ultimately change humanity. [Source]

Eh? Clear as mud?

Posted on 8 Comments

Kill a programmer – ask them a question

A little disclaimer. My wife is going to take this personally and make it about her. But it’s not about her. Or the kids. It’s about the cat that constantly tries to crawl onto my keyboard. It’s about the incessant phone calls from nasty people. It’s about my mind that wants to wander to finishing projects on the house. It is about emails and computer glitches (right now my linux server doesn’t see the network..that’s an interruption). Client emergencies and angry instant messages. Angst. Yes. It is also about the thuds on the floor. The crying. Little people learning through physics, ye ol’ school of hard knocks. It’s about life’s necessary appointments and cooking dinner. Flooded bathrooms and washing machines.

All that said, a good friend of mine use to keep a piece of paper taped to the wall of his cubicle. It read:

No success at work can compensate for failure in the home.

That said, if I fail at work, I cannot provide for my family. There must be a balance. I will continue to bound up the stairs when I hear a thud following by a painful scream. I will drop everything to answer my wife’s whims. But I must keep a balance whereby work is not hindered. The cat is on notice though. Keep watching the video to see if it continues to land on all fours as I cat-apult it from my desk.

For years I have tried to explain, without success, to various non-programmers that a small interruption costs me 15 minutes of time. "But it will only take a second of your time." That second might be for a phone call, an office joke, move the laundry from the washer to the dryer, a technical question on a non-related project…the topic does not really matter, the interruption is the problem.

Logan Koester of Skin Deep writes about Overcoming Coder’s Block with some excellent advice and references none other than Joel on Software with Just a 60 second distraction can cost a programmer 15 minutes. Once again, I connect with Joel Spolsky very well! If you have a programmer in your life as his/her employer, spouse, or friend, please read this article; it’s the last paragraphs that are important.

Here’s the simple algebra. Let’s say (as the evidence seems to suggest) that if we interrupt a programmer, even for a minute, we’re really blowing away 15 minutes of productivity. For this example, lets put two programmers, Jeff and Mutt, in open cubicles next to each other in a standard Dilbert veal-fattening farm. Mutt can’t remember the name of the Unicode version of the strcpy function. He could look it up, which takes 30 seconds, or he could ask Jeff, which takes 15 seconds. Since he’s sitting right next to Jeff, he asks Jeff. Jeff gets distracted and loses 15 minutes of productivity (to save Mutt 15 seconds).

Now let’s move them into separate offices with walls and doors. Now when Mutt can’t remember the name of that function, he could look it up, which still takes 30 seconds, or he could ask Jeff, which now takes 45 seconds and involves standing up (not an easy task given the average physical fitness of programmers!). So he looks it up. So now Mutt loses 30 seconds of productivity, but we save 15 minutes for Jeff.

[Source]

Every programmer has their magic equation for creative productivity. For instance, I need a warm beverage in hand, my day has to begin early, an uncluttered work environment, a computer that moves as fast as I do, minimal white noise, and a well defined goal.

Posted on Leave a comment

Don’t work for free

I have this standing rule that I break all too often: Don’t work for free. I had this bad habit of giving too much and asking too little. I like seeing people happy; that is why the stage is so appealing to me. On the stage, you instantly know if the audience is happy and, if they are not responding well, you can change the show on the fly to fit the audience. In the business world, not asking for your worth is a guarantee that you will not survive. The customer is temporarily happy but because you undercharged or over delivered their expectation will not be realistic. For future work, you will either not be around to service them because you went out of business due to not making your expenses, or the future work will appear exorbitantly high since they received so much for so litle from you in their previous experience.

I entertained a phone interview recently. The recruiter had explained that if the interview went well, the company would ask me to write a sample webpage. At the time, I thought this made sense. All creative types should keep a portfolio to demonstrate your worthiness. However, when you start running at the pace that I keep there is little time to manage a portfolio; simply pointing to work you have done is no good because other hands change it. For example, if my job was to paint a mural by the interstate, overnight my artwork could turn into a mess of graffiti. The Internet is very similar. You might make a wonderful site that validates and is Section 508 compliant but the minute your influence is gone from the company you cannot expect that website to stay compliant.

Section 508 requires that electronic and information technology developed, procured, used, or maintained by all agencies and departments of the Federal Government be accessible both to Federal employees with disabilities and to members of the public with disabilities, and that these two groups have equal use of such technologies as federal employees and members of the public that do not have disabilities. [Source]

Doing a sample website could show my skills that portfolio, pages due to time or lack of budget, may not reflect. Like I said, seemed like a good idea at the time. I did have the wherewithal to ask the recruiter if I would have an hourly rate for the sample project…no. When the interviewer got to that part of the phone interview, I was graced with the sample project. "Could you set aside 5 days?" My jaw dropped!

I have a checks and balances when it comes to estimating projects. I have dollar figures defined for lengths of commitments to clients. I do my estimate based on the specification but then I check my standards to see if my estimate is accurate. That means if a client says they need me for a day the estimate should be between $a and $b; if they need me for a week, the estimate should be between $m and $n; and if they need me for a month, the estimate should be between $x and $y. A week generally looks like $dddd.dd.

I mentioned in a chatroom, with ambiguity for client confidentiality, the request to write a sample website and asked if that was common. The online community of chatters responded with outrage stating that a portfolio should be sufficient or that questions in an interview should easily ferret out the developer’s skills. The people speaking are big names in my industry; I could walk through Borders and point to several books written by them. Frankly, they suggested I not consider the company and asked, "if this their expectation in an interview, what will their expectations be as an employer?" They implored me not to do the sample project and reinforced that such a trend could be bad for our industry.

Now in all fairness, I interpret 5 days as "we are giving you five days so that you can show us you can meet a deadline and we understand you have other work to do." The interviewer said that it really shouldn’t be a day’s worth of work (that would look like $ddd.dd). I hope he is right that it doesn’t need the full 5 days otherwise I have already blown the job possibility. This week I also had a small project that turned out to be somewhat painful. Additionally, a client was holding payment while I worked out a bug in an application so that had my focus. I have 3 people waiting on estimates (estimates are the hardest part of my job and they pay $0). I got the go ahead on the next phase of a client’s project. Another client said I could begin working on his project because he is certain the end client will give the go ahead on Monday. And a maintenance client needed me for half a day because their network went down; they also need me to upgrade their accounting software this weekend. Sounds equitable right? Maybe in a perfect world but if you read it again you’ll see that almost none of that pays until down the road (if at all).

I suppose I could have ignored everything except the sample project on the premise that I will nail this job. That would have shown a huge lack of ethics toward my existing clients plus I have assured them that if I step out of consulting or take a long term committed project that I will give them sufficient notice and make sure their work is uninterrupted. This potential job is with a company that I admire. And, if this sample project is indicative of how they organize their actual projects, working with them will be an absolute pleasure. However, I must manage my risk and assume that the job will not come through. I know the interviewer is a big blog reader so I am certain this post will appear in their feed reader. Hopefully it is not read negatively.

Posted on 1 Comment

What is programming?

In essense, a client presents a challenge and I solve the problem.

Today’s challenge: a custom ordering system (shopping cart) written in ColdFusion is producing the wrong totals.
The system design: tax is built into the price of the items stored in the database except for certain non-taxable items. A flag indicates if an item has tax built into the price or not. At the bottom of the invoice, the amount of tax charged is shown.
The problem: The system allows for the administrator to apply a discount. Tax cannot be discounted but the total tax shown on the invoice is calculated off the discounted price.

How do you solve this kind of problem? I use my tools available to me. I could just jump into the code and start changing it but I can do a better job and document my efforts by using MS Excel and MS Word to help solve the problem.

  1. I pull up the sample invoice that the client used to show the incorrect figures.
  2. I reproduce the invoice in Excel.
  3. I open the database (in this case with MS Access) and find the products listed on the invoice so that I can be certain which items are taxed and which are not.
  4. I manipulate the spreadsheet to assure that I am using the correct math formulas to get the correct result.
  5. Find the code within the system that calculates the tax and change it to use the new formula for presentation.

Update: I think perhaps the end of this post was lost…

Posted on 1 Comment

Error converting tiff to pdf

So I am trying to deploy the website I recently completed. Deploy? That means move the site from a development server to a production server where the world can see the application in action. It took this long to deploy because the webhost was running PHP 4.0.0 and had to upgrade to at least PHP 4.4.4 (went to 5.1.6 which is nice). However, they did not take the extra 10 minutes it would have taken to include CURL support.

So, the dev works great using CURL to pull a series of tiffs from another server, then using the Zend Framework, combine those tiffs into a single tiff, and finally convert the tiff to a pdf. I moved the code to the production server and it works fine until we get to converting the tiff to a pdf. It actually converts but the pdf is unviewable simply producing the error "file does not begin with ‘%PDF-‘." These kinds of problems are why developers never make their deadlines. I am working on the presumption that I failed to write some header information into the file. I want this over.

Posted on Leave a comment

Principle 30 – Follow The Lemmings With Care

Excerpt from Alan M. Davis’ excellent book "201 Principles of Software Development" which ever programmer, QA person, consultant, project manager, analyst…shoot, anyone involved in software should own this book and review it regularly.

If 50 million people say a foolish thing, it is still a foolish thing. -Anatole France

Just because everybody is doing something does not make it right for you. It may be right, but you need to carefully assess its applicability to your environment (Principles 142, 143, 149, 150, and 151), software reuse (Principle 84), process maturity (Principle 163), computer-aided software engineering (CASE, Principles 22 through 25), and prototyping (Principles 11, 12, 13, and 42). In all cases, these offer very positive opportunities for increased quality, decreased cost, or increased user satisfaction. However, the advantages are available only to those organizations in which it makes sense. Although the rewards are significant, their potentials are often oversold and are by no means guaranteed or universal.

When you learn about a "new" technology, don’t readily accept the inevitable hype associated with it (Principle 129). Read carefully. Be realistic with respect to payoffs and risks. Run experiments before making major commitments. But by no means can you afford to ignore "new" technologies (see related Principle 31).

Ref: Davis, A., "Software Lemmingineering," IEEE Software, 10, 6 (September 1993), pp. 79-81, 84.

The index points object oriented programming to Principle 30 calling OO a "fad" (see Priniciple 31) since object oriented programming is really one implementation of the principle of encapsulation (Principle 65). This is by no means to berate object oriented program, which I enjoy very much, but simply to point out that OO is not always the best solution to a particular problem.

Posted on Leave a comment

Interpretting ColdFusion Error Messages

Everyone knows what Apple’s "Type 1" error message means. Well, you should. It means "something went wrong and we have no clue why!" Everything computer related has something like this. Even AdoMacrollaire’s ColdFusion has some strange ones.

Invalid token ‘\n’ found on line 40 at column 0.

This error message means you forgot to close a comment somewhere. ColdFusion comments are delineated the same as HTML comments (<!– html comment here –>) but with an extra dash (<!— cfml comment here —>). So if you open a comment and forget to close it perhaps even following it with another comment you will get the reference to a linefeed (\n) being an invalid token.

<!--- this is the messed up comment
<!--- and this is a valid comment --->

Posted on 1 Comment

Oh yes! Program done!

I now have successfully written a PHP program that goes to another website, downloads any number of tif files (one test used 48), combines them into a single tif file, converts the tiff to a single pdf file (48 tiffs become a 48 page pdf), and presents the new single pdf and single tif to the enduser for downloading or viewing. This was a nightmare and has cost me dearly. It is done and I can move on.