DeCAL and Delphi 2009 - delphi

Have someone tried out DeCAL in Delphi 2009?
I'm thinking about upgrading from 2007, but my code is quite dependent on DeCAL...

Here is a DeCAL version that works with Delphi 2009.
https://cc.embarcadero.com/Item/26159
There is also a rewrite of DeCAL using generics but that would require you to rewrite your code. https://cc.embarcadero.com/Item/26124

Fun to see that there is still life in DECAL!
I did a lot of prototyping with it in the past, though it turned out to be too slow for the definitive implementation

Related

Migrating from Delphi 2006 to Delphi XE2

There is a code base in delphi 2006 with no development for last many years. If the development needs to be activated what are the options.
Continue developing in 2006. (Not sure of IDE support etc.)
Migrate to Delphi XE2. (Not sure of what it takes)
Recode it in Java.
It seems the second option is more viable but what it would involve to do that? I read some things on Unicode support and also not sure of graphics library support.
Just to put thing in perspective, I am a Java programmer all along with experience on C/C++. However I am trying to understand it more from the perspective of what is the least resistance path to go to market strategy.
Thanks in advance.
I cannot say anything about recoding it in Java. Depending on whatever the code base does, it might be a good option, given that you say you are experienced with Java (and, I assume, not with Delphi).
Regarding Upgrading to Delphi XE2:
Check whether any 3rd party components have been used.
If not, you will probably be able to upgrade to Delphi XE2 with very few changes.
If yes, check whether the source code of these components is already available.
If not, you will have to buy new licenses of these components (and this time take the license that includes the source code!) if you want to upgrade to Delphi XE2. If you are really unlucky, the company who developed these components has gone belly up. Then you are either stuck with Delphi 2006 or you will have to find a replacement for these components.
If you already got the component's source code, you might still want to check whether to upgrade them to Delphi XE2. It might save you some headaches. Upgrading well written components is not a problem for an experienced Delphi developer (I have done so countless times over the years), but might prove nearly impossible for somebody who doesn't know the possible pitfalls.
The only breaking change between Delphi 2006 and XE2 (actually it happened between Delphi 2007 and Delphi 2009) is the switch to Unicode strings. Switching an existing code base might be painless or a real pain in the lower back, depending on how well written it is to begin with and how it (ab)used strings.
Another option you have not yet mentioned, might be upgrading to Delphi 2007, which basically was more of a bugfix to Delphi 2006 than a real release in its own right. If I remember correctly Delphi 2006 packages worked with Delphi 2007 without even recompiling.
A year ago I moved from 2006 to XE (not XE2). This was quite painless. The biggest thing was unicode. But even that was relatively easy (in my specific case probably). Most is handled by Delphi in a correct way. Biggest problems were the import components, especially when character strings were used as byte strings, which in my field (music, midi) is the norm. There is a white paper on strings conversion on Embarcadero.
I only use components with source available. If you don't, you might have have to repurchase the licenses.
It is a long jump taking 2006 to 2011/2012!
But it is possible if you consider that:
You have to convert String variables using the new conversions methods ;
You have to check all the versions between 2006 and xe/xe2 to know how the libraries have changed, bacause some have been spplited, others merged, and a few deleted ;
You have to buy/download the upgrade (if any) of your 3rd party components.
If you do that 3 things, the applications will compile just fine.
It's always easier to upgrade the IDE than rewriting the code, if there's any complexity in code beyond trivial cases like "Hello, World".
Big road blocks in Delphi 2006 might be: old components without source code, unicode issues, possible use of obsolete technologies (BDE mainly), and possible some low level hacking, like using undocumented features.
You get old versions of Delphi free when you buy XE2 licence. However Delphi 2006 is not there. Delphi 2007 is almost same (but better). It may even be possible to use D2006 binary packages with Delphi 2007.
When rewriting, first task for you is to find out what the software actually does. Line by line. Then you need to duplicate that in Java, hopefully in Java style, and then you need to verify against the old software that the functionality is actually there, duplicated.
So, you can choose between complete rewrite or something between recompile and partial rewrite, if there's problem with old components.
Read also this, old but good text: Things You Should Never Do, Part 1
That said, you need business reason for rewrite, and someone willing to pay for it.

