Rick Kamenos writes for us today about how he took an enterprise app written in Visual Studio with C++ and rewrote it using our favorite IDE software RAD Studio with Delphi and went from an app which took hours to only a few minutes. It’s quite a compelling endorsement of Delphi considering C++ is often touted as the fastest programming language around!
Table of Contents
What was the enterprise problem you were faced with?
An enterprise level organization had multiple systems being built using Visual Studio with C++. These systems were used for important reporting to government agencies, but they kept failing. The company needed solutions that worked and they needed them quickly.
The first of the problems was a data importing system that read information from a CD, then cleaned and transformed the data before importing it into a database warehouse. This process was taking hours and would usually fail before finishing.
Were there other issues?
The second problem, government reports that were also taking hours and sometimes would not finish. These reports relied on data from the first problem and additional data being generated inside the organization.
How did you go about fixing the problem?
The first thing to fix, of course, was the data importing. The second problem relied on this data to ensure reports were up-to-date and having good data was a must. I looked over the C++ code and found it to be mediocre level programming. Not only that, but I was seeing some code that was supported by components on the Delphi palette. This told me it was probably best just to re-write everything in Delphi. One of Delphi’s greatest strength’s is supporting RAD development by using a strongly typed language and components that make enterprise systems development quick and easy.
How was the data stored?
The database records were stored on the CD in simple comma-delimited format, but in varying length fields. So, I requested the data fields be changed to fixed length. This meant I could read in one whole record as a chunk and instantly type cast it, so to speak, to the fields it contained.
After that, it was simply a matter of applying some data anomaly tests and string transformation rules to get the data ready to pump into the data warehouse. Using the Delphi database components, I then just imported each “washed” record into the database using only a few lines of code. Another wonderful advantage brought to enterprise development by Delphi – excellent database components that work fast and are easy to link up, for even the most complex applications.
A quick test and we went from hours, to minutes, for importing. A few components and not much code but we were light years ahead of what this company had in place prior to using Delphi. Which is good, because they were having many problems that were frustrating management.
The second thing to fix was the reports. There were various reports being generated. All going to government agencies for review. The data in those reports had to be put into an Excel file format. Those spreadsheets would then be used to perform calculations on the data and those results were reviewed and the files then archived.
So, you swapped from Visual Studio and C++ to Delphi – how else did that help?
Delphi to the rescue! There were components available with Delphi that would open, read and write to the excel file format. The solution, then, was merely a small application that connected to the data warehouse using the available database components. A query opened to retrieve the data and using the excel components, write that data to the excel file. Placing it in the proper spreadsheet cells, to allow the spreadsheet to provide the proper results.
All’s well that ends well and with Delphi, that’s usually the case. Another thing to mention, is that I went ahead and created a menu extension coupled with a server extension that allowed management to review the reports and if all was working correctly, send them to the proper agency by simply right clicking the spreadsheet file and then clicking the “Remit To” menu option. Then a list of agencies would appear and by selecting the proper agency the file would be FTP’ed over by the server.
Another complex problem solved, using Delphi to create a simple solution. One that worked great and was easy to complete.
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
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition