JonHoyle.com Mirror of MacCompanion
http://www.maccompanion.com/archives/december2005/Columns/AccordingtoHoyle.htm

 

Newsworthy Events



According to Hoyle...

Cross-Platform Software Development from a Macintosh Perspective: CPLAT

by Jonathan Hoyle

jonhoyle@mac.com

December 2005

Three months ago, we began our series on cross-platform software development from a Macintosh perspective.  We have reviewed two of the most well-known C++ frameworks: Qt and wxWidgets.  This month we highlight the CPLAT framework, created by Ken Stahlman.

CPLAT Overview

CPLAT is a low cost royalty-free framework which targets Mac OS X, Classic and Windows, with a Linux version under development.  Reminiscent of PowerPlant, CPLAT contains dozens of C++ classes designed to access GUI elements, OS events, graphics, printing and even OpenGL.  Knowing that most Macintosh developers prefer to use Apple's Interface Builder to layout the GUI, CPLAT allows you to use .nib files created by I.B. for your Macintosh projects.    For those cross-platform-minded, CPLAT comes with tools which allow you to import .nib files and convert them into XML which can be used by CPLAT for Windows as well as Macintosh.

For the extremely low price of $50 per license ($300 for a site license), CPLAT is a tremendous value.  The current version of CPLAT II can be compiled with Xcode, CodeWarrior or Visual Studio.  For those interested in starting with the Mac version only, Ken has recently introduced CPLAT_Mac II for the reduced price of $25 per license.  When using Xcode 2.1 or higher, CPLAT II and CPLAT_Mac II can be used to build Universal Binary applications, which run natively on Intel-based Macintoshes.  Users of CPLAT_Mac may upgrade to the full CPLAT framework at any time for the $25 differential.

Interview with CPLAT creator Ken Stahlman

Ken Stahlman agreed to talk with macCompanion about CPLAT for this article, and the following interview is taken from two days' correspondence:

How long have you been using the Macintosh?

Since the MacPlus days.

What in particular inspired you to create CPLAT?

I had an application that was written in another framework that was Mac OS only, and it needed to be useable on a PC. I looked at all of the options at the time, and really couldn't find anything that was affordable.  So I figured that I would write my own cross-platform framework.  At the same time, I figured if I had this need, there must be others that needed an affordable cross-platform framework.

Who is your primary target audience for CPLAT?

The primary target is Mac OS developers wanting to port their apps to Windows.  There have been a number of users who have used CPLAT to port their PowerPlant app to Windows, so I see that as a potential target audience.

How long are you planning to continue Classic support?

Unknown at this time.  The current plan is to not remove it, but just keep the support at where it is.  Only Mac OS X Mach-O will have new features added to the framework.  CPLAT is used by some apps that are used in educational systems and need to continue to support older machines.

How would you compare CPLAT to PowerPlant?

The original design of CPLAT I was similar to PowerPlant.  With the new version II of the framework, the design is more like a Carbon Event based application in that you register signal and slots for the events you want to handle.  Like PowerPlant, CPLAT provides wrappers for most of the native OS's widgets and things.  However, I think that one of the biggest differences is that CPLAT classes tend to provide more functionality than PowerPlant does, especially PowerPlant X.

What would you say are the relative strengths of CPLAT?

I would say the relative strengths of CPLAT are that it is a low cost cross-platform framework that is easy to use and understand and provides a lot of functionality needed to write an application, such as document, file system, undo and printing support.  CPLAT is moving forward and keeping pace with modern OS features, and if CPLAT doesn't provide something you need, you can easily access the underlying OS object and use OS APIs to easily add or extend features to your app.

What would you say are the relative weaknesses of CPLAT?

The most often cited weakness of CPLAT is that it is developed by just 1 person.  However, there are many users that provide bug fixes and enhancements.

Have you had an opportunity to compare CPLAT with other cross-platform frameworks, such as Qt or wxWidgets?