Any hints for those that want to upgrade from Delphi 7 (and down) to Delphi 2010?

I am interested to re-evaluate Delphi 2010. The main issue seems to be the ascii to unicode conversion. Any tips or resources about this that you have found useful?
Many thanks.
Edit:
At this point my recommendation for those that want to upgrade would be:
http://www.embarcadero.com/images/dm/technical-papers/delphi-in-a-unicode-world-updated.pdf
Is WideString identical to String in Delphi 2009
What is the compiler version for Delphi 2010?
http://chee-yang.blogspot.com/2008/10/delphi-2009-unicode.html
GIF issues:
Note that Gif (by Melander) and Png (by Martijn Saly?) images are now incorporated in Delphi 2010. You will have to use a conditional in order to use the right GIF unit:
USES Windows, SysUtils, Graphics, blabla
{$IFDEF VER150}
, GIFImage, {Delphi 7}
{$ELSE}
GIFImg {Delphi 2010}
{$ENDIF};
Also you need to "fix" the PNG provided by Embarcadero:
http://talkdelphi.blogspot.com/2009_03_01_archive.html
Other things that you need to know is that you really have to backup your project before opening it in Delphi 2010. Delphi 2010 will change your DFM file even if you don't press the Save button. The form will lose data and it will not compile in D7.
UPDATE Delphi XE
I have finally purchased Delphi XE. Delphi XE proposes some new features but, unfortunately, quite few of them are not working at all (background compilation, UML modeling, code insight, etc). Other features have been downgraded (the help and, for example).
The IDE is also not as stable and fast as Delphi 7 and the toolbar has real problems (better don't customize the IDE). There is also a nasty bug where the IDE has 100% CPU utilization (see my other posts about all these issues).
I hope that in Update 2 and 3 they will fix some of the most stringent issues.
Anyway I think I upgraded too soon because now Embarcadero announced the 64 bit compiler, so probably I will have to pay again a lot of money to upgrade to the next version of Delphi in order to get that compiler. For those that are still thinking to upgrade to Delphi XE I would recommend to trial Delphi XE HEAVILY.
Conclusion:
Delphi XE brings LOTS of new features, but obviously you won't be using ALL of them.
The stability of the IDE is not better.
It helps you build more up to date applications (modern UI open/save dialog, application manifest).
Support for unicode.
UPDATE Delphi XE7
The difference between XE and XE7 was not that huge as the upgrade from Delphi 7 to XE. The IDE is as stable as before (lots of crashes and random access violations in RTL).
UPDATE Delphi Rio
Considering the amount ot years since the last update, I could safely say that the difference between XE7 and Rio is barely visible - except for those that are interested in cross platform apps (Mac, Android but not Linux!).
PROS
True high DPI support (really Embarcadero? After so many years?).
IDE does not crashes so often as it used to crash in XE7.
VCL themes finally (seem to) work.
Most stable IDE until now (still crashes if you open a project group with more than one project in it).
Almost full cross-platform support (you need to purchase the more expensive Architect version to get Linux). Fortunately, for me, this is a bit too late. The projects where I needed cross-platform were already started under Lazarus.
Upgrading the code was super easy.
CONS
Some HIGHLY advertised features like dark themes don't work at all!
The Insight still buggy: new language features (like declaring inline variables) not supported by the IDE (the code will have that wiggled underscore red lines). This issue will probably never be fixed.
Another super annoying IDE issue is that the compiler will still show the last hints/warnings/errors EVEN after you fixed them. Looks like the log data remains in some kind of cache.
Overall it is the most stable IDE until now, but still I wonder (especially if compared to Lazarus) if it worth that pile of money.
Conclusion over the years:
Delphi is such a nice and clean language. And the Delphi compiler speed makes any C++ compiler to look like a toy for kids.
I still feel ashamed people look down on me when I say that I am a Delphi developer. Delphi as a language is extinct now. Just look for Delphi jobs in Germany and only 74 positions are listed (but most of them are mixed with C# and others). C++ has over 1500 positions! Borland and Embarcadero helped a lot to kill Pascal. They do offer a free (even though crippled) version of Delphi now, but the damage was done. It is to late to resurrect Delphi now.
I think three main issues lead to this state:
Borland abandoned Delphi (Delphi lagged behind compared with other languages).
Embarcadero took over but disrespected the customers (over-buggy, over-expensive product).
MAIN ISSUE: The language was not promoted (at all) over the years. No sane company will spend thousands of dollars for a license of an already dying language. And the lack of a free license TOTALLY outcast the new generations of programmers.
Therefore, we are on StackOverflow, wondering each year if worth investing money in a new Delphi license.
Update
Finally, Emba released a free (aka Community) edition and boy you can see the effects.
For the first time in years, I don't feel ashamed to say in public that I am the user of Delphi (a dying language).
We have created a web page specifically for this very issue:
http://www.embarcadero.com/rad-in-action/migration-upgrade-center
There, you can find webpages, documents, webinar replays, etc. which all cover the issue of migration.
The first thing people say is "I have a huge codebase, and migrating to Unicode will take forever" and almost without exception they discover that "forever" really is a much shorter period of time than they originally thought and that the new features of Delphi 2010 make it all worth it.
The biggest problems are with 3rd-party libraries and VCL. If they're not on D2010, it can be painful. The Unicode issue comes up if you are doing calculations with the length of strings or PChar arrays, assuming one byte per character. You can usually get away with treating everything as old-style AnsiString / AnsiChar. But then you don't get the benefits of Unicode. If you don't have anything that would be hard to do in Unicode, just do everything in Unicode and you'll be much further ahead than if you have to worry about switching back and forth.
Converting code to unicode doesn't take that much time in itself as long as you didn't do anything "funny" with your strings. I converted close to 1m lines of code + the database in less than 2 weeks. The guys at codegear did a very good job at doing it a lot simpler.
Your code might recompile in D2010 without any changes (But with quite a few tons of hints/warnings).
The worst problem from the conversion comes from calls to Window's API that were incorrectly done. For exemple, the function GetComputerName that ask you the size of the buffer in TChars(as specified by the API). In Ansi, TChar = 1 byte, so Length = SizeOf. In Unicode, it's not true anymore. Worse, the call to the API might not fail. It will just overwrite some valid part of memory and will crash just much later.
Oh... And there is also those slight differences between Ansi and Unicode in Windows API. For exemple, the lpCommandLine of the CreateProcess is read-only in the Ansi version, but read/write in the unicode version. So using a constant as parameter worked fine in Ansi, but will crash in Kernel32.dll in Unicode.
Overall, it depends a lot on the quality of the code you are working with. Bad code might be very hard to port to D2010. Good code should be pretty easy.
and read the resources that Nick Hodges linked to, they are pretty helpful.
For Unicode conversion issues, your best bet to see the problems people have encountered and what others have done is to get Cary Jenson's White Paper: Delphi Unicode Migration for Mere Mortals.
Also I'd highly recommend Marco Cantu's "Delphi 2009 Handbook" that describes all the changes in the Major 2009 release that includes Unicode and Generics and more. Much of his Unicode material from that book is in his White Paper: Delphi and Unicode.
We have upgraded from Delphi 7 via Delphi 2007, 2009 and now 2010! The following are the biggest issues we have found.
Threads have changed, with Resume and Suspend being deprecated.
Unicode
The structure of projects have changed and are not backwards compatible
The structure of dfms have changed and are not backwards compatible
Hope this helps.
I agree with Chris - the biggest problem in migrating our code to 2010 was getting all of the 3rd party libraries working. A number of them needed minor source edits here and there and had to be installed from the modified source. Still, that said it wasn't more than a day or so of getting things sorted out.
The only other problem we've had moving to 2010 involved one small section of code that went buggy because of a change in the way 2010's ProcessMessages works. It was an old piece of code that probably shouldn't have been written the way it was to begin with (ProcessMessages and Sleep() inside a while loop waiting on an OPC variable change). It worked in 2007 but in 2010 it somehow devoured system messages and locked up the OPC server. For us it was a small fix, but like Ken said it will likely depend on the quality of code you are porting. 2010 seems a bit less tolerant of poor practice and ugly hacks.
View this Embarcadero webinar on how to migrate from older editions of Delphi with some stories of what to look for and how to update your code (including tools and resources to help you along the way), on this link: https://community.embarcadero.com/blogs/entry/migrating-delphi-case-studies

Delphi 2010 or 2007 for upgrading Delphi 3 project?

I've just received an assignment to upgrade an old Delphi 3 project that I wrote in 1999 to a newer version and add features (I previously discussed this in related questions here and here). I was assuming that the appropriate route would be to first upgrade my development environment to Delphi 2010 and then port the application.
I'm now considering whether to upgrade the application to my existing copy of Delphi 2007 instead in order to avoid the Unicode complications. The application runs at a single company in the United States and is tightly bound to requirements of a single state, so it would not benefit from Unicode support.
My question is: would the additional hassle of dealing with Unicode issues outweigh the benefit of using the most recent version of Delphi? You may assume that I have no experience with Unicode.
why "upgrade" to a version that is not the latest, it just guarantees an earlier "next upgrade".
I'm very very happy with Delphi 2010, I recommend porting to that version unless you use a 3rd party lib that is not available for D2010
You should try it (the upgrade) on a D2010 trial, and give yourself a day or so to get a feel for the type of complications that result. Generally, if you didn't use a lot of PChar for pointer arithmetic, and you didn't use sub-ranges of strings, e.g. Code[1] := 'A', and so on, there should be few or no upgrade issues. Aside from the unicode upgrade, the D2010 IDE is much nicer to use, and seems faster than D2007.
D2007 may be easier to upgrade, because you it will not require changes of your code to work probably with Unicode, and if your code doesn't require a lot of PChar and others ANSI dedicated functions, it may work in Delphi2010 without a lot of work.
But if you have time and resources to upgrade to Delphi 2010, it will be better options, because sooner or later version from Delphi 2009 and later will be the standard versions.
Also the IDE productivity is higher in D2010, beside new language additions like generics, anonymous methods and others which make your code better, if you going to rewrite some sections of it.
They have done such a good job implementing Unicode in Delphi 2009 that most programs that do not do tricks with characters and bytes convert over with no problem.
The caveat is as long as you are not using any 3rd party packages. If you are, you should upgrade those. If they don't have upgrades and you don't have their source code, then you might be better off not going to Delphi 2010.
But I would make the jump if at all possible. I did and I'm glad I did.
"That depends"
It depends on the number of 3rd party controls and the current state of those controls. (Are they still on the market with updates for 2007 and 2010?)
It depends on code size and code quality. If you have a large, loosely managed code base it will be a harder path to 2010.
It also depends (largely) on project input/outputs... are you reading from files/databases/communications? How will they react to Unicode, or can you easily narrow down all of those touch points to ensure proper handling?
One other major dependancy is the life of the application... "Going Unicode" now might serve you better if you are going to support this application over the long term as eventually they'll stop selling 2007 and you'll be forced into it.
I own 2009 and have built minor applications/utilities with it, but the main work is still in 2007, 2006, D7, and D5 depending on project.
See here. It can confuse the things when coming to D2010.

"Delphi Fundamentals" in Delphi 2009

Has anybody used/converted "Delphi Fundamentals" in Delphi 2009? - http://fundementals.sourceforge.net/
I'm using Dictionaries (cArrays.pas,cDictionaries.pas,cStrings.pas,cTypes.pas) in my project and now i have some troubles on upgrading code.
I'll be highly obliged if anybody can convert the above mentioned units in Delphi 2009. I'm quite new to Delphi, started working with 2007 and 2009 has been released, I just cannot help myself...
Thank you
I use cUtils, cDateTime and cStrings in a project.
After a 30 minute session of searching and replacing like a madman I got them to compile in Delphi 2009, with just a couple of warnings left to fix.
Char>>>>AnsiChar
String>>>>AnsiString
PChar>>>>PAnsiChar
PString>>>>PAnsiString
It passes all of its selftests, and so far things seem to work fine. I've shared it here: http://www.xs4all.nl/~niff/Fundamentals_UtilsD2009.zip
Update
I've added a ported cDataStructs.pas to the zipfile, which contains the dictionary classes. This one still has a lot of compiler warnings that you might want to fix, but the self-tests pass, so you could try and see if it works for you..
There is no official version of Delphi Fundamentals for D2009 (and I think there never will be any).
I think it would be the best option to rewrite the dictionary code using the Delphi-native TDictionary<TKey,TValue> class inside Generics.Collections.pas, or using the delphilhlplib (Collections/DeHL.Collections.Dictionary.pas).

Delphi code formatter

Are there any utilities that reformat Delphi code ?
EDIT
I am using Delphi 2006
Some feedback
Thanks to all that answered this question
I have been using the JCF code formatter - it works well and my code is been formated to Object Pascal Style Guide
You can try the "Jedi code Format". See more information here: http://jedicodeformat.sourceforge.net/
The formatting engine of DelForExp has been integrated into the code base of GExperts. An experimental version of GExperts including a "Code formatter" here:
http://blog.dummzeuch.de/experimental-gexperts-version/
Separate information/downloads for DelForExp here.
Regards.
I have been for some time releasing experimental GExperts versions that include the code formatter formerly known as DelForEx with some improvements and fixes. The latest release is from 2020-10-23 and supports the following Delphi versions:
Delphi 6 to 7
Delphi 2005 to 2010
Delphi XE
Delphi XE2 to XE8
Delphi 10 to 10.4
Delphi 11 (Danger, Alpha version for now 2021-10-24)
Please note, though, that I am using it only with Delphi 2007, so the other versions may have unknown bugs. Also, not all language improvements of later Delphi versions will work, e.g. nested types, generics and anonymous methods.
see gexperts.dummzeuch.de for details.
btw: Any help improving the formatter, especially adding the new language constructs would be appreciated. The source code can be downloaded from the subversion repository linked from my homepage.
I found this: JEDI Code Format
lextudio - Code Beautifier Collection 6 for CodeGear RAD Studio 2007
http://code.google.com/p/lextudio/
Yes,
I always used TWM's experimental version os GExperts which support this feature.
In Delphi 2006 and 2007 it works perfectly (Don't know about older versions though).
The current version is adding support to Delphi 2009, but I don't know in which stage it is, you can find more about it here:
http://www.dummzeuch.de/delphi/gexperts/english.html
BTW: There is an integrated Source Code Formatter since Delphi 2010.
Free Pascal also has a codeformatter, ptop, but it only implements the more basic dialect (say D4-D6 level).
Lazarus recently changed to use the Jedi codeformatter afaik.
The TWM version of GExperts works well and is nicely integrated into the IDE. It enables you to write and modify your code without worrying too much about exact formatting, then just hit the assigned hot-key and it instantly reformats. I have always found it easy to set up to match the style I prefer, and not as complex as JEDI Code Format, which looked like overkill to me.
The Delphi 2009 version is now available from the link posted above, though based on a beta release of GExperts. It is still much the same formatter underneath, though, and is unaware of the syntax of some of the newer Delphi enhancements.
I just made an online pascal code beautifier based on JCF. You may try it at https://pak.lebah.web.id/jcf
HTH.
There is OPEdit II which is free, and works very well.
It's a full text editor, with code refactoring and code browsing.
There is a text formatter, which uses the internal code parser, therefore handle conditional defines just as a real Delphi compiler.
See http://www.codefactor2.com
There is a program PascalFormat

Resources