Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,672
6,212
I'd like to make a cross platform file browser. What language / toolkit would you guys recommend? I'd like the app to be able to access details like security settings and metadata for files as well as be able to look into bundles on OS X.

Will Java 7 / Swing be able to do this? Can I do it in Python (what GUI toolkit would you recommend?)

I have a prototype of what I want already done in Obj-C / Cocoa, but people have suggested that it could be really successful if I make it cross platform instead.

The UI is not very standard - I have too many ideas that are too central to the app and very different from anything you've ever seem before, so I'm going to end up with custom draw routines that make the UI look mostly the same regardless of which platform it's on.
 
Last edited:
IMO, the most fully featured cross platform library with a GUI toolkit and standardized I/O is QT. QT is supposed to be accessed from C++, but you can use it from other languages.

Another paradigm that software has used is to essentially build on top of a rendering engine. Blender draws all of its own tools from OpenGL, but honestly doing it this way really kills your UX and suffers form chronic reinventing the wheel. I've also seen game engines like Unity used to make cross platform software for businesses, but some care still needs to be made for the UX side.

In reality you're just going to have to go with one and learn it. Stuff like the JVM/Mono/CPython, they will do a lot for you but it doesn't have as much power as say C++/QT. None of the libraries will do everything for you, so you'll still have to write platform specific code here and there. Implementing cross platform software is kind of an art, and unless you want to dedicate your time to studying all the ways to deal with it beforehand you're just going to have to roll with the punches.

Personally? I take pride in the UX of my software so if I had the time and resources I would write my business logic in C++ and implement a front end in the native OS libraries. However if I actually needed to be productive I would use Mono/GTK#. As much as I like Scala the JVM's GUI libraries are kind of a kludge, even using something like SWT. QT would also be an option but the LGPL is an interesting beast depending on your requirements and my C++ is still average.
 
Last edited:
The problem with C++ is that calling it cross platform is more or less a lie. Sure, basic loops will be the same, but once you get into I/O you'll find nothing is the same. You'll have your files littered with platform specific defines as you import one thing on one platform or something else entirely on another. If nothing else, you'll need to compile a different version for each platform. That's why I was leaning towards Python or Java, which tends to have almost nothing that needs to be platform specific - plus you really don't need to do a unique build for each platform.

After spending a few hours looking at the Python GUI options, I'm feeling like I should just go with what I already know and pick Java 7 / Swing. Unless someone has a compelling alternative that is truely cross platform.
 
The problem with C++ is that calling it cross platform is more or less a lie. Sure, basic loops will be the same, but once you get into I/O you'll find nothing is the same. You'll have your files littered with platform specific defines as you import one thing on one platform or something else entirely on another. If nothing else, you'll need to compile a different version for each platform. That's why I was leaning towards Python or Java, which tends to have almost nothing that needs to be platform specific - plus you really don't need to do a unique build for each platform.

You haven't done a lot of non trivial cross platform development have you? There's a good chance you'll end up making a ton of platform specific code, even on Java. Like I said you'll just have to pick one and go with it regardless, they'll all have their subtleties when you'll take them from platform to platform.

Also try Scala, it really is all that over Java. ;)
e31edfefed844a9a0c1b33d40bf40f311cd07f2ab6fcb9ab35fa1c7f3a95abcb.jpg
 
Last edited:
I'd like the app to be able to access details like security settings and metadata for files as well as be able to look into bundles on OS X.

All of these are platform dependent, and to some extent file system dependent.
 
Now that I think about it, its going to be hell if he doesnt have access to the native libraries.

I've used both Java 7 and Python's standard libraries to access file data/metadata before and they struck me as being okay (prior to version 7 Java was difficult to work with for this kind of thing.)

What is Scala? I'll go read the Wikipedia article on it or something since you seem to be so adamant that it's what I want...
 
I've used both Java 7 and Python's standard libraries to access file data/metadata before and they struck me as being okay (prior to version 7 Java was difficult to work with for this kind of thing.)

Standard libraries are standard, meaning generic, which is why you will not be able to use it for platform specific data or features. It's the least common denominator that dictates what can and can not be done with these libraries.


The problem with C++ is that calling it cross platform is more or less a lie.

It's available on all platforms that have a C++ compiler (more than have a JVM), all these platforms can port libraries that aims to be cross platform such as QT.
 
It's available on all platforms that have a C++ compiler

T.T - I don't want to compile every release of my code on several different compilers. And I don't want to make my users compile the code.

