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

Upgrading and Maintaining Delphi Legacy Projects

Upgrading and Maintaining Delphi Legacy Projects

Legacy projects represent code that continues to provide value long after being written. You want to maintain these legacy projects, adding new features as needed, and be sure they continue to work on new platforms now and in the future.

That’s where this webinar comes in. Evaluate the risks of redesigning vs. rewriting your legacy project. Learn the best approaches to refactoring while minimizing the risk of rework by making your code testable and adding test coverage.

Join Jim McKeeth as he interviews Bill Meyer, author of Delphi Legacy Projects: Strategies and Survival Guide for this webinar all breathing new life into your living legacy.

Question Asked
By
Answer Given
Hi, I have Delphi 12.2, Arm Win 11 and 4k monitor. When old VCL project is open, the form is extremely small. How can I change the size of the form designer?
P.R.
Take a look at the High DPI settings: Tools, Options, IDE, Form Designer, High DPI
We still have bdsproj file from legacy versions – is this safe to remove now in Dephi 10.4 and later?
R.T.
bdsproj is from 2006 and newer. You don’t need those in 10.4
We often struggle with deciding whether or not to even attempt to migrate our old projects to newer versions. Do you have any advice on the tradeoffs to be made when deciding whether to continue to maintain an older app or go through the pain of upgrading?
J.Z.
You can do a cost benefit analysis, but generally if you have an existing application that works of any complexity then you are generally better off refactoring.
My real legacy project is under TopSpeed Modula/2 and DOS
D.M.
Wow
This is fascinating. I’ve made something of a career out of being what I call a “”forensic developer””. I can come into a legacy code base, often minimally documented and poorly coded, with the original devs long gone and rapidly find my way around and start making fixes and improvements. 
S.P.
That sounds like a useful skill.
Our Legacy projects are Delphi 7 and they have been migrated to Delphi 10.4, the biggest job was convert all the ansistring to unicode, is there any tool that helps to indentify some posible bugs about this?
O.H.
ReFind and DelphiParser are two utilites that help with that. There are others too.
Currently working between Delphi 7 and Delphi 11.2 and slowly migrating each of 120 applications/libraries. 3rd party components being the main issue
M.S.
Yeah. Usually most of them can be moved forward, but I’ve had to replace them in projects too. That isn’t as easy, but isn’t terribly difficult
Are there any nice tools to identify UDCs within your project?
R.T.
MMX
I also recommend “”Clean Code”” by Robert (Dr. Bob) Martin….
S.P.
Yes, agreed!
I find little of this is really difficult per se, just tedious.
S.P.
true. A good strategy is helpful, but you just need to decide to spend the time doing it.
There is a book by one of the GoF, John Vlissides: Pattern Hatching:Design Patterns A pplied
K.H.
nice
Sometimes Embarcadero transform active projects into legacy one with braking exsisted code. Example – recent drop of OldCreateOrder property in TForm and TDataModule. This decision effectively transition our company’s Delphi developers group into legacy group, any new development will not be in Delphi – management do not want to have the same problem somewhere in the future.
P.K.
I’m sorry you had some challenges with changes in the properties. Delphi is way better at maintaining backwards compatibility than most other languages or tools I’ve used. Sometimes there is breaking changes. If your management is making a decision like that they are grossly uninformed.
Sometimes hard to get the mandate from the employer to devote the time and resources to code improvement on these projects. Often they’re on life support pending a new project to replace them :-/
S.P.
An acurate cost analysis should show that upgrading is way cheaper than replacing. Rewriting projects is almost always way more expensive than expected.
I agree, main issue on migrating old applications is the components that it use, like LMD, came as special edition with Delphi until 2010, then it was dropped, now you either have to buy it or replace it. Same with Quick Report, came with Delphi for years, now you have to buy it, and worse, Quick Report is sort off dead now, not much development in the last 5 years, so now you have to replace this also. Really time consuming and Exec do not really want to fall for this. Not an easy thing to do, but we know it must be done.
D.D.
If you contact Quick Report they are still updating it but haven’t updated their website. IF you have the source code for 3rd party component libraries then you can bring them forward with effort.
I usually resort to Notepad++ for Search/Replace in files.
S.P.
It is a nice editor. I used UltraEdit a lot of that sort of thing too.
We had to remove GExperts as we believe it was causing the IDE to crash in Delphi 10.4. Not sure if anyone else experienced this?
R.T.
I’ve not heard any issues. There may be an update that fixes the issue.
Indeed. But hope springs eternal among management, and the new shiny thing frequently seems to win out.
S.P.
Explain it to them in $$$ and time. That is the one language that always gets management attention.
Do all these utilities play nicely with each other?
K.H.
They will work together, but you will want to turn off the features you don’t use, and customize things.
UltraEdit is great, but a little pricey.
S.P.
It isn’t free, but I don’t think it is terribly pricey. I suppose it depends on what features and value you get from it.
the gexperts page is blocked by Malwarebytes Browser Guard :/
P.W.
99% of the time that is a false positive. It is always good to be cautious though.
I some cases – braking existed code – breaks the trust to the product
P.K.
Welcome to the world of software development. I’ve used a lot of different langauges and tools. None of them are perfect, but I honestly really find Delphi to be the best in that area.
First thing I do in new installs of CnPack and GExperts is turn off the features I don’t use.
S.P.
exactly.
GExperts has the best shortcut to Find Next or Find Previous (alt+down and alt+up) I’ve ever seen.
K.H.
I’m a big fan
..something I often find happening when trying to access 3rd party Delphi pages.
P.W.
 
