
Ask HN: Good languages for closed-source desktop apps - bendmorris
Just wanted to get some opinions on this - if your goal is to write closed source, cross platform desktop apps, what are some good languages to consider?<p>I'm looking for a high-level, efficient language, but it needs to be able to compile to machine code. For example, while I love Python, I would eliminate it here because an app "frozen" by cx_freeze or py2exe can be decompiled into source without too much effort.
======
nostrademons
I would give up on "cross platform" desktop apps and use whatever the native
language is for the platform. For Windows, that's C#/.NET. For Mac, Objective
C/Cocoa. For Linux, probably C/Gtk or C++/Qt.

The problem with cross-platform apps is that you end up programming to the
least common denominator of the platforms you support, and your app never has
the performance or look & feel that users expect. Contrast: uTorrent vs.
Azureus, iChat vs. Pidgin, TextMate vs. jEdit, etc. In a hyper-competitive
desktop space, that often means death. Giant companies like IBM (Eclipse) or
Mozilla (Firefox) can get away with it because the scale of what they're doing
is very difficult for a small startup to replicate, but most micro-ISVs can't.

Yes, this is one reason why developing desktop apps sucks.

~~~
andrewtbham
I agree with everything nostrademons is saying, cross platfrom apps are bad. I
did some java desktop apps about 4 or 5 years ago and the ui was awful. i
think it's gotten a little better... but still, native app is going to look
far superior.

~~~
patio11
And that might even matter for some audiences. It doesn't for all of them: BCC
had 2x the conversion for installations on Mac (where it is, ahem, distinctly
non-native) relative to Windows.

~~~
nostrademons
Whether it matters depends a lot on how competitive the market is. If your app
is head and shoulders above the competition in functionality, users will put
up with a little UI ugliness. If most of the apps in your market basically do
everything the user wants, they're going to decide based on what is
prettiest/most responsive, which is usually the native app.

I still remember discovering uTorrent. I'd tried about 4-5 Bittorrent apps
before then, including 3 wxPython-based ones and Azureus. They also basically
did what I needed - they let me download, they let me keep track of existing
transfers, and they let me throttle bandwidth. The difference was that
uTorrent didn't take up a few hundred megs of RAM and didn't peg my CPU. The
developer accomplished this by doing an end-run around all the layers of
abstraction and keeping an eye on performance; it's much harder to do this
with a cross-platform library in the way.

------
patio11
If you put a gun to my head and told me "Write another desktop app", I'd tell
you "Java", but you'd have to put a gun to my head. Balsamiq has also sold me
on AIR. Unless you have a specific business requirement for it being on the
desktop, though, the web _overwhelmingly_ favors your interests as a
businessman.

Thoughts on this at length are on my blog -- and if anything, a year later I
believe everything here more strongly:
[http://www.kalzumeus.com/2009/09/05/desktop-aps-versus-
web-a...](http://www.kalzumeus.com/2009/09/05/desktop-aps-versus-web-apps/)

With specific reference to decompiling your source code: it doesn't matter,
because a) your application will be pirated anyhow and b) there is no
difference to the end user the mechanism by which the pirated version works.
Also, you shouldn't be worried about piracy unless you're selling to twenty-
something white and Asian males, in which case piracy is one of many business-
sinking problems you have. (If you're really worried about piracy, can I
recommend web apps again, or at the least an integrated server component?
Pirating the client lets you pirate the application like downloading Firefox
lets you pirate Basecamp.)

~~~
bendmorris
Your article was an excellent read, so thanks for the link. I generally agree
with a lot of what you're saying.

My potential audience is pretty targeted - mainly research scientists and
possibly some government workers. They'll likely be more computer savvy than
the average user (on average, at least - some scientists I know are just as
bad as Grandma.) What I worry about in considering a web app is:

1 - People want to be able to run the software anywhere, any time, without a
connection to the internet.

2 - When entering large amounts of data, which is potentially sensitive, into
an application, it seems like people would trust a desktop app more.

Number 2 is subjective, but as a scientist myself, I would feel better about a
program running on my own machine.

Any thoughts?

~~~
rmc
The latest version of HTML has the ability to do offline apps. i.e. you write
your application in Javascript as a webapp, and it can run offline. You can
store data locally in the browser and get javascript notifications when you
are back online so you can sync.

------
gdl
Machine code can be decompiled too, even if not as cleanly. It would slow down
efforts to make an unauthorized fork of the software as a whole, but anyone
curious enough about individual bits and pieces could still see exactly what's
happening. Closed source is really more of a legal block than a technical one.

Given that and the lack of popular, high-level languages that compile to
machine code (C++ is the best I can come up with), I'd reconsider whether
that's really a priority.

~~~
bendmorris
True that any program can be reverse engineered. But for example with Python,
you're not just handing them the program, but also the bytecode, which can be
turned into source without spending much time. This gives a lot more
information much faster.

I would prefer something like C++ which is about as obfuscated as you're going
to get, but I'm curious if there are any higher level options that would save
programming time.