I looked at Scala and that looks a bit interesting. I'll give it a shot and see how I like it. The syntax looks like a pain to learn but maybe it'll end up being okay in exchange for having so much more checked at compile time.
 
T.T - I don't want to compile every release of my code on several different compilers. And I don't want to make my users compile the code.

It was an example of course to counter your claim that it's not portable. How many platforms are you realistically going to support.

I looked at Scala and that looks a bit interesting. I'll give it a shot and see how I like it. The syntax looks like a pain to learn but maybe it'll end up being okay in exchange for having so much more checked at compile time.

If you like a functional programming language, but that's not really the point. You will end up writing platform specific code anyway, an Application bundle is OS X specific, so is Spotlight metadata just to give you two examples. How are you going to add this under one universal API?
 
It was an example of course to counter your claim that it's not portable. How many platforms are you realistically going to support.

OS X and Windows initially, with others added as time goes on.

If you like a functional programming language, but that's not really the point. You will end up writing platform specific code anyway, an Application bundle is OS X specific, so is Spotlight metadata just to give you two examples. How are you going to add this under one universal API?

I don't get the hoopla people make over functional vs... I don't even know what you call a non-functional language. I'm familiar with languages of both types and I fail to see the distinction. Either way they're turing complete meaning I can write code that accomplishes the same thing somehow.

What I want is to compile my code exactly once per release and to have as little of it be platform dependent as possible. A few more requirements:

Keep distribution easy (only having one compiled version should help with this a lot.) It should take under a minute to go from reading about the application to using the application (this often blows the minds of people who are used to Windows. As much as Windows sucks, I feel like one of its biggest problems is that 99.9% of developers seem to go out of their way to make installing their program as complicated as possible when they're targeting Windows. With that comes the fact that uninstalling stuff is hard and viruses are everywhere.)

Development should be as easy as possible, too.
 
OS X and Windows initially, with others added as time goes on.



I don't get the hoopla people make over functional vs... I don't even know what you call a non-functional language. I'm familiar with languages of both types and I fail to see the distinction.

You mentioned that the syntax looked like a pain, but an ok trade off for getting rid of compilation. I tried to point out that the language you pick has nothing to do with the discussion. If you want to learn a functional programming language check out Scala (for example), it has nothing to do with whether a project is cross platform or not because Scala uses the Java JVM.

But as an aside functional programming languages (as opposed to OOP or procedural languages) typically comes from Lisp, relies heavily on functions and recursion.

----------

Keep distribution easy

That's an interesting point, is Java even installed by default on Windows.
 
But as an aside functional programming languages (as opposed to OOP or procedural languages) typically comes from Lisp, relies heavily on functions and recursion.

As opposed to... what?

I can use recursion in... I think every language that I know.

I can pass functions around in C, Obj-C, Java, Python, JavaScript... I think every language that I know (feeling a bit shaky about this claim.)

Currying is kind of exotic and I've never tried doing that before outside of a class assignment before... actually, that's not true, I did it in Python last year although I can't remember why I did it... I just remember having to explain it to a peer during a peer-review at work.

That's an interesting point, is Java even installed by default on Windows?

It's not installed by default on OS X (I think OS X even goes as far as removing it when you upgrade to Mavericks - but you can reinstall it right afterwards) or Windows. In Mavericks, it'll automatically prompt you to download Java if you don't have it when you try to run a jar. Windows... I've never tried running a Java application on a computer running Windows that didn't already have Java installed, so I don't know how it handles the user trying to run a jar - it probably offers to do a Bing search just like it does at any other point the user tries opening something they don't have an application for.

Anyways, after I got Hello World to work in Scala's REPL (! - Only the third language I've decided to use that actually has a REPL out of the box!), I installed the plugins for IntelliJ and now have Hello World running there. It's getting kind of late now so I'll put off testing out Scala's GUI capabilities (it looks like it uses Swing, same as Java... I definitely prefer Cocoa/Cocoa Touch to Swing, but Cocoa isn't cross platform, so I'll have to settle for it.)
 
Last edited:
As opposed to... what?

I can use recursion in... I think every language that I know.

As oppose to C, Python, Ruby, Perl, Obj-C, C++ etc.

There is a difference between being able to use recursion, and only being able to use recursion. In a language that is not made explicitly for this it can lead to a stack overflow, because stack space is limited you know... I'm picking up Erlang at the moment. There are no loops.

But, please just use Google, it's a known and accepted category of languages starting with Lisp I guess, or perhaps Lambda calculus.