GExperts allows us to choose their shortcuts
K.H.
yes
I have to drop off, thanks for some great insights…
S.P.
There will be a replay, of you can get the book.
About 15 years ago I redeveloped a standalone Windows executable Delphi 5 project to ASP.NET, and found business logic pretty easy to translate from Delphi to C# (thanks Anders H.!). Do you have any rules-of-thumb that tell you it is better to re-write in another platform than stick with Delphi? I have another open-source tool I wrote in Delphi 5 that people still use, debating whether to try to move that to Delphi Community Edition or re-develop with another platform (or leave it be in Delphi 5)
W.R.
 
I’m used to using the Delphi 10.2 formatter to format code written in Delphi 7. Would this be considered a good practice in a legacy project?
H.S.
I think that is a really good idea. I know Nick Hodges suggests it too. Having a consisten code format is really useful.
Massive rewrites always run on Daylight Losing Time
K.H.
yes
Sadly, the developer of the Quick Report, passed away a year ago, because of the Corona virus
O.A.
yes. They have a new developer working on it now. I’ve exchanged emails with them.
I believe the main developer for Quick Reports has actually died which is why they are struggling to get releases out and why not much has been done….
A.D.
Yes, it is very sad. They do have a new developer working on it now.
That’s good to know
A.D.
 
It’s the blessing and curse of components. You receive an upfront cost savings using a component vs writing it yourself but you are now in bed with them long term…
W.B.
True. When you buy the new versions you also get the benefits of the bug fixes and new features. Effectively you are outsourcing the development and maintnance of those components.
Measure twice, cut once. carpenter’s proverb
K.H.
Yes
Is it possible that there are too many problems to refactor? I have a 25-year-old project that has entanglement of UI, data and logic. Use of dead components and unused features. My gut says rewrite. How do you decide?
D.F.
It is possible. It depends on the size and investment. The reality is that the original time investment will need to be re-invested to fix new bugs.
Sometimes the code is just so bad that is requires so much rewriting of parts of the code that you may as well rewrite … I am speaking from experience of a project we had for a client who let the accountant write the existing system and 18 months later we were still attempting to fix the mess…. I ended up quitting because I was sick of the grief and the client moaning that it seemed to be a never ending job….. So sometimes trying work with existing code is worse than a rewrite
A.D.
If it program is functional, then even if it takes a long time to refactor then you can continue to ship updates and fixes while you refactor. While a rewrite means you either start over with nothing or maintain two codebases for an extended period of time.
From South Africa, have to leave now shortly due to load shedding, where the towns electricity supply is cut for a certain amount of hours, because the state own electricity supplier ESCOM, cannot service the required load, now they have to drop load across the country.
D.D.
Ah, sorry about that. We will have a replay.
25 years old, 17 developers of varying skill level. Two remaining developers with one a couple years from retirement. About 700,00 lines of code
D.F.
Refactor. That is a huge investment you don’t want to throw away and recreate.
we do our best to use no components at the time of turbodelphi. Too much complicated when components are not working, so no more JVCL no more ASyncPro,… we rewrite the section we need.
S.B.
Using a 3rd party component has pros and cons. You shouldn’t use excessive components in your application, but there is a lot of value in using the few important ones.
So true, Exec do not look at software like this, even if software is running now for, in my case 22 years, and running production, making money, they still do not want to spend money to do full migration.
D.D.
I feel you. That is the advantage of iterative refactoring.
As a Delphi modernization expert, the most important issue of a running a successful migration project, is finding the right developer to do it
O.A.
very true.
thanks, have to leave – with a fair amount of experience two other types of problems have faced me, a lot of custom made routines written to handle tasks that are included in later versions (never sure when to replace), and worse, programmers trying to be ‘clever’ saving a few lines of code but making reading / understanding it almost impossible… but again, thanks.
C.R.
Refectoring allows you to take an incremental approach. Those bits of “”clever code”” can live on for a while until you get a chance to refactor or rewite those small parts.
[ok, I hear you are addressing it now 🙂 ]
C.R.
 
