Archive for November 28, 2014

Delphi outdated? Says who!

November 28, 2014 20 comments

Edit: This is an old article from 2014, so the facts are more than a little outdated. I should also underline that I was quite upset when writing this, having just come home from a rather unpleasant debate with some Java developers. The VERY tasteless meme below was not created by me. It was originally a meme about Delphi from a Java perspective —  so i reversed the roles, which kickstarted an avalanche of criticism from Java developers at the time. So please keep in mind that this post would never have been posted in its current form today. Never blog when you are upset, it never looks good.

A couple of days ago I posted a funny meme picture on Google + and Delphi Developer. In the first instance a user commented that “Delphi is outdated”, which seems to be the general consensus for non-delphi programmers around the world.

I mean I did post the image below as double-fun, meaning that yes it’s normally the other way around – so that makes the joke more funny (you should see some of the anti-delphi memes, they are far worse than this. Seriously), and also funny because the roles are reversed for me (I have always had jobs given to me, I rarely ask for a job). So for me it’s actually true.

I laughed :D

While utterly tasteless, this was originally a Java meme about Delphi. I simply reversed it, which caused total panic in Java land.

I have seen so many Java guys who just did not make the cut when things got “low-level”, ending up losing their jobs because they were not prepared for the reality of how a computer works. So while the rest of us dived head-first into winAPI services to make our RPC servers and load-balancers go faster, the Java crew silently retracted into their office, pondering why tomcat was unable to catch up with Delphi; Avoiding eye contact and stopping all the foolish “java is best” locker-room talk. Which was funny because the same gang of Java coders were initially a loud and condescending group of lamers, giggling in amusement when they heard the word “Delphi”. Only to be outsmarted, outperformed and ultimately just OUT.

When I showed the boss that creating a service took less than 5 minutes to build, and that adding a server to the win32 service was a matter of dropping a component on the data module, he just shook his head and said “Had I met you when we started this company, I would never have wasted my money on Java. I would have hired you full-time and done this in Delphi

Some two years later and the company went bankrupt. The Java crew had eaten up years worth of salaries and built a product which was unable to cope with reality. Even though I fixed the damn thing it was too late. They ran out of runway and went belly up. That would not have happened had I been allowed to do this in Delphi from day one.

Delphi not cool enough?

So.. did I miss something? When exactly did the world at large decide that Delphi is not allowed to be cool anymore? So a scripting toy like python, which could easily be written in Delphi — that’s cool. But a full on OOP compiler toolchain which produces native code for all modern platforms, that’s not cool. Where exactly is the logic in that?

Having googled around for a bit, trying to find some substance to this claim, all I find are rumors. Actually not even rumors, but more along the lines of childish thrash talk behind someones back or “name dropping” to fit in with the popular group. Yet when you try to examine where this aversion for Delphi is coming from -or if there exists any solid evidence behind this puzzling attitude at all, you find nothing.

Is object pascal about to go the way of the dinosaurs? And if so, who sat down and decided that a language en-par with the most popular and widely used language in the world, namely C/C++, suddenly has no place in the market?

Object pascal as a language compiles for nearly 20 platforms, including Nintendo and Ouya. The majority of these platforms are delivered through FreePascal, which is compatible with Delphi on almost all accounts.

With a market share in the millions Delphi still out-ranks python, pearl, ruby, GoLang and all dialects of basic combined (it has seen a steady rise on ranking systems like Tiobe). Not to mention objective C which saw a sudden rise due to the fact that Apple forced people to learn that cursed dialect. And if you want an old outdated language, then Objective C is the mother-load!

Let’s face it: no-one would use Objective-C of their own free will had it not been for Apple’s nazi regime for iOS back in the day. It is the bastard love child between Modula II messaging and C, with roots so far back in time that Cobol was pushing pimples. It is an atrocity cooked up in the labs at NeXT and pushed in the back-door by Steve Jobs.

Yes, I am angry. Really angry.

Statistical tomfoolery

And then there is TIOBE, which every year runs a statistical analysis on language popularity. And it does this by searching for keywords in source-code committed to SVN, Github and various repositories around the internet.

The problem? Well right from the start TIOBE decided that our language needed special treatment and rules, so instead of using keywords that would reflect reality, like “delphi”, “freepascal”, “lazarus”,”oxygene”, “smart pascal” and “object pascal” and then combining this into a score which reasonably represents reality  — TIOBE in its infinite wisdom decided that the word “pascal” should cover it (edit: this has been fixed in recent times, 2018).

TIOBE represents "selective" facts, not real facts

TIOBE represents “selective” facts, not real facts

This means that for the past decade TIOBE has reported only a fraction of the actual use and activity-level of our language, giving potential newcomers a completely wrong impression.

