How Delphi saved the day

A few days ago I woke up a little grumpy. I may had not had a good night’s sleep. Who knows? I got my coffee and sat on my favourite chair in the living room. The weather had started improving. After a four day storm that devastated a large part of Greece, that was a welcome change.

As I was drinking my coffee I remembered my first job back in 1998 in Thessaloniki. I was a programmer at my first company. I was staying late at the company’s offices. That was two weeks before the International Fair of Thessaloniki. A well known fair that’s been around in one way or another for 96 years!

My job was to create a library (a DLL for Windows) with an API that would control a receipt printer. Each cashier workstation would use the printer to print receipts for the attendees. After the receipt, there was another printer that would issue the turnstile ticket. A card-like ticket with a magnetic stripe. Attendees would then take both the receipt and the ticket, and go through the turnstiles.

Delphi

Coming out of my B.Sc. in Computer Science, I had used Delphi to create a translator from Z to SML for my thesis. It took Z as input and transformed it to SML. Z was a formal methods language and SML a functional programming language.

I liked Delphi. It was the descendant of Turbo Pascal which was an incredible text based IDE for MS-DOS. I also loved Pascal in general. Most of my friends were following the C/C++ and even Java paths, whereas I loved the verboseness of Pascal. I always loved languages that were a lot closer to English. Hence my love for Ruby and Elixir nowadays.

Loving Delphi, I was looking for a way to introduce its usage to the company. When they asked me to create a way for third-party software to control the printer, I knew I needed a DLL. The company’s main tool was PowerBuilder. PowerBuilder was an enterprise development tool. It allowed you to build many types of applications and components. But it couldn’t build a DLL. At least not in the form I needed it to be. I discovered Delphi was able to do that in a perfect way. Without thinking it twice, I explained the situation to my supervisor. Given the pressure to deliver, my supervisor approved the usage of Delphi.

Printing Greek

One problem solved. I started using my beloved Delphi for real work. I was the happiest person. The problem though was that they had assigned the project at the last minute. We only had two weeks to put everything together. The fair had a start date carved in stone.

The project was an integration one. We were the folks that would have to make every small or large piece work together. We were the integrators. We had to glue the receipt printer, the turnstiles, the software for the cashiers, and more. All pieces were coming from different companies and suppliers. And we only had two weeks to make everything work!

Another problem was that I had to make the printer print receipts in Greek. I only had a very basic low level manual. The manual didn’t have any instructions for printing Greek. I had to find where the Greek alphabet was in memory. The only way was trial and error. That took me such a long time, because the only way to test something was to actually print real receipts. The printer was very slow, and that added to the whole difficult situation.

Burning the midnight oil

The only way I knew to overcome the problems given the tight deadline, was to stay in the office 24/7. I explained to my girlfriend—now my wife—that I had to disappear for a couple of weeks. The funny thing was that I was the only person involved in the project from that office (we had more offices). The deadline neared. At night, the office became an echoing chamber of silence. I was feeling isolated and abandoned amidst the ticking clock. But I was full of determination and blissfully ignorant at the same time. A combination not recommended, but useful in situations like that.

The only thing that was breaking the silence was the dot matrix receipt printer. Printing over and over again, only to output garbage instead of Greek. The pressure was accumulating. Every morning my supervisor would see me struggling, and would bring me new rolls of paper. Not for me. For the printer.

And then it happened! I was able to print my first Greek character! Started going backwards until I found the position of “A”—greek alpha. I was ecstatic! I couldn’t wait to share that with my supervisor next morning.

French shenanigans

Only days away from the fair opening, I still had to work with a French programmer that didn’t speak English. He had to use my DLL from his French software. I had to explain the API and how the whole thing worked. Pierre—let’s call him that cause I don’t remember his real name—was quite a character. Unfazed from everything that was going on, he was reassuring us everything would be fine. As a newbie I wondered. Was that years of experience at play? Or was I witnessing what happens when you’ve long exhausted the number of fucks you can give?

Pierre was writing code in front of me. He was trying to get the DLL working. His French software was the cashier’s UI for issuing the tickets. What was hilarious to me back in the day was that he was using a programming language that was in… French!

That was incredible! Not only everything was proprietary. Even the code was in a language spoken by 300 million people worldwide. In contrast, there are 1.3 billion people speaking English.

As the deadline was approaching, everything started fading away. We relied on Pierre to complete the integration. To the day, Pierre is still the coolest person under pressure I have ever met in my job.