That was all very helpful!!!
D.F.
glad
Could it be advantageous (in some cases) not to start refactoring/rewriting on the new Delphi version (the project would not run there), but to “prepare” the code for migration on the older Delphi version?
H.W.
Yes, that is a good strategy too. An increnental approach.
Need I say “comment, comment, comment”
N.B.
:-0
I like the TryStrToInt because I can use the Boolean return value to branch.
K.H.
yes
We’ve had the “not” keyword context backfire no us before. Can’t remember exact context, but without bracketing properly we’ve found that condition = false yields more accurate results
R.T.
Yeah, be careful.
I remember using TryStrToInt at least twenty years ago.
K.H.
I love it.
The best component of all time? Virtual Tree View
N.B.
🙂 I’m a big fan
need to drop. Thank you for the info and Question. Very helpful
m.k.
welcome
Any insights for converting pre-unicode code (Delphi 5) to current versions using unicode variables?
S.M.
There is some information in the book, and a lot of documentation and resources here https://www.embarcadero.com/rad-in-action/migration-upgrade-center
Internally developed components are a pain to maintain especially within a team. It’s easier just to pull updates from a repo than have the team continually reinstall component updates
C.M.
Yes! You will have some internal components, but it is important to have a good strategy and balance between internal and 3rd party.
Free 3rd party componentslibraries or open-source code cost a lot years later in maintenance – unlike commercial ones
O.A.
Sometimes. There are ones that are maintained though. I do recommend sponsoring open source projects that you use.
Nothing more distracting than compiling a legacy project with umpteen hints and warnings. I always try to make them go away asap, for my future self mostly
W.B.
YES! Me too. When I come in to help someone with a project that is one of the first things I suggest.
Thanks very much, loved this webinar!!
W.R.
Awesome!
Is there a tool to migrate code that uses Borland Database Engine (BDE) to something more modern?
D.L.
ReFind (part of Delphi) and DelphiParser (3rd party) are two tools that help with that. I’m sure there are others. There are resources here too https://www.embarcadero.com/rad-in-action/migration-upgrade-center
I sometimes order the implementation code blocks by function and the declarations in alphabetic order
K.H.
Nice
Does your book discuss threaded apps?
N.B.
No, but Dalija covers it really well https://dalija.prasnikar.info/
I order my funcs and procs in functional and alpha order inside my class declaration and then stick a comment as a divider over each “function”. By doing this it means I can find an function quickly and easily
A.D.
Yes, whatever you like is good. Consistancy is key.
How do you address the Delphi developers shortage. The fact that even the best Delphi developers are getting old, and there are no new Delphi developers?
O.A.
There are new Delphi developers. It is just a matter of hiring a developer and bringing them up to speed with Delphi.
Parallel Programming with OmniThreadLibrary That’s Promozh’s book and framework
T.E.
yes!
Thank you! Great Webinar
R.T.
 
I just bought the PDF. 🙂
T.P.
 

What's Coming in Delphi, C++Builder, and RAD Studio 11.2 Alexandria

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

Chief Developer Advocate for Embarcadero Technologies.

Leave a Reply

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

IN THE ARTICLES