I've only briefly looked at Qt, and the most noticeable thing that strikes you about a Qt application is that it doesn't look right on Mac OS X, whereas CPLAT is using all native controls & HIViews on Mac OS, and native widgets on Windows so you get the natural look and feel of the underlying OS.  I haven't used wxWidgets, but I had one user say they tried to port their PowerPlant app using wxWidgets, but gave up, and is now using CPLAT.

You have recently made available CPLAT_Mac II.  Can you tell us about CPLAT_Mac and how it compares with CPLAT?

CPLAT_Mac is the same as CPLAT but doesn't have any of the Windows or Linux code in it.  Its purpose is for developers who want or need a framework to develop Mac OS apps and that are thinking about possibly going cross-platform, or who might want to consider switching to another framework now that PowerPlant is no longer being developed by Metrowerks.  By using CPLAT_Mac, users can build their applications for Mac OS now, and if at a later time they want to go to Windows, they can get the cross-platform version of CPLAT for just the price difference.

How much of a transition is there to go from PowerPlant to CPLAT?

There is not much of a transition in going from PowerPlant to CPLAT.  The command handling system is a little different, but if they have used CarbonEvents, then the transition is very simple, in that you just register a handler for the event to be handled.  The hardest part would be converting the UI, but CPLAT includes a tool that will read and convert PowerPlant PPobs to CPLAT xml files that construct the UI at runtime.  Alternatively, there is a third party tool called Migrator that could convert the PPobs to InterfaceBuilder nibs which CPLAT can use.

Besides the Macintosh and Windows, what other operating systems do you support?

There is some limited support for building on Linux using the Gtk/Gtk2 widget set.  I hope to strengthen this area in the next release.

What's in store for the future of CPLAT?

For the short term, making sure that CPLAT will fully support Mac OS on Intel.  In the long term, I'm working on an editor that will allow the user to visually connect various UI elements signals and slots visually.  Keeping up with advances in Mac OS and Windows, and adding functionality when appropriate.

Finally, what would you like to say to Mac developers reading this article who are still deciding upon a cross-platform strategy?

CPLAT provides an easy to use, low cost solution for moving your apps to Windows, in addition to keeping up with current Mac OS features.  If your application is built with PowerPlant or PowerPlant X, you will find CPLAT an easy way to get your application ported to Windows.  CPLAT also provides tools to allow you to use InterfaceBuilder to create your UI and convert it to a form useable on Windows.

Conclusion

Although not as full-featured as Qt or wxWidgets, CPLAT's ease of use and similarity to PowerPlant make it an ideal choice for cross-platform development.  CPLAT is much more intuitive and simpler to use than the cumbersome wxWidgets, and far cheaper than the overly priced Qt.  Unlike so many other solutions, CPLAT makes the Macintosh truly a first class citizen, with no ugly compromises required by so many other solutions.  As CPLAT continues to evolve, it is becoming more mature and robust.

Though CPLAT may not be sufficient for everyone's needs, its low price and small learning curve make it recommended for your first attempt.  Those wishing to evaluate CPLAT for their own needs can download a trial version from its web site at http://www.ksoft.net/cp_trial.htm .  Legacy PowerPlant projects are ideal for this approach, although newer projects would also do well.  Its biggest weakness is its small user base, but this has afforded Ksoft to respond to users in a more timely manner.

If you are looking for a reasonably priced C++ cross-platform framework that retains the full feel of Macintosh development, you will have a hard time finding a better product than CPLAT.

 Coming Up Next:  Having investigated some C++ frameworks in depth, we will now move on to examine other rapid application development environments.  Over the next few months, we will be looking at non-C++ solutions, including REALbasic and Runtime Revolution.  If there are any specific products you'd like reviewed, please email your suggestions to me at jonhoyle@mac.com.

About Us | Site Map | Privacy Policy | Contact Us | ©2005 MPN LLC.

http://www.maccompanion.com/archives/december2005/Columns/AccordingtoHoyle.htm http://www.maccompanion.com/macc/archives/December2005/Columns/AccordingtoHoyle.htm