~~~
danieldk
Some, they are usually more obscure, e.g.:

\- D

\- Haskell

\- OCaml

\- Various Scheme/Common Lisp compilers

Some of them have Qt bindings (e.g. QtD and QtHaskell). Though it may be
harder to hire programmers for any of these languages.

------
ecommando
I personally like C#.

If you use Gtk for the GUI, it's cross platform using Mono. Lots of closed and
open source widgets, easy to write your own, and runs very quickly.

IMHO, the networking stack in C# is much more robust and provides better
performance than in Java, and you can static link the runtimes to the app,
making deployment of installer-free apps relatively easy using embedded
resources.

Cheers! Randy

------
cookiecaper
High-level languages are hard to obfuscate. If you're going for difficulty in
decompilation, you're pretty much stuck to low-level, non-interpreted
languages.

.NET and Java are your best bets for relatively high-level desktop languages
that are hard to decompile because since they're so widely used, obfuscation
techniques are more advanced. But really if you want to create a difficult-to-
decompile program, I think you're pretty much stuck with C or other non-
interpreted, low-level languages (maybe try D?).

------
Vargas
C++ and QT

<http://qt.nokia.com/>

------
malkia
LispWorks with CAPI, here is some software written with it:
<http://weitz.de/regex-coach/> <http://www.netfonds.no/manual_pt_eng.php>
<http://lisp.ystok.ru/ygrid/index.html> or check on their page -
<http://www.lispworks.com/success-stories/index.html> I've started doing some
small Perforce p4win clone in it - github.com/malkia/p4bee - it contains
source code and binaries.

~~~
mahmud
He might need to take a year off to master Common Lisp though.

Dunno, a year off sounds nice, but you don't need to wait that long to be
competitive. Better find a GUI and an obfuscation solution for a language you
_already_ know now, than to dick around with new languages when you have a
product to finish and ship.

If I must. I would do the app in Python or whatever, then spend 2-3 weeks
designing my own custom loader. Some C-based stub code packer that load a
python interpreter as a shared library then my code. Wrap everything up with
some compression and verify integrity with some crypto.

Nearly every embedded scripting language can be shoe-horned with custom packer
like this that looks a lot like Java's ClassLoader. If you want to take this
to its engineering extreme, you might even be able to get remote binary update
functionality, by fetching packed tarballs of new code from your server, after
the necessary key exchange.

~~~
bendmorris
Sounds cool. Any examples of people who have done something similar?

~~~
mahmud
I used to crack sharewares and commercial apps as a kid. Of course I _haven't_
seen anything like that, nope, no sah!

[Edit:

Ok, I have started hacking something up as proof of concept. Leave an email in
your profile or shoot me one.

]

~~~
bendmorris
Put my email in my profile - I'm interested to see it.

------
yawniek
Why not use cython and do only the sensitive stuff in c?

It is really interesting that the gui problem still isn't solved after so many
years. Personally i think microsoft made the right thing by really decoupling
design from code. I'm not using windows tough...

------
mfinas
Freepascal + Lazarus for win/mac/linux desktop apps, if you dig pascal
language.

------
pshc
Haskell is high-level, fast, and its optimized machine code would be nigh
impossible to decompile in my opinion. Unfortunately it'd be a bit of a
stretch to write a large GUI app in Haskell at this point...

~~~
wtracy
I know there's GTk+ bindings for Haskell. I don't know if there's any others.

Can anyone comment on the quality of the GTk+ bindings, or the existence of
any other bindings?

I have enough experience with GTk+ from C and Python to say that it creates
really nice, snappy UIs under Linux, but it's really hard to make it "feel
right" under Windows, and pretty much impossible to make it "feel right" under
OS X. On those platforms, it will almost always stand out the same way that
Java apps do.

I'll also say that Haskell, while awesome, is a PITA to learn.

~~~
Zak
I believe the Haskell interface to wxWidgets is reasonably mature and widely-
used (as Haskell libraries go).

------
woan
If it's for Windows only WPF/Silverlight in C# is probably the most productive
platform.

------
andrewtbham
if you do go with the java desktop app, use the absolute layout. those complex
layouts were very difficult to change.

------
gte910h
Python + Titanium from Appcelerator

Air

Python + QT

~~~
mahmud
PyQt is nice, but damn, the other two are ugly slow dogs.

I just removed Air yesterday, and Appcelerator needs a bit more work.

~~~
gte910h
Air isn't the snappiest, but it works, and you can easily hire programmers to
continue developing in it.

Appcelerator I'm less certain on, but they do seem to keep tossing effort at
things.

------
alexkay
_> I'm a Linux guy at heart_

If you are going to use GTK+, take a look at Vala [1]. It's a C#-like language
which is compiled into C. Much saner than coding in C. You can easily port
your app to Windows/OSX, but, as others noted, non-native UI will be far from
perfect.

I'm using this approach in an open-source project of mine [2], feel free to
borrow the ideas.

[1] <http://live.gnome.org/Vala>

[2] <http://www.spek-project.org/>