Lately they have decided to add “Delphi/Object pascal” to their list (due to heavy complaints for years), but only as a separate language to “pascal”, which once again misrepresents the Delphi, Smart Mobile Studio, Remobjects Oxygene and Freepascal community as a whole. We all know that these different takes on object pascal represents one large userbase, with only slight alterations in dialect and features. Smart Pascal for instance have adopted several features from Remobjects Oxygene, as well as C#, but it’s still 100% object pascal. And our customers are ultimately object pascal programmers with a background in Delphi or Freepascal.

Completely wrong. What about freepascal, TMT pascal and Smart Pascal? These represents the same language and should be combined into a single score

As you can see the word “Delphi” and “Object Pascal” is on the rise. But even here the statistics is only catching a fraction of the real activity online, because freepascal, oxygene pascal and smart pascal is not even taken account for

Now what kind of impression do you think this is sending to kids who want to learn programming? Object Pascal was architected to be taught in schools, with strict attention to types and syntax – in order to make sure students learn the ropes from the ground up; producing better developers and better quality code.

Even if you learn object pascal at school and decide to work with C# later, you will still have benefited greatly from learning how to program through object pascal. You will quite frankly have a better understanding of how .Net works behind the scenes, and thus be a better dot net programmer by proxy.

Sadly, the impression beginners are getting from TIOBE is that Delphi and Freepascal is dead and have been steadily declining for the past decade. Which is simply not true. Hundreds of thousands of kids are learning object pascal at school in Russia for instance. We are also seeing a proverbial explosion of use in South-America, the balkans and Asia. Which means that in a couple of years time there will be a wave of developers who build, sell and provide object pascal software and services.

The fall from grace

While I can only speculate on the rumor mill, I do have a firm grasp on the “fall from grace” subject and know precisely how the impression of Delphi being outdated struck root in the IT community. And it goes all the way back to the last epoch of Borland, the former owner and publisher of Delphi.

To make a long story short, Delphi and C++ builder was the only real threat to Microsoft back in those days, and unlike the rest -Borland refused to bend its knee. The end result, as we all know, was that Bill Gates personally head-hunted Anders Hejlsberg (and I mean personally) which is the author and brain behind both Delphi and dot-net. Back then there was little doubt that Borland was under attack, and considering the amount of financial force Microsoft represents – the war would be lost. Everyone knew that Borland would lose and everyone was scared for the future of the language, their jobs and income.

Borland DevStudio: C++, Java and Delphi in one massive catastrophe

Borland DevStudio: C++, Java and Delphi in one massive catastrophe

Either way, faced with the option to die or convert to Microsoft, Anders did what most sensible people would do, and accepted the substantial parachute package from Microsoft; And he now works as *the* chief software architect at that very company. He is not just the author of Turbo Pascal and Delphi but also the guy behind the dot net framework, which incidentally was a Borland project – cleverly called “portable Delphi” before that.

Just stop and think about that for a moment. Every single argument you have for C#, Visual Basic .Net and the whole dot net ecosystem comes from Delphi and represents a Borland skunkworks project. What happened instead is that Microsoft killed Borland, dismantled it and in classical warlord style – brought back the most learned to work for them.

So people who say Delphi is outdated in comparison with dot net should watch it, because there is a lot of Delphi in the dot net framework and CLR architecture. That’s because it grew from Delphi, taken and released under the Microsoft banner. The initial specs for portable Delphi included pointers from what I remember of the post on it, but I guess that went out the window in favour or byte-code uniformity.

And the rest is history. Borland was dismantled and forced to give up its software development division, which they sold to Embarcadero. A company who inherited the monumental task of (more or less) re-building Delphi from scratch, along with a very angry user base of millions of Delphi and C++ Builder developers.

“I have always held the human race in high regard, until i saw a whole generation of kids ruined by java and hanna-montana.. now i genuinely believe that only a small fraction of the human race should be allowed to reproduce”

But Borland was no innocent little goodie-two-shoe company without blemish. They made some spectacular bloopers before Microsoft slapped them out of existence, like Delphi for Linux (Kylix) which turned out to be a financial disaster for both Borland and it’s technology partners. A disaster which ultimately hurt component writers more than it did Borland. Because while Borland had the finances to recover from the loss, component authors did not. They all lost money, many went bankrupt, and larger component providers like Developer Express simply decided it was enough, and stopped innovating their products for Delphi after that. They still maintain their older products, but as far as new products are concerned, that is on pause.

Kylix, Delphi for Linux, years ahead of it's time - but ultimately a failure

Kylix, Delphi for Linux, a decade ahead of its time – but ultimately a failure

Next there were the Delphi for .Net releases (mostly 2000 labeled variations of the product, like 2004, 2005 and 2006). These editions of Delphi were slow, sluggish and in my view – a complete waste of time. Invented only for spite in trying to outdo Microsoft at what they do best. A foolish endeavor which only served to enrage the user-base accustomed to Ander’s fast native execution philosophy, even further.

Introducing the dot net framework into the product rendered it close to useless and was seen by us developers as a “capitulation to lower-standards”.

After the sale to Embarcadero, the product still lingered without any real updates while EMB built up competence in their development department, not to mention getting rid of the dot net rubbish which had turned a once lean, mean and ultra fast language into a fat, bloated monstrosity.

The change

Embarcadero have in my view held their promises. Delphi as it exists now is once again a fast, lean and mean development toolkit – with all the bells and whistles you would expect from a top of the line programming suite.

Personally I feel Embarcadero is doing a monumental disservice to themselves and their user base in its continuing promotion of Delphi as a RAD (rapid application development) system, because RAD in our day and age is pretty much the norm.

Rad Studio XE6/7 represents 20 years of C++ and Object Pascal exellence

Rad Studio XE6/7 represents 20 years of C++ and Object Pascal excellence

Either way, modern language features such as generics was added years ago, as was support for iOS, Android and OS X compiler targets. Not to mention a spanking new RTL called Firemonkey which makes use of the GPU to render modern UI’s everywhere.

I must admit that I have a love/hate relationship with FMX. Roughly 4 years ago the frustration I felt culminated in me creating Smart Mobile Studio, quite frankly because I found that to be a faster and more direct path to building mobile applications. Smart Mobile Studio is doing very well and the Smart Pascal dialect makes JavaScript a dream to work with.

But just like dot net is written in C/C++, Smart Mobile Studio is written in Delphi and is 100% dependent on the native capabilities Delphi provides. This may change quite soon as a re-write to freepascal is imminent, but Delphi is still the product we use to create our alternative path.

I won’t cite the complete list of changes to Delphi as a product, because the list would fill a medium size book. But for anyone to say that Delphi is “outdated and old” would be to utterly surrender all faculties of reason. If old means “more years than dot net” then at least recognize that old in this case means wisdom and experience, not death and disability.

C++ Builder, Delphi's sister product, lean mean and hungry

C++ Builder, Delphi’s sister product, lean mean and hungry

There can be little doubt that Delphi has lost friends over the years, and I personally believe this is the source of the “Delphi is outdated and old” rumors. But heck –if you want an old language then C++ is the oldest and most cryptic of them all (!) So how can people applaud C/C++ and at the same time say that object pascal is outdated? C/C++ outdates object pascal by 3 years (!) Yet object pascal was created exactly to replace C/C++. Object Pascal was also engineered to be easy to learn – that’s why Turbo Pascal and Delphi has been used in universities, to be a safe path for people to learn OOP programming.

So for those of you that prefer or like to believe that Delphi is outdated, that is simply your personal pipe-dream. It is not based on fact and has no roots in reality. You are in fact suffering from an intellectual emergency.

Delphi is growing steadily and the language is just as excellent today as it was 15 years ago. Thousands of small and large computer programs are made with Delphi every year. Many of them quite famous. Here is a list of those I know about if you don’t believe me.

Turning the tide

A lot of Delphi developers have grown lazy. I still find repositories online that needs a facelift and perhaps some updated content. In most cases the repositories are very much alive, updated less than a 12 months ago — but the author’s doesn’t bother to update the text.

This is sending a wrong signal to people of less intelligence. Stupid people believe that unless something was updated yesterday, then the code must be unusable. The idea of timeless code, like a cipher routine which follows standards and principles, is sadly lost on them. I have code I wrote 12 years ago that works perfectly fine to this day. There is nothing you can do to make it more modern, because what it does and how it does it is based on timeless principles.

Do your part, ruin  java setup every week!

Do your part, step on java coder every week!

But fact is fact: People are reacting to what they label as “old code” lingering around the internet, and they are to some extent right. So we need to clean it up (!). If you have a repo of code somewhere that has remained idle for a couple of years, why not update it a bit? Or at least do a checkout/in to make sure the dates reflect reality.

And if you have an old Delphi website that you no longer maintain — either give it to someone who will maintain it, or spend an hour giving it a run over.

The same goes for websites that promotes Delphi. Torry’s is more than overdue for a face-lift, as is Delphitools.

Do your part — show these adolescent imbeciles just what they are missing out on! I feel so sorry for the past two generations of kids, growing up with Java and JavaScript and believing they have the right to call themselves programmers. Java is a toy. Bytecode compilers is what we do when we are bored and want to play.

Object Pascal is not just Delphi

Another factor that seems to be to complex for Java, dot net and script programmers (if we can use that title in this context) is that Delphi is a product. Delphi is not object pascal, but rather just one compiler toolchain of many which uses the object pascal language.

So when people are touting that Delphi is outdated what exactly are they referring to?

Freepascal running on Ubuntu

Freepascal running on Ubuntu

For instance, freepascal and Lazarus which are both free and open-source initiatives (these are two separate projects but operate as one) can be downloaded and installed on every Linux, Unix and whatever distribution known to mankind. You can target Nintendo, Playstation, Aros, Linux, Spark Solaris — heck, even the Amiga and the Raspberry PI for that matter.

And this is what people don’t seem to understand: try installing mono on the Raspberry PI, just try it. If you are lucky it will have downloaded and installed over the course of a week, at which point it will take roughly 60 minutes just to start the IDE. And this is if you can even download it and use it at all.

What people don’t seem to get is that programming on devices with so little CPU and memory requires a language that can scale well. C/C++ scales down just fine, as does Object Pascal. But more importantly: the code you generate for these devices must be compact and as fast as humanly possible.

If you compile your Java and mono code to a single binary (read: machine code) then that should run fine as well, but they won’t be fast! Java pushes so much crap up the stack that it’s practically abusing the hardware — and while mono is much better than Java, the amount of code it produces is ridicules.

Freepascal on the other hand is a Ninja on these systems. Blazing fast and with full access to 20 years of pascal evolution, you have thousands of libraries available out of the box. No other language except C/C++ can compare with this.

Typical misconceptions

Below are some typical comments written by people who believe that C# and Java is so much better than Delphi and C/C++, and my reply.

“In what world is it modern to handle memory directly” (read: pointers and freeing object).

In the world where computers have memory. What reality are you living in?

“Delphi is ancient, the memory manager itself is ridicules”

Really? You obviously have worked very little on embedded systems. Being able to write your own memory manager if you so desire has nothing to do with age, but rather with flexibility and choice. When writing code for embedded systems, you don’t have the luxury of retaining objects or using reference counting. Try installing mono on the Raspberry PI. Perhaps it will boot up sometime next week, if it’s able to compile at all.

“Pointers are dangerous and old-fashioned!”

A knife is dangerous in the hands of a child, but if you use it with respect and write proper code, then pointers are safe. CPU and memory is the reality of how a computer words, and just because you have been fooled into thinking an abstraction layer is reality – that is your loss. You are confusing the map with the landscape.

Have you ever written code that runs on a Nintendo DS? I have. Did you know that the screen on these devices is a file on the CF memory card? So to write a pixel you actually write a 16 bit word to a file. Try doing that without memory mapping. I feel sorry for your lack of insight.

“Having to free objects manually is a waste of time, face it, object pascal is ancient”

You seem to forget that dot net and java are written in C/C++. And if you have a look at the code written by Microsoft themselves you will see pointer types used in roughly 90% of their C# code. You should ask yourself why Microsoft is telling everyone that pointers are unsafe and should be avoided, yet they themselves use it extensively. Besides, implementing IDisposable in your object pascal objects takes 3 seconds. So your argument is infantile.

“Having no support of interfaces in TObject is ridicules!”

Then you don’t understand interfaces, reference counting or how it came into being. Using interfaces is not a must, it’s an option. A programming technique which was introduced as a standard way of decoupling access from entrypoint. There is no reason for adding the overhead of reference counting and garbage collection in object types which don’t benefit from them. And if you find it hard to write the 8+ lines of code which gives you IDisposable in your codebase, then you are either mentally challenged or lazy.

Final words

So the next time you feel the urge to say that Delphi is outdated, or that object pascal is old and has no place anymore — at least try a modern version before you jump on the teenage bandwagon and thrash talk something you know nothing about. Downloading a crack of a Delphi version 15 years our of production does not count. Or should we download Visual Basic 5 and measure the merits of Visual Studio today by that standard?

Object pascal has stood the test of time, just like it’s sister product C++. It was here before Ruby and whatnot came into being – and it will be here long after these hyped up products are dead and buried.

Here is what I would define as outdated:

  • When the code no-longer match the hardware and OS (read: 16 bit code)
  • When datatypes no longer exist except for legacy support
  • When you can no longer buy hardware (read: Amiga computers are out-dated, Commodore 64 is outdated)
  • When code no longer runs without special attention (read: execute as windows 95, XP etc.. )
  • Code that does not take height for unicode and UTF encoding

So there is a lot of outdated code out there, loads of it, but the majority of Delphi code online runs just fine. But yes, there is a lot of code that needs an update in the world of Delphi — but that goes for C++ and Java as well. Loads of java code written back in the day which no longer compiles, especially code written for the early Swing widget sets.

As for C#, it’s ok! So I’m not against C# or Visual Basic at all. I love to play around with these languages, and I have written a lot of C# code for serious applications (and will work extensively with C# for the foreseeable future). But I never lose sight of the fact that without C++ running the show behind the scene, C# would be useless.