Borland (BorlandDelphi) has been extending their PascalLanguage in ObjectOriented dimensions and Delphi is the latest. It has some automated GarbageCollection (auto reference counted strings, dynamic arrays, GUI components that are freed by owners), and has a few other nice features for OO programmers: * Objects are uniformly allocated on the heap * Object references are 'dereferenced' by default, so objects are not dealt with through pointers * Single inheritance * RAD ide (rapid application development) and drag and drop GUI abilities * Explicit references to inherited methods use the actual parent hierarchy, instead of hardcoding the ancestor class like C++. * Class methods * All objects descended from the base class TObject * Language support for properties. Rather than create get/set methods for an ivar, you make it a property... write operations invoke an arbitrary 'set' method, and readsinvoke a comparable 'get' method you create. * Executables can run on a 4 meg machine (otherwise we'd all use Smalltalk ) * Has a Java-like notion of interface (abstract class with no fields or implementation) * Has function overloading like C++ * Can perform polymorphic construction of instances using variables that refer to a class type * Does not enforce type restrictions on objects unlike C# or Java. Objects can be cast to a type that they do not implement. * not truly GarbageCollected like Java, so it is faster.. but still reference counted automated types (which can count as garbage collection, depending on your definition) ---- Examples of Syntax: '''type''' TForm1 = '''class'''(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; '''procedure''' Something; '''procedure''' Button1Click(Sender: Tobject); '''end;''' '''implementation''' '''procedure''' TForm1.Something; '''begin''' ShowMessage1('Hi, what in the world are you doing?'); Button1.Color:=clBlack; Edit3.Text:=Edit2.Text; '''end;''' //comments on one line (* comments spanning more than one line *) {or use parenthesis for comments} ''{call the procedure later on in the program...} '' Something; TForm1.Something; //say you were calling this procedure from Form2 ---- * MetaClassVariable''''''s with support of the notion of strong typed inheritance and VirtualMetaClassMethod''''''s (missing in Java) * ''create'' class methods (instead of ''new'') and VirtualConstructor''''''s, called from the most inherited first * VirtualDestructor''''''s * explicit '''override''' keyword for virtual methods overriding * multiple implementation of interfaces with explicit method naming conflict resolution * strong RunTimeTypeInformation, controlled by '''published''' scope in class declaration, with CategoryReflection (for classes and interfaces) * CustomVariant''''''s types with OperatorOverloading * OO Libraries (DelphiPackage''''''s) * InterfaceImplementationByDelegation. One can implements an interface with an object property. Related with InterfaceAggregation * SmartInterfacePointer(s) handled by compiler (see DonBox articles: http://www.tinaa.com/harmful/InterfacePtr.htm and http://www.tinaa.com/harmful/SmartPtr.htm) * GarbageCollection (with ReferenceCounting) for InterfacedObject(s) (= objects referenced only through interfaces) * predictable InitializationSequence and FinalizationSequence * separation of component property initialization via ObjectStreaming with resources * modularity and compiled unit (interface) inclusion * OO exceptions, with try .. catch and try .. finally blocks * events implemented with MethodPointer''''''s (CategoryClosure) * RapidApplicationDevelopment, visual with ComponentParadigm * StackObject(s) (non inheritable, to prevent ObjectSlicing), based on record type * Namespaces * MultipleInheritanceOfInterfaces (Planned) * ObjectGenericity (Planned) * register (default) parameter passing on call * stack (c/pascal) CallingConvention * COM+,CORBA,SOAP client/server and EJB client (restricted to BAS server) * Linux (BorlandKylix), Win32 and .NET support * UML TwoWayTool with ModelMaker (in Delphi Enterprise) * BusinessObject(s) model with BoldForDelphi (in Delphi Architect) * ProjectJedi - "the" OpenSource project for BorlandDelphi ---- For a clear (but a little bit outdated) presentation of Delphi ObjectModel and a feature compare respect to JavaLanguage and CeePlusPlus, see http://www.oreilly.com/catalog/delphi/chapter/ch02.html. ---- This title: '''Detection & Extraction of Latent Properties Hidden Inside''' was at the top of this page. However, as an explanation of the name "Delphi" it doesn't seem correct. See http://community.borland.com/article/0,1410,20396,00.html ---- How ObjectOriented is Delphi, really? Care to contrast it to SmalltalkLanguage or Java? If one were transitioning from Delphi to either Smalltalk or Java, what would the important differences be? ''About as OO as CeeSharp. C# is a mixture between Java and Delphi anyway.'' [It's ObjectOriented, but one can still use plain procedures and functions (example: a CGI or console application doesn't necessarily need to be OO, nor do one off prototype apps). The syntax is similar to Oberon, Modula, and even SmallTalk. Arguably, the language easier to read on screen or on paper (in some people's opinion) compared to other languages. Object orientation might be quite useless if one can't read the code in the first place. An important part of Object Orientation is that it clears up some code's readability and uses more words than symbols in the appropriate places. But when one can use regexp modules in Delphi and even become perlish if one wants.] ---- Delphi is StaticallyTyped, but single inheritance. That means that there are some times when you will just have to resort to non-OO programming. Delphi has interfaces, but interfaces just don't cut it. When the original Delphi came out, I worked for a company that developed components for Delphi. It turned out to be the only time I needed multiple inheritance. Wound up faking it instead using tables of function pointers. -- ThaddeusOlczyk ---- I've always seen Pascal as a teaching language only (now mostly replaced with Java). I can't understand why people would implement ''real'' software in it as the language was not designed for that. As for Delphi, it's basically a VisualBasic rip-off. ''Not really. Microsoft hired the chief architect of Delphi away. Now he is adding OO features to what will be VeryBasic7 ( should I make a page out of this ). The irony is that Delphi 3,4,5 seem to be significantly better, and they were developed after he left. -- ThaddeusOlczyk'' ''Delphi is not a visual basic rip off, I've yet to see any software applications in C++ that can't be done in delphi. Maybe VXD drivers for Win32, or an operating system. But you still have FreePascal available if you want to create an operating system. '' Just because you can type edit1.text:=edit2.text; Does not make it a visual basic rip off. ''Programmers using Visual C++ have been looking for something like this for years, and it's right under their noses, they just don't know it is called Delphi.'' Also, many applications written in delphi have never been written in C++.. take all the resource hackers available out there.. all written in delphi, where are the C ones? How about being able to ''easily'' embed assembler into your code on the fly. [Delphi uses components, ever since 'Delphi 1' now, umpteen years later, Microsoft hired borland employees and Microsoft is implementing components into C# just 'now'. Delphi 1 was a very long time ago, and "components and plugins" are a very interesting way of programming and uniting developers with users, or uniting developers with developer-users.] ---- Delphi is based on object-oriented Pascal. The basic object extensions are simple and, though once I thought incomplete, in fact they're quite robust. No multiple-inheritance, and implicit derivation-from-TObject. No pure-virtuals, but virtuals as-needed. Simple-but-usable subject-observer relationships built in at a low level. I use Delphi for about half of my development work. It is decidedly *not* a VisualBasic rip-off. Delphi's most important characteristic is that it fronts to the user a clean and orthogonal set of user-interface classes for manipulating Win32. This is no mean feat, and the resulting 'windowing model' is vastly easier to use and to teach than VB. (I teach and use Delphi, VB, and VC++.) Kudos to Borland for the Delphi product. Borland's C++ Builder, sadly, chose to transliterate Delphi's model rather than translate it. The painful result is that what seems elegant and simple in OOP is ugly and non-C++-ish in BCB. But, had they actually translated the concepts rather than transliterating the code, I would be pushing all my customers to use some combo of Delphi + BCB. -- MichaelHill ---- Delphi does have abstract methods, very much like pure-virtual-methods. They do not stop your code from compile like pure-virtuals, but they do crash your program if you fail to call one that's not overridden. Possibly in the field. BCB is a fairly good product, and would be much better if Borland really cared. Unfortunately there are major problems. For example the help suffers greatly from usability issues. The manager of the help asked for problems we have with the help ( on the newsgroups ). To me all the problems that I experience could easily be found if they taped a programmer using the help, and then went over annoyances with him afterwards. Unfortunately when I get back on the net, I never remember what the problems were. I suspect that's the same for most programmers. Right now I'm playing with ACE+TAO compiled under both BCB5 and VC++6. I haven't actually done timings, but it seems to me that the BCB version is way (starts in minutes, VC++ takes seconds) slower. -- ThaddeusOlczyk The thing that makes me crazy... Is when people casually mention that "oh, no I don't use XYZ, it's got ABC bug", that they *haven't even bothered reporting*. It drives me crazy, and should be grounds for invoking the RemoteStrangulationProtocol. -- David Welton 2001-11-15 http://www.advogato.org/article/378.html It drives me crazy also. -- DavidCary ---- I must agree with Michael. Now, heathen that I am, I've not used SmalltalkLanguage, so I can't comment on how it compares to that. But I have used Delphi, VB, BCB and MSVC++, and of all of them, Delphi is my favorite. From a language point of view, it's clean and orthogonal. Properties are great. Its OOP is simple and clean. I learned OO in Delphi first, then moved to other things. Because I already understood the concepts, I could learn (for example) C++. But if I'd had to grok both the concept and implementation at once, in C++, I'd have never have made it: C++ is quite fetid at times. C++ is more powerful as a result, but I'm not convinced the trade-off is worthwhile. From a tools point of view, Delphi never seems to take more than a couple of seconds to build a project, the resulting code is fast enough that I've written shoot-em-up games in it, and there's all the usual things you'd expect: Integrated debugger, RCS/CVS, etc. There are some things it's not best suited to, but if you're writing Windows apps 'for the desktop', I personally haven't seen anything to beat it yet. -- CanisLupus ---- JeffDay is busy creating a WikiWikiClone (or rather a WikiLikeThing) to run on IIS and he is using Delphi as the underlying language. ''HtagWiki is written in HtagLanguage, which is interpreted by DelphiLanguage... does that count? -- SvenNeumann'' PasWiki uses freepascal or delphi/kylix and works on GnuLinux, Win32. Interesting to see other Wiki projects on the go. ---- Now, if it only had a better implementation of lists of objects (they have to be dereferenced by hand), and a garbage collector and... but I digress. It's one of the best tools for Win32 development. And there's a ton of free, high-quality components that you can snap in easily. (ICS being my favourite example. Loads of internet-protocols wrapped up.) ''I wrote a garbage collector for Delphi... easy to do and I haven't used a ".free" in ages. -- SvenNeumann'' Sven.. tell us more? Do you have this available? It would be interesting to see what you've been able to do. Creating and killing components when one needs to is performance friendly, but garbage collection would be useful and something to look into! ---- Yes, Delphi is good at Win32 development but the lack of a decent collection library is blatant since its creation (almost a decade ago!) and has in my experience led many otherwise skilled programmers into suboptimal designs and have them refraining from adopting ObjectOrientation as a whole. http://www.cs.utu.fi/tjohtela/software.htm provides a good tiny persistent container library. Of course PersistenceInDelphi is still quite tricky and inelegant. I found that I could make the same persistent collection in Delphi in 12 hours vs 1 hour in Python (and 10 min in Java)... '''What stops you from building the collection classes? Delphi provides all the means. -- SvenNeumann''' Short answer: time, and skills. Why would I build what I can just use elsewhere which has been made by more skilled people? In fact I've got too much other business-related things to build... A very STLish container library for Delphi can be found at http://sourceforge.net/projects/decal/ . It (ab)uses the array of const feature along with variant types to give a very clean and easy to use syntax. Some things like heterogenuos containers and pushing multiple values into a container at once, are possible which go beyond the capability of the C++ STL. There are the equivalent of vectors, lists, queues rbtree maps, hashmaps and much of the algorithms found in the C++ STL. Also included is a nonintrusive serialization library which works seamlessly. A must have for any Delphi programmer. VivekN ''I also have observed many projects written in Delphi. One thing that I praise is that it is very robust and inclined to produce robust code also. It is very difficult to have some thing like a lost pointer ruining your code hidden somewhere in Delphi, as it is so common in C++. It is also fast hand has a '''very''' good set of objects provided with it to build desktop and client-server applications. If you follow the StandardWay of Delphi, your application will have the interface ready ''very fast'', you could prototype easily with the client.'' ---- Been with ObjectPascal for over eight years now. It's not for its outstanding qualities that I still stuck with it, but for its combination of qualities: * the strong type sensitivity of the underlying Pascal prevents errors * it invites to write decent code rather than quick code (regrettably, still a human factor here) * the OO concepts of Attributes and Operations translate directly into Properties and Methods * it's thanks heaven for that NOT case sensitive * its object model is complete enough; never needed more of multiple inheritance than I could realize by delegation, although pure abstract would be an advantage over intensely watching the warnings * garbage collection is a matter of education: you don't leave your rubbish on the street expecting someone else to clean it after you, so what would you expect in your software? However, though either way should work well, they shouldn't be mixed. The refcounting of interfaced objects in OP works no better than lousy. *In Win32, child window components do are freed automatically if their owner is killed. This is convenient I find.. it's not full blown garbage collection, but definitely stops dangling objects, saves time, and reduces free/nil code noise. * separate interface and implementation sections help a lot for readability of code. ---- Takes advantage of "Uses" and "Unit" files instead of include files. This improves maintenance and ease of managing code. But "includes" can still be used when you wish to. Example Syntax: '''unit''' ProgUnit1; '''uses''' unit2, unit3, //unit files, call some functions from them in here. Regexpr, //regular expression unit with procedures inside it. SynEdit; //text editing unit ---- See: * DelphiUnit for DUnit - unit testing tool * DelphiPatterns and http://www.geocities.com/beckmi/patterns.htm - DesignPatterns in Delphi * http://www.home-sites.us/strfunc/index.html - Delphi string functions * http://TheDelphiMagazine.com/ Related: BorlandDelphi, FreePascal, LazarusIde, ObjectPascal. ---- CategoryProgrammingLanguage CategoryDelphi