Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
Case StudyDelphiDeveloper InterviewsRAD StudioShowcase

World’s Best Fruit Fly Research Engine Is Built With Delphi

smartmockups ldeokn81

They may be tiny, but fruit flies are actually hugely popular to researchers trying to unfurl the secrets of life itself. In this Enterprise Article entry Delphi developer David Schwartz discusses why he believes Delphi is very definitely the best choice of low code application platform and how he has leveraged his Delphi programming skills to branch out and create extremely powerful web apps including one he describes as “The Google™ of Fruit Fly Research“.

What is your software development background?

I received my BS in Math / Computer Science from Arizona State University in June 1979 and have worked as a software developer for virtually my entire career. In the mid-1980’s, this newfangled programming stuff came out called ‘Object-Oriented Programming’ (OOP) and it was being supported in a new language based on ‘C’ called C++. Being curious, I set about learning it, and got to be quite proficient with both OOP and C++. In fact, I taught a number of classes around the country.

Throughout the 1990’s I had my own consulting firm. I mainly worked with people who had a dream about building something that relied on software, and who hired me to get that idea out of their head and give it a life in the “real world”. It was a lot of fun. Most of the work I did was what’s called “embedded systems”, like the computers that make your car, TV, and microwave oven work.

During this time, Microsoft had introduced this fancy “graphical user interface” (GUI) platform they called Windows, and programming it was horribly complicated and convoluted. I saw lots of my peers go bankrupt due to what I saw was the need to invest excessive amounts of time and money into Microsoft’s tools with minimal returns. Maybe that worked for big companies, but not solopreneurs. So I avoided Windows programming like the plague.

How did you come to choose RAD Studio with Delphi for application development?

World's Best Fruit Fly Research Engine Is Built With Delphi - a headshot of David Schwartz

In February of 1995, I attended an event called the Software Developer’s Conference in Monterrey, California. That week, on February 14th, Valentine’s Day, Borland International introduced a brand-new way of writing software apps for Windows that they called Delphi. I was in the audience that day, and was totally blown away by it. Four things stood out to me:

  1. How Delphi completely hid this thing called the “Windows event loop”. THAT alone was one of the worst parts of writing any code for Windows. It was a nightmare, and universally despised by developers. Delphi magically made it totally disappear! Whoa!
  2. How simple and easy Delphi’s GUI-based form designer made creating graphical forms that looked almost exactly the same in the designer as they did when they ran. This was called a “What You See Is What You Get” (WYSIWYG) design approach. There were tools that came close, but not for Windows, and none that were affordable unless you were a big company with a lot of money to spend.
  3. The things that made this WYSIWYG magic happen was a collection of “components” that you could select from a component palette and drop on the form. You could then tweak settings in this new “Property Inspector” thingy and literally build a useful (albeit simple) Windows program without having to write one single line of code.
  4. Perhaps the most wonderful thing about it was that these “components” could themselves be written right inside of Delphi itself. You didn’t need to create them in a totally different language and environment, like what VB and other roughly similar platforms required you to do. Delphi could be used to extend itself.

The cherry on top was … they gave all attendees a free copy to take home and play with! It’s fair to say this event changed the course of my professional career, because within a couple of years, virtually all of my work came from Delphi programming. Delphi became the core of my professional activities ever since.