When you never test software in production because you can’t

The whole project was the kind of project you cannot test under real conditions. The ultimate test was going to be at the fair opening. The company asked us to be at designated posts at the opening. We were standing behind the cashiers. Every entrance had many cashier workstations, each with the same setup. A PC running Windows using the French software. A receipt printer and a ticket printer.

I had developed another Delphi application that was using my DLL to admin the printers. The application was in a 3.5 inch diskette we passed around to some colleagues. They would run the application on every cashier PC and update each printer’s template. Every change like that, would need a new application build.

The countdown for the opening started. People started flooding in. We immediately noticed the first problem.

The receipt printer was slow as fuck

When I was testing the printer, I had noticed the slowness. But I had never put two and two together. I never thought that people multiplied by the time needed to print a single receipt, wouldn’t cut it. I would find out the hard way. The cashiers started complaining about the angry crowd. People started spilling out of the entrance lobby. Some started yelling, and we were sweating, unable to do anything about it.

Back to the drawing board

As you can imagine, I didn’t go home that day. I went back to the office and started working on reducing the time needed to print a receipt. I could not control the actual speed of the printer. The only thing I could change was the number of characters we were printing. I asked around and learned what was the shortest text we could print for the receipt to remain tax legal. I was happy to learn we had been printing more than that.

Although the seconds shaved off were not a spectacular number, it was significant at that scale.

I used my admin application to update all printers, one by one. Next day, things got a bit better, but now we had a new problem to solve.

The paper rolls were short

We had already seen that happening during the first day. The paper rolls were short, and the cashiers had to replace them rather often. Replacing a paper roll was not rocket science, but it took time. Some of the cashiers had not done it before and they had to learn how to do it quickly. Some cashiers never learned how to do it. The solution was to address the issue with human intervention.

I was standing behind the row of cashiers. When the paper was out, I was replacing it for them. That became my job. I was there, in my shiny suit, waiting for paper to go out. I learned how to do it in a flash. I became the cashiers’ favourite person.

During peak hours, I was replacing paper rolls under the angry eyes of the crowd. But, by the end, everything worked out despite the problems.

And that is how I introduced Delphi to the company. I would stay for many more years, and use Delphi for all shorts of integration and other type of projects. Thank you Borland. Thank you Anders.

Learnings, thoughts, and notes

  1. Delphi was super cool.
  2. There is always a solution, even if not optimal.
  3. Unless people are dying, it is not the end of the world.
  4. Pierre was the epitome of coolness under pressure.
  5. Not sleeping much is not wise, but it’s sometimes necessary.
  6. Outputting Greek had always been an issue before Unicode.
  7. Always test performance against the anticipated traffic.
  8. Sometimes you need to throw in manual labour to keep afloat.
  9. The cashiers loved me by the end of the fair.
  10. The whole experience was a chance to prove my determination.
  11. Blissful ignorance helps.
  12. French programming languages rock!
  13. Back in the day, they assigned most projects one or two weeks before the deadline.
  14. Persisting is often the differentiator.
  15. Now that I think back at all this, failure to make everything work would have been disastrous.
  16. Did I mention Delphi rocked?

Here’s what I am doing

At Workbrew, I help our customers succeed, while working on docs, fixing bugs, and developing internal tools. At Amignosis, I pour my heart and skill into crafting slowly brewed software, one thoughtful line at a time. I am craftsman in a world of complexity and low-quality solutions. I am a shoemaker. I take the time to create simple, timeless software built to last. Check what I am doing now and talk to me.

Join 74 other subscribers

Responses

  1. Veselin Avatar

    I started with Basic for 8-bit computers. Remove points 3-18 and it’s basically the same.

    1. Petros Avatar

      I started with Basic on the Amstrad CPC 6128. 😀

      1. Veselin Avatar

        Pravetz 82 and IMKO-2 here, although not sure which one came first. The IMKO worked with a TV.

  2. Stergios Avatar

    So many memories!!!

    1. Petros Avatar

      So many memories indeed!

  3. napolskih Avatar

    Thanks for the post )

    I have the same. Pascal, Delphi, love. And then Ruby and now Elixir. It’s been 20 years of these things. Delphi is love forever.

    Greetings from great Russia!

Leave a Reply

Discover more from Petros Amoiridis

Subscribe now to keep reading and get access to the full archive.

Continue reading