revUp - Updates and news for the LiveCode community
Issue 111 | June 2nd 2011 Contact the Editor | How to Contribute

From Delphi to LiveCode
How practical is it to re-write a substantial application in LiveCode?

By Scott McDonald

Mobile platforms such as iOS and Android are getting a lot of attention lately, both with developers and users, but there is still scope for desktop applications that fulfil specific needs. While desktop applications may not attract the same level of hype that surrounds the iPhone and other Pad like devices, there are still applications that need to be written for the desktop -- with customers who are waiting and willing to pay for them.

In Australia, the New South Wales Department of Education and Training (DET), had sponsored and supported the production of a teacher's markbook application (you can also call it a gradebook program) that was sold to schools across the state. Originally only for Apple computers but later ported to PCs, it was available to run on both Mac OS and Windows. Over time, for reasons known only to them, the DET lost interest in the project and so planned future updates failed to materialise and software support was abandoned.

An Opportunity

With no update for Mac OS X, the program became increasingly difficult to run on newer Mac hardware and software. The PC version was written in REALbasic and continued to work on newer versions of Windows, but no new versions were released for schools focusing on Apple hardware. Many teachers liked the old DET markbook and found it saved them time, but needed a program that could run on their new Macs.

These events led to an opportunity for the development of a desktop application written in LiveCode. At Scott McDonald PC Services we independently had a school markbook program written in Delphi. (Delphi is a Object Pascal based development tool that is powerful, but limited to Microsoft Windows.) After deciding to port our markbook software to the Mac, LiveCode (then named Revolution) made the short-list as a suitable tool and was ultimately selected as the development platform of choice.

Would it Work Out?

Before investing time and effort in a new development environment, questions need to be asked. Will the new tool be able to do everything expected? Would development progress rapidly at first, but then get bogged down as limitations and walls are encountered that weren't obvious at the beginning? Will the finished product run fast enough to satisfy the customers? And just how much code needs to be written and how long will it take?

After a thorough evaluation, I was confident that LiveCode was more than capable of fulfilling the programming requirements, but even after such questions were answered, doubts can roam in the back of the mind. Was this the right choice?

Here is the main screen of my original Windows markbook written in Delphi.

Main Screen

Behind this interface is approximately 100,000 lines of Pascal code structured as object-oriented modules. This may sound like a lot of code but here at Scott McDonald PC Services I take the approach that if a programming statement can be made easier to understand or debug by splitting it over two lines instead of one, then the extra line is a good investment. So while the number of lines may be inflated for this reason, in the table that follows remember that the same coding style was used when translating the program to LiveCode.

LiveCode vs Delphi

So how many lines were required for the LiveCode version of the markbook? See the chart below.

For the same functionality, the LiveCode version is approximately 30,000 lines. The time taken to write these was only a fraction of what was expected. To say that I was satisfied with the choice of LiveCode for a major desktop application is an understatement. In nearly every area the project positively exceeded expectations.

These figures above, are especially interesting if the often repeated assertion: the ratio of the number of bugs per lines of code is independent of the language used, is true. If it is, then just by using LiveCode there are less bugs in the software produced. Having to write less code to do the same operation is always a good thing. Further more, considering that the structure and style of the markbook program did not leverage some of the key strengths of LiveCode, the relatively small amount of code required was impressive.

More Than Satisfied

Interestingly, nearly all the development was done on Windows machines, and when switching to OS X for testing there were almost no problems with the cross-platform operation. What worked on the PC worked on the Mac without a fuss. Out of the 30,000 total lines of code, only 16 required special consideration because of differences between the Windows and OS X platforms! This is an incredibly small number for such a large application.

What is also impressive with these numbers is that a large proportion of the code that is the internal "engine" of the markbook can work unchanged on the mobile platforms that LiveCode supports. While this article is promoting development for the desktop, the benefit of knowing that the investment in LiveCode will not be wasted when a mobile markbook is developed should not be underestimated.

Above is the new markbook written in LiveCode running on Mac OS X. The icons for the toolbar are from the Aspen Icon Set available from the LiveCode Marketplace, and the RunRevPlanet SpellCheck from the Marketplace adds spell checking to the reporting feature of the markbook. Both of these saved time and helped make the application look attractive.

In a future article, more observations about moving from a 3rd Generation tool like Delphi to the High Level of LiveCode will be discussed.

Scott McDonald

About the Author

Scott McDonald is the owner of Scott McDonald PC Services, providing software to teachers worldwide. Scott also manages RunRevPlanet which produces cross-platform libraries and controls for LiveCode developers. Visit RunRevPlanet here.

 

 

Main Menu

What's New

Get RunRevLive.11 Dvd's