While these features were quite amazing to see in 1995, they’ve been pretty much expected on every programming platform created since then. It’s probably fair to say that Microsoft was so awestruck that they hired the author of Turbo Pascal and chief architect of Delphi, Anders Hejlsberg, to head up all of their subsequent work. He helped them design a new language (C#) and development platform (Visual Studio). Today, Delphi and Visual Studio are still very similar IDEs; if you’re adept in one, you’ll have no problem with the other.

What sort of development have you been doing recently?

I’ve worked on a wide variety of Delphi-based projects since then. Most of my work has been maintaining large enterprise applications written using Delphi. Even today, in 2023, there are tons of legacy applications making lots of companies millions if not billions of dollars in profits. One might ask, “Why?”

In my opinion, there are two reasons for this: (1) they’re mostly rock-solid applications and require very little maintenance; and (2) I can’t explain this any other way except to suggest they’re too expensive to replace. I’ve been hired to help maintain some really big Delphi-based apps while the original developers were given the opportunity to build its follow-on product in some other platform. Regardless of who was building them, I have personally never seen a single one of those projects reach completion. They all blew way past their budgets and schedules while I was there, and I lost track of them after I’d left.

I’ve often scratched my head in wonderment about why Delphi has gotten such little respect by corporate executives who are running a business pulling in 7-, 8-, and 9-figure profits from Delphi-based applications running their business operations, and yet are intent on replacing it with something written in a totally different language and platform that won’t benefit at all from any of the existing (fully debugged and stable) Delphi code. The last couple of places I’ve worked, Management didn’t even want us to touch the code beyond what’s needed to fix bugs.

What makes you keep choosing RAD Studio with Delphi over other development solutions?

I’m guessing the purpose of these stories is to highlight what makes Delphi such a great platform for your NEXT project TODAY. Why SHOULD you consider Delphi instead of something else? Here are my thoughts on five areas where Delphi excels relative to other options.

World's Best Fruit Fly Research Engine Is Built With Delphi - a RAD Studio montage image

My first reason for recommending RAD Studio with Delphi

First, Delphi is based on the Pascal language. Pascal was developed originally as a teaching language for programming students. It’s simple, logical, easy to read and write, and most importantly, it’s easy to learn. Delphi was extended to embrace OOP and they call it Object Pascal. The semantics of this language almost entirely overlap the semantics of C++, with the most notable exception being that Object Pascal does not support multiple inheritance.

Another small but significant difference between C++ and Delphi is that all “objects” (i.e. instances of classes) in Delphi are implicitly passed by reference – meaning you rarely if ever need to resort to using Pointer types for ANYTHING (or explicit casts that break the typing).

Back in the day, the language everybody loved to hate was ‘c’, and then ‘c++’. Why? Well, they’d say “it’s too terse”. That may have been true in the 90’s, but not so much today. I haven’t used C++ in a long time, but I glanced at some code in C++20 recently and was sad to see how much cruft has been added to it. Yes, contemporary C++ now makes Delphi’s Object Pascal look much simpler and less verbose – although I’d hardly call either one “terse”. J

My second reason for recommending RAD Studio with Delphi

Second, one thing that people don’t realize is that Delphi’s Object Pascal is not at all obsolete, as many believe. Delphi supports both procedural and functional programming. In fact, Delphi’s objects are all considered first-class objects for both of these use-cases. First-class objects can:

  • Appear in an expression
  • Be assigned to a variable
  • Be used as an argument
  • Be returned by a function call

While the syntax for writing functional programming expressions in Delphi is a little verbose, you can do everything in Delphi that you can do in any other functional programming language that supports first-class objects. It also supports Generics and has some great generic libraries.

My third reason for recommending RAD Studio with Delphi

Third, one of the things that Borland, and later Embarcadero, have stuck to their guns about over the years is an unwritten requirement to ensure each new version of Delphi maintains backward compatibility with earlier versions of the language. It’s possible to compile old Delphi apps from the very first release and run them with little if any effort.

There have been two noticeable hiccoughs in this effort over time. The biggest hump that typically gets in the way of upgrading older projects resulted from the changeover to Unicode strings that happened in Delphi 2009. Another one involved some under-the-hood changes that enhanced support for run-time type identification and enabled more flexible components and support for generics; it also ended up making it difficult or too costly to upgrade some popular component libraries.

My fourth reason for recommending RAD Studio with Delphi

The Fourth is something most developers are unaware of, which is that Delphi can be used to create native applications for virtually every run-time platform on the market today, including:

  • Windows (32 & 64 bit)
  • MacOS (32 & 64 bit)
  • iOS
  • Android
  • Linux
  • And, yes, even web apps that run inside of most browsers!

That means you can use one language and dev platform for ALL of your development needs. TODAY! Instead of having to hire multiple developers to work with up to six different sets of development skills and toolsets, all they need to have is one: Delphi.

Do you use any third party components?

While most of this multi-platform support has been evolving steadily within Delphi for nearly a decade now (since Delphi XE2), a third-party vendor, TMS Software, has been working hard on an extension of sorts called WEB Core that lets you write an application within the Delphi IDE, compile it, and then run and even debug it right inside of most contemporary web browsers. This is amazing to see in action! You write your code in Delphi just the same as if you’re writing a Windows app, then it’s transpiled into JavaScript and packaged up in a way that embeds it inside of a simple HTML file. They’ve enhanced their transpiler slightly to allow your Delphi code to deal easily with the asynchronous nature of web apps. It’s sheer genius.

To get started with TMS WEB Core, I used it to write a fairly simple, non-trivial app in about an hour. Months later, I took another hour to add a few more features to it. You can see it here: https://bestkeywordmixer.com .

World's Best Fruit Fly Research Engine Is Built With Delphi - a screen capture of the web application built with Delphi and TMS

TMS has also been evolving a single component library that is fully cross-platform, called the FNC Components Library, that allows you to use the same components on forms that appear the same or very similar on ALL PLATFORMS that Delphi supports, including WEB Core. Historically, you need to use different component libraries for each platform.

Can we see an example of one of your Delphi apps?

Here is a snapshot of a Delphi app I’ve been working recently that accesses a 3rd-party site that has an API to process Text-to-Speech requests. The first thing you do is issue a REST request to load a list of their voices. Here I got all of their English voices and loaded them into a list. You can double-click on them, and it sends a short sentence to the host server with the voice you want to use, and you get back an MP3 file that’s loaded into the audio player and you can hear what it sounds like. The idea is to pick a voice you like. The Audio Player component and Track Bar to its right are both from the FNC Components Library. In fact, the audio player component is implemented with a bunch of JavaScript under the hood, even though this is Win32 app. If I converted it to a WEB Core app, these components would work exactly the same.

World's Best Fruit Fly Research Engine Is Built With Delphi - a screenshot of a text to speech app

My fifth reason for recommending RAD Studio with Delphi is the speed of development

Fifth, and perhaps the most important benefit in my mind, is that I believe Delphi is the fastest and easiest platform for both prototyping and code development you can buy today.

First let me say that besides using Delphi to build apps, I regularly use Delphi to do both wire-frame designs and simple prototypes, as well as proof-of-concept and functional prototypes that end up being far more feature-rich than anybody expected. To be honest, I’ve seen some fairly sophisticated wire-frame modeling tools that cost nearly as much per seat as Delphi costs. And all they can do is build non-functional models. Yet people complain about Delphi’s price. Think of it like you’re getting multiple tools in the same box.

As far as building apps goes, there are several stories I can tell about how Delphi has improved my productivity; most would require me to get into things that I can’t talk about due to Non-Disclosure Agreements with former employers. However, the following one about the birth of FLYBASE is my favorite, and it’s one I can discuss.

Did you know Delphi is the powerhouse behind a global database of fruit fly embryo studies?

I worked for the Bio-Design Institute at ASU from 2000 to 2004 supporting an application called MEGA [4] developed by Dr. Sudhir Kumar [3], a Professor of Genetics and Genomics there at the time. I worked in his lab among a bunch of grad students who were working on their PhDs in genetics and comparative genomics. He used Delphi to create MEGA and invited me to come work with him to help support and extend it.

(Actually, I knew absolutely nothing about this field, and asked him “Why did you hire me to work here?” He replied, “Well, in my experience, it’s a lot easier to teach programmers about genetics than to teach biologists how to program well.” I certainly learned a ton about genetics and genomics while I worked there, and then promptly forgot most of it after I left.)

In the fall of 2002, Dr. Kumar asked me to build some tools to help simplify “a rather complicated task,” and he said he was hiring a team of interns in a couple of weeks who would use these tools. He gave me an outline and a summary of the overall process.

Dr. Kumar had this idea to build a database that stored some data commonly used by genetics and genomics researchers around the world. He was calling it the Drosophila Image Acquisition Utility (see image below) and its goal was to enable researchers to gather up as much genetic research details on the common fruit fly in one place as they could. (Fruit flies have been used by biologists and genetics researchers for decades to help them study evolutionary genetic trends over multiple generations. They are born, live, procreate, and die within about 48 hours, so you can study many generations in a matter of weeks.)

Can you tell us more about the Drosophila Image Acquisition Utility?

I’m not going to go into detail about the actual application, in part because I don’t remember much. Instead, I’ll list the general requirements I was given, and they’ll conjure up a variety of similar options for most readers. It’s helpful to realize that this was a multi-step, boot-strapped effort on Dr. Kumar’s part to get funding to build the overall project. That effort not only succeeded, but its fruits are still alive and in regular use today by researchers world-wide.

The initial steps I was involved with were done using Delphi, and the take-away was how amazingly productive Delphi made me, and how the initial app I created was also far more productive than Dr. Kumar ever expected.

Dr. Kumar’s vision was to build a huge database that could be used by researchers around the world to catalog and cross-reference all kinds of details related to research done on fruit fly embryos as far back and forward in time as is practical. As a researcher without access to this database, finding details relevant to your own research would take a huge amount of time and effort, and wouldn’t result in a very comprehensive set of results. Google™ isn’t very good at this sort of thing. This was to become the “Google™ for fruit fly research”. 😃

World's Best Fruit Fly Research Engine Is Built With Delphi - a screenshot of the fruit fly search engine

What was the design process you used to create this enterprise app?

To get started, Dr. Kumar had identified a list of 10,000 published papers from the prior decade that referred to fruit flies; they contained images of embryos, as well as various identifying features found in those images and associated research. (These images are usually stained and illuminated under different wavelengths of light to bring out different details.)

Here’s the manual process (aka, “requirements spec”) that I was asked to automate:

  • Access a published paper from a URL on the internet (typically a PDF file)
  • Record the paper’s URL, it’s bibliographic info, and how many embryo images are in it
  • For each embryo image in the paper, do the following:
    • Take a screenshot of just the image (using something like SnagIt)
    • Save that image as the “original” image
    • Save whatever info was present that identified that image, so someone who viewed it online could also pull up the paper and know exactly which one it was
    • Scale the image to fit within a fixed size border (eg, 600×400 pixels)
    • Run the image through an external program that rotated and flipped it as needed to make sure it was oriented in one specific way
    • Crop the image in a particular way
    • Perform some image enhancement on it
    • Save this as the “processed” image
    • Run it through an external program that extracted some specific graphical details (ie, “features”) from it and record those features
    • Scan the article for other significant details and record them
    • Save all of these details to a record in a database

When done manually, each step required a different program be used to process that part. Dr. Kumar simply handed me an outline of the tasks (above), stepped me through everything once, and said, “see what you can get done to automate this in Delphi. You have two weeks.”

It sounds challenging – was it?

Personally, I love challenges like this, and I worked like a madman to come up with something that automated everything they needed to do. I built my app so it was structured like a “wizard” where you went from one screen to the next, and each one helped you perform one of the steps. You never had to leave the program. I also structured it in such a way that you could do one or two steps for one paper and then go to the next paper; when you came back to an incomplete paper, it would position you to the next step in the wizard that was needed. You could also set a flag that said, for example, “only give me papers that need Step #3 processed”. That allowed someone to keep doing the same thing repeatedly instead of having to keep switching context. These features worked out quite well by all accounts.

To get started, we seeded the database with the whole list of 10,000 papers and their URLs. You’d click a button to get started, and it would grab a paper from the list on the DB and you’d start working on it. Only one person worked on a given paper at one time.

Initially, it would display the paper in Adobe Acrobat so you could skim it over. Then you’d use the mouse to select an image you found and click a button to capture that image. It would take you through other screens to complete capturing other details for that image.

For example, the next wizard page would normalize the image, flip and rotate it, crop it, then enhance it. Everything it did could be overridden if necessary. You’d then identify features that were called out in the paper related to the study that other researchers might want to search for and save them. Then it would go back and let you deal with another image in the paper. At any time, you could move on to another paper in the list.

For a couple of the external programs that were used, I was able to get the source code and incorporate that code directly into my app (either directly, or as a DLL). The others I simply ran as child tasks that were launched by spawning a DOS Command shell.

What database technology did you use with RAD Studio?

All of the data for each image was saved into a MySQL database as a child record, associated with the paper it was found in as its parent record. The end result allowed researchers to search the entire global catalog of work by specifying specific features of images, researchers, dates, etc., and find all articles that highlighted those particular details. They quickly found it to be extremely useful.

Dr. Kumar never shared with me what factors he used to come up with his estimates; but I seem to recall that he hired six interns to work ½ time for six weeks or so and was counting on me to automate enough of this task that they’d be able to get all 10,000 of those papers catalogued within in that timeframe. Little did he know how much simpler I’d made their work!

Was the project a success?

Long story short, they completed cataloguing all 10,000 of those papers in just two weeks with the benefit of my Delphi app. The third Monday after they started, I was in the lab when they all showed up for work after lunch, and they were just standing around when Dr. Kumar came in. He asked, “Why aren’t you guys working? Come on! Let’s get to work!” They just stood there and one said, “Dr. Kumar, we’re all finished.” They all nodded. He said, “With all 10,000 papers?” They nodded. He said, “Let me see…” and sat down at the computer in his office and started running database queries. Sure enough, their work was completed.

I think the interns were all rather unhappy because they were only going to get paid for two of the six weeks they were hired to work. And I think I caused a problem for Dr. Kumar because, well, I guess funding agencies don’t like it when you significantly overestimate how much you need for research grant funding, and there was just nothing else for them to do. Mea culpa.

The point is, I don’t think Dr. Kumar imagined someone could get so much work done so quickly on a program that was just supposed to be a throw-away tool to help him put together a research grant proposal. I was surprised myself in terms of what I was able to accomplish in two weeks of work. Some of that “success” had to do with my own architectural and programming skills, but most of it I owe to how easy Delphi is to use and how productive it can be.

World's Best Fruit Fly Research Engine Is Built With Delphi - the Delphi logo

So, building your app using RAD Studio with Delphi turned out to be highly productive?

It’s worth noting that this “high-productivity” aspect of Delphi has caused problems for me in other situations as well. I’ve built prototypes for clients that looked and behaved so “real” that the clients thought I was “nearly finished”. What they saw was more like what Hollywood uses for movie sets – nothing existed behind the walls or “under the hood”. If I was trying to fool them, I would have succeeded. But absent that, it makes negotiating for more development time problematic because they think you’re lying. I’ve learned to make my prototypes look far less “real” and even make them return bad results from time to time (“fake bugs”) so it’s obvious that more work is needed.

Have things changed since that time?

Now, you might say, “Well, that was 20 years ago with a much older version of Delphi!” Yes, and it would take me 30%-50% less time to do it today using the newest version of Delphi. Part of that is because computers are a lot faster today, and part is because there are a lot of components and libraries for Delphi that incorporate a TON of logic into things you simply need to drop on a form and set some properties to use.

And today I could even build it so it runs on the web and anybody anywhere in the world could access it immediately with the benefit of TMS WEB Core technology.

All I can say is that the database they seeded with that data was made available for use by some of Dr. Kumar’s research colleagues and they found it quite useful. I think this version evolved a bit and was called FlyBase [5]. He was able to use those results to submit a much larger grant proposal to NIH that produced a much larger database called FlyExpress [6] that uses an Oracle DB instead of MySQL. The FlyBase app I wrote was apparently distributed to researchers more widely and a lot more existing research publications were dumped into it over time. Today both appear to be alive and well, serving the worldwide genomics research community quite effectively.

The MEGA [4] app I worked on is still around and is one of the most widely cited tools used by genetics and genomics researchers in the world. (I don’t know if it’s still written in Delphi or not, but I notice that it is supported on Windows, MacOS and Linux, and has some web components as well.)

Dr. Kumar [3] now heads up his own lab at Temple University in Philadelphia, PA, where he continues to teach and lead research in the field of comparative genomics.

And I am now semi-retired, working on my own web app … using Delphi, WEB Core and other TMS technologies to build something I also expect to become a worldwide success very soon. ☺️

References

  1. Anders Hejlsberg (Delphi’s original architect): https://en.wikipedia.org/wiki/Anders_Hejlsberg
  2. Best Keyword Mixer (example WEB Core app I built in Delphi in less than an hour): https://bestkeywordmixer.com
  3. Dr. Sudhir Kumar: https://kumarlab.net/home
  4. MEGA: https://www.megasoftware.net/
  5. FlyBase: http://flybase.org/
  6. FlyExpress: http://www.flyexpress.net/
  7. TMS Software: https://www.tmssoftware.com/site/default.asp?s=home
  8. TMS WEB Core: https://www.tmssoftware.com/site/tmswebcoreintro.asp
  9. TMS FNC Components Library: https://www.tmssoftware.com/site/fnc-products.asp

This article was submitted as part of our Enterprise Article Showcase. If you have a success story to tell about a project which makes use of RAD Studio with Delphi or C++ Builder, or any of our other great enterprise products please get in touch, you could be featured too and win a prize! Read all about it here: Enterprise Article Showcase


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Ian is the Embarcadero Developer Advocate, a professional writer, presenter, and host. He is a prolific software developer, voice actor, designer and poet. Ian is British American, born in London, now living in Dallas, Texas. "I get up early every day and write code".

3 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES