The Delphi Language is Lagging Behind

While I love the way Delphi is expanding to multiple platforms (but please, guys, stop the horses once in a while and fix some bugs!), I think the Delphi language could use a facelift. In particular, I like what Eric is doing with the DWS and I absolutely enjoy coding in Smart Mobile Studio where I could use the full power of Eric’s improvements to the language. I absolutely love DWS’ lambda statement. Delphi’s approach to anonymous methods is so damn long-winded (even for us Pascal programmers who love to type) that lots of programmers reject it just because of the unwieldy syntax. In DWS, however, I can use var repeater := TW3EventRepeater.Create(lambda (Sender) => MyFunction, 5000);orResizeChildren(FClientArea.Height, [TAlign.Top, TAlign.Bottom], lambda (layout) => layout.GetConfig.GetHeight, lambda (layout, value) layout.GetConfig.Height(value) end);Much shorter. More readable.Also useful are properties with anonymous storage. If my property only exposes a field and doesn’t use getter or setter, I can shorten the code by 50% by not defining the field at all. Instead oftype TMyClass = class private FData: integer; public property Data: integer read FData write FData; end;I can writetype TMyClass = class public property Data: integer; end;Another nice feature are property expressions – a way to write anonymous getters and setters.type TToDoListTemplate=class(TW3form) public property Task: string read (W3lblTask.Caption) write (W3lblTask.Caption); property Detail: string read (W3lblDet.Caption) write (W3lblDet.Caption); end;These are incredible time saver. If I redo this the Delphi way, I end up with a much longer code.type TToDoListTemplate=class(TW3form) private function GetDetail: string; function GetTask: string; procedure SetDetail(value: string); procedure SetTask(value: string); public property Task: string read GetTask write SetTask; property Detail: string read GetDetail write SetDetail; end; function TToDoListTemplate.GetDetail: string; begin Result := W3lblDet.Caption; end; function TToDoListTemplate.GetTask: string; begin Result := W3lblTask.Caption; end; procedure TToDoListTemplate.SetDetail(value: string); begin W3lblDet.Caption := value; end; procedure TToDoListTemplate.SetTask(value: string); begin W3lblTask.Caption := value; end;I also love type inference and in-line variable declaration which allow me to write code like this:var item := ActionList.Items[ActionList.Add] as TLBItem;item.Header := header;item.Text := text;orfor var item in ActionList.Items doWhen I have to write a multiline string constant, multiline strings come handy.writeln("HelloWorld");Even better – DWS will ignore leading common indentation if string is introduced with #” (or #’).writeln(#"    Hello    World");And last (but definitely not least), DWS implements a true conditional operator.s := if a = 0 then 0 else 1/a; --- Published under the Creative Commons Attribution 3.0 license
Read More

Android: Hello Facebook

Below is the first Facebook photo and post from an app built in Delphi for Android. Photo was taken from the Android (Samsung Galaxy Note 8.0) camera using the a Firemonkey camera action, then shared on facebook using a Firemonkey sharesheet action. Entire app is extremely easy to build – and also easy to add […] … Read More

Read More

Delphi Brings ARC to Android

From Marco’s Blog: http://blog.marcocantu.com/blog/delphi_arc_android.html Delphi mobile compilers use Automatic Reference Counting. While ARC is commonly used on iOS, Android developers generally rely on a Garbage Collector. Share This | Email this page to a friend
Read More

Monitoring the Monitor

No, not this Monitor, this Monitor. Ever since it’s introduction, it’s been the subject of both scorn and praise… ok, ok, scorn. Recently, during our current field test for the next version of RAD Studio*, one of our long-time field-testers posted a reference to this excellent blog post by Eric Grange […] … Read More

Read More

Sneak Peek: Delphi, Android, ARM Assembler and Extra Awesomeness

Less than two years ago, Delphi was a windows-only development tool. Think about that for a second. In less than 24 months, we’ve added native OSX support and native iOS support, with native Android support currently in beta. Now, I’m as guilty as anyone of being impatient about features and fixes, but when I step […]
Read More

Some XE5 Tour Dates

Enjoy the food on us. Join us for a meal and an exclusive session where you will learn how to move from desktop to mobile development delivering true native Android and iOS apps. Be one of the first to see an exclusive preview of the upcoming release of new Embarcadero Android and iOS mobile development technology and how you can get early access to these tools. At these 90
Read More

Printing from an Android device using FireMonkey

Printing from an Android device requires a little bit more setup than in iOS where you simply connect to an AirPrint capable printer (like my Epson XP-400). However, Android printing appears to work with any Wifi printer (or PC connected printer), so its more flexible. Basically, it consists of three steps.
First, download and install Google […] … Read More

Read More

Getting ready for Android

Android support in Delphi is on the Roadmap and is expected in the fall.   Although I have a Mac and an IPad, I have an Android Phone.   I was not as excited for the XE4 (iOS support) release as I am about Android support. I have some thoughts on Android that I want to share...Market ShareOverall I see a greater number of Android devices, in fact we have 5 Android based devices in my home and only 1 iOS device.  Market studies that I have read vary, but shows in some cases a 50-50 marketand in other it shows that Android has a greater market share.   Regardless the possibility of using Delphi to write a single application that can target both is very exciting. Android VersionsAndroid currently has shipped 7 different, Major product releases. These are separated by different code names.     Unlike iOS where most of the users are using the latest version.   Knowing this code names will make your life easier as they are referenced in documentation, blog posts, articles, etc...The 3 most popular (as of July 8, 2013):Gingerbread  - 34.1%Ice Cream Sandwich - 23.3%Jelly Bean  - 37.9%Full details on the break down of each code name are market share can be found on the developer.android.com site.   Another good tidbit from this site is the various screen resolutions andform factors you will see when targeting android.DistributionDistribution is not locked down like the iOS market.You can distribute you applications in several different ways including-Google Play Store-Amazon App Store-Download from you own siteDesign of your applicationI love to hear customers talk about just moving an existing windows application to Windows.   After talking with them, they quickly realize that the form factor and touch interface requires a redesign to the look and feel of an application.     For example, most VCL Delphi Applications I have seen contain a Grid.   I rarely see such anything like that on mobile platforms.   To help with this mind set switch I would recommend reading a couple of Design Guidelines.iOS Human Interface GuidelinesAndroid Developer Pattern Guidelines. (Check out other sections as well)A bit about the internals of AndroidAt the heart of Android is the Linux Kernel (Version 3.x since Ice Cream Sandwich release).On top of the Kernel sits the Dalvik Virtual Machine which runs Java Byte Code.So when it comes to development you have two targeting options.   Native - Runs at the Linux Kernel LevelJava Byte Code - Runs in the Dalvik Virtual MachineSince Delphi is using LLVM for the Android Compiler, applications running will be targeting native.Java has history of being able to interop between native compiled code, it uses a technology called JNI.I  suspect that Delphi will have some easy way to do JNI since several of the android libraries are based in Dalvik.Now it's time to wait and see what Delphi's Android support will really shape up to be.
Read More

Programatically Disable the Idle Timer on iOS using the ObjectiveC Bridge

If you’ve got an iOS device, you’ve probably noticed that if you stop interacting with your device, after a little while it will turn off the screen and go to sleep. This makes perfect sense for devices that are battery challenged at the best of times, but one side effect of this is that whatever […]
Read More