I'm a pretty experienced Java programmer that's been doing quite a bit of Win32 stuff in the last couple of years. Mainly I've been using VB6, but I really need to move to something better.
I've spent a month or so playing with Delphi 2009. I like the VCL GUI stuff, Delphi seems more suited to Windows API calls than VB6, I really like the fact that it's much better at OO than VB6, and I like the unit-testing framework that comes with the IDE.
But I really struggle with the fact that there's no widely-used garbage collector for Delphi - having to free every object manually or use interfaces for everything seems to have a pretty big impact on the way that you can do things effectively in an object oriented way. Also I'm not particularly keen on the syntax, or the fact that you have to declare variables all at the top of a method.
I can handle Delphi, but I'm wondering if C++ Builder 2009 might be a better choice for me. I know very little about C++ Builder and C++, but then I know very little about Delphi either. I know there's a lot to the C++ language, but I suspect it's only necessary to know a subset of it to get things done productively... I have heard that the C++ of today is a lot more productive to program in than the C++ of 10 years ago.
I'll be doing new development only so I wouldn't need to master every aspect of the C++ language - if I can find an equivalent for each of Java's language features I'll be happy enough, and as I progress I could start looking at the more advanced stuff a bit more. (Sorry if that sounds painfully naive - if so please set me straight!)
So, for a Java programmer that's new to both Delphi and C++ Builder, which would you consider to be a better choice for productive development of Win32 exes and dlls, and why? What do you see to be the pros and cons of each?
Delphi or C++ Builder - it's a difficult choice!
As you're aware, they're basically very similar, from the IDE and RAD point of view.
The pros and cons of each - irrespective of background - are a bit like this. Both share a great 2-way RAD form designer and framework (VCL) that are ideal for native Windows development.
Delphi:
C++Builder
That's about it. Just to state my position, I'm a happy BCB2007/2009 user (since BCB5), and I also infrequently use Delphi. A few years back, I considered a switch from C++ to Delphi, but the lack of RAII idiom was the one thing that I found difficult to come to terms with.
Go with Delphi and you can use the Boehm Garbage Collector API written by Barry Kelly so you can have garbage collection in Delphi. Barry wrote this before he went to work for CodeGear as a compiler architect. It does have issues with really large applications, and most likely won't work with 64-Bit Delphi. He talks about it quite a bit in this podcast interview.
Even if you don't use that garbage collecting memory manager, I would still recommend Delphi over C++. The only advantage C++ gives you for general development is the curly brace syntax. If you don't mind the Delphi syntax, then for most things you will find it better. Granted C++ Builder has the whole Delphi VCL and RTL, so it isn't as bad as Visual C++, but I still think Delphi would be a better choice.
For Excel add-ins (as you mentioned in your comment) I would recommend Delphi over C++ builder because it has better COM support (which I believe you need for Excel add-ins).
Delphi will be a lot easier for you to come to terms with, sure you have to manage your memory, but its very simple
MyObj = TMyObj.Create;
try
MyObj.DoSomething;
finally
MyObj.Free;
end
In Delphi all your objects are allocated on the heap, so the rule is very simple if you create it you free it.
C++ with its stack and heap based objs means you have a little more to learn and more scope for getting into trouble.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With