It's not installed by default on OS X (I think OS X even goes as far as removing it when you upgrade to Mavericks - but you can reinstall it right afterwards) or Windows.

Your argument for ease of use and distribution is out the door then IMO. The user needs to download Java from Oracle, install and restart their computer before they can install or run your application. Surely a native binary is more friendly.
 
I don't get the hoopla people make over functional vs... I don't even know what you call a non-functional language. I'm familiar with languages of both types and I fail to see the distinction. Either way they're turing complete meaning I can write code that accomplishes the same thing somehow.

You mentioned that the syntax looked like a pain, but an ok trade off for getting rid of compilation. I tried to point out that the language you pick has nothing to do with the discussion. If you want to learn a functional programming language check out Scala (for example), it has nothing to do with whether a project is cross platform or not because Scala uses the Java JVM.

But as an aside functional programming languages (as opposed to OOP or procedural languages) typically comes from Lisp, relies heavily on functions and recursion.

As opposed to... what?

I can use recursion in... I think every language that I know.

I can pass functions around in C, Obj-C, Java, Python, JavaScript... I think every language that I know (feeling a bit shaky about this claim.)

Currying is kind of exotic and I've never tried doing that before outside of a class assignment before... actually, that's not true, I did it in Python last year although I can't remember why I did it... I just remember having to explain it to a peer during a peer-review at work.


Anyways, after I got Hello World to work in Scala's REPL (! - Only the third language I've decided to use that actually has a REPL out of the box!), I installed the plugins for IntelliJ and now have Hello World running there. It's getting kind of late now so I'll put off testing out Scala's GUI capabilities (it looks like it uses Swing, same as Java... I definitely prefer Cocoa/Cocoa Touch to Swing, but Cocoa isn't cross platform, so I'll have to settle for it.)

As oppose to C, Python, Ruby, Perl, Obj-C, C++ etc.

There is a difference between being able to use recursion, and only being able to use recursion. In a language that is not made explicitly for this it can lead to a stack overflow, because stack space is limited you know... I'm picking up Erlang at the moment. There are no loops.

But, please just use Google, it's a known and accepted category of languages starting with Lisp I guess, or perhaps Lambda calculus.

The functional aspects is almost missing the point of why I use it. It IS functional, but that isn't why I use it. I can do functional in C# just as easily by (ab)using LINQ. If I really wanted just a functional language I would use LISP or Haskell instead of Scala.

No, I use it because Scala is multi-paradigmatic. It supports OOP and Functional without any restriction in use and mixing of the two. I can use Functional when its best to solve a particular problem or OOP for another. In fact, I happen to think it supports OOP much better than Java does. The class syntax is less clunky for a start. In Scala it almost doesn't matter if its a function or an object, the semantics are exactly the same. There are some other niceties but the main reason is because it is so flexible.

Your argument for ease of use and distribution is out the door then IMO. The user needs to download Java from Oracle, install and restart their computer before they can install or run your application. Surely a native binary is more friendly.

You can use AOT for Windows, I'm not sure of any AOT Java compiler for Unix like systems. But even then AOT binaries are slow, they take just as long to start up as normal Java apps and you don't even get the benefit of improvements to the JVM.

Honestly, I would look at the OSS community, maybe even into the world of game engines and see how they do cross platform. They have a heck of a lot more experience with getting cross platform development easy than the OP would.
 
Last edited:
The functional aspects are almost a distraction of why I like to use it. It IS functional, but that isn't why I use it.

I have no opinion about Scala at all, my whole involvement in the argument comes from the claim that functional languages have no distinguishing features from any other language paradigm. I don't see how this turned into a language debate at all since it's largely irrelevant to the whole question of portability.

Honestly, I would look at the OSS community, maybe even into the world of game engines and see how they do cross platform. They have a heck of a lot more experience with getting cross platform development easy than you would.

Well, the part of OSS that I'm familiar with use make files that produce a native binary, perhaps a port and package manager is involved for each platform as well. Game engines are ported to the platforms they support. What's your point exactly, besides insinuating that I lack a heck of a lot of experience.
 
I don't see how this turned into a language debate at all since it's largely irrelevant to the whole question of portability.

Because I just had to go ahead and be enthusiastic about something only tangentially related. Darn me and my enthusiasm. ;) :D

Game engines are ported to the platforms they support. What's your point exactly,

We use a special modification of MVC to deal with making game engines cross platform, or as little dependence on the underlying base system as possible. To say that they're ported is not exactly correct.

Basically we we add the notion of an "Application Layer", it deals with the underlying hardware and the operating system. It takes messages and input from the OS and translates them into internal messages your business logic can use and visa versa. If you maintain good separation, this application layer is the only piece of software that actually needs to be rewritten for different platforms.

besides insinuating that I lack a heck of a lot of experience.

Sorry, that was a brain fart. Read the edit. I meant to say more experience than the OP would. I didn't mean to say you wouldn't have any cross platform dev experience.
 
Last edited:
As I've used Scala a bit more, I've become disillusioned. The syntax is the polar opposite of languages like Racket and Python, where they decided to heap in crap and create incredibly confusing rules (sometimes optional, required to be present, or required to be absent, semicolons, commas, and spaces), randomly swap out symbols (_ instead of *, () instead of [], and [] instead of <>). They try to say they have Swing and run in the JVM, but those are both half truths, because they decided to write wrappers for some Swing classes and then not others, and there's a lot of extra jars you'll have to include in your distribution, with all of the licenses associated.

And for what? Some compile time checks, a REPL, lambda functions, and easier singleton notation? Don't get me wrong - both of those are great things that Java and many other languages would hugely benefit from, but I think I'd rather use straight Java than this.

Or there's also Python...
 
Last edited:
As I've used Scala a bit more, I've become disillusioned. The syntax is the polar opposite of languages like Racket and Python, where they decided to heap in crap and create incredibly confusing rules (sometimes optional, required to be present, or required to be absent, semicolons, commas, and spaces), randomly swap out symbols (_ instead of *, () instead of [], and [] instead of <>). They try to say they have Swing and run in the JVM, but those are both half truths, because they decided to write wrappers for some Swing classes and then not others, and there's a lot of extra jars you'll have to include in your distribution, with all of the licenses associated.

And for what? Some compile time checks, a REPL, lambda functions, and easier singleton notation? Don't get me wrong - both of those are great things that Java and many other languages would hugely benefit from, but I think I'd rather use straight Java than this.

Or there's also Python...

That's cool man, you're allowed to think of it what you want.

Good luck with your file explorer, if it really is all that I could help with some of the Windows specific stuff.
 
Last edited:
I do not think that there is a good cross-platform way to do this. Different OSes differ in part how they handle files. I think that your best bet is to write some common high-level glue and then have platform-specific backends.
 
It is really easy - there is *NO* way to do good cross platform code, ever. It means always forfeiting the advatntages of the different platforms for the lowest common...
 
I started porting the code from Obj-C/Cocoa to Java/Swing last night. So far this is looking quite doable, although I'm spending a lot of time tinkering with Swing's graphics so that they'll more strongly resemble Cocoa than the OS X L&F does.

IE: the scrollbar that's normally hidden but fades in/out when you mouse over to it or when you start scrolling, and lacks a dedicated track or scroll buttons but instead just appears at the edge of the content you're scrolling. That's a particularly important behavior in keeping the UI clean and easy to read, I think.
 
We use a special modification of MVC to deal with making game engines cross platform, or as little dependence on the underlying base system as possible. To say that they're ported is not exactly correct.

of course, so what?

The point still stands, the platform provides a unifying API that abstracts away differences on the host platform. That means that application developers can code against the common API and get portability for free from the hosts that the platform is ported to. How portability of the platform itself is obtained is of no concern of the 'users' of the platform, the fact is that the platform is ported to different hosts, the 'how' is a off topic detail in this discussion.


Edit: I think I see what you are saying, look at (for example) game engines as an example of how portability can be achieved with native code, that is avoid host dependencies, aim for clean separation with MVC etc. I agree.
 
Last edited:
EG: the scrollbar that's normally hidden but fades in/out when you mouse over to it or when you start scrolling, and lacks a dedicated track or scroll buttons but instead just appears at the edge of the content you're scrolling. That's a particularly important behavior in keeping the UI clean and easy to read, I think.

You're going to do the exact same thing on Windows down the road dude.

If you want native look and feel, use the native UI library. Or consider something like Xamarin or SWT in a pinch.

Edit: I think I see what you are saying, look at (for example) game engines as an example of how portability can be achieved with native code, that is avoid host dependencies, aim for clean separation with MVC etc. I agree.

Yes that is what I meant.

It also means you don't have to have the lowest common denominator. You could just expose all possible operations you want, and change the behavior at run time by querying the Application Layer. This is how PC games usually do choosing between Keyboard/Mouse, Joystick, Gamepad etc for example.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.