views:

390

answers:

9

I'll start by saying I'm self-taught, everything I know I've picked up from programmers in the family, self interest and trial and error.

I'm currently reading Cocoa Programming for Mac OS X from Aaron Hillegass, but I'm unable to stay interested. I think the main reason I'm losing interest is the absence of the main reason I like Javascript and PHP, which is the overall portability that allows development, hosting and testing on any platform (I have Windows 7, Mac OS X and Linux). Coming up with a project - and therefore staying interested in the language - is much easier when I'm able to use it everywhere.

That said, my question is as simple as a request for information on cross platform languages (Java? C++?, * ), or perhaps some suggestions as to projects or methods that may keep me interested in a language long enough to actually be able to start making functional applications.

Edit

For clarification I'm looking for overall knowledge of a language rather than a specific API or Toolkit. From there I could learn toolkits, external libraries and other things as I progressed. The main problem right now is finding a language that is cross platform and preferably respected by the Stack Overflow community (hence posting this here, as this has been an extremely valuable tool for me in the past and I enjoy helping others when I can).

A: 

if you are looking for robust cross platform language for desktop i believe JAVA is the answer. However i am open to learn how python is better than java..

sushil bharwani
As am I, it hadn't really even crossed my mind as a possibility, so if anyone has more information on Python that'd be awesome.
Robert
http://wiki.python.org/moin/LanguageComparisons
aaa
@aaa carp: That's a really good read (I read vs. PHP). What do you think of it as compared to alternatives like Java and Qt as mentioned by Yuji?
Robert
@Rob I am not much familiar with those to comment, however you can program QT with python. just give Py try and see if you like it: http://docs.python.org/tutorial/introduction.html
aaa
+1  A: 

First, it's better for you to distinguish language and API/toolkits in your question.

  • On the one hand, there is a cross-platform language like C (it's not just cross-platform; it's ubiquitous!) but it doesn't translate to the ability to write a GUI app which can be compiled and runs on many systems.
  • On the other hand, there is a cross-platform GUI API/toolkitss like wxWidgets whose bindings are available in C++, python, perl.

Also, note that learning how to code in a language and learning how to use an API/toolkit are two different things. Even when you already know a language, learning how to use a toolkit can take months. It also happens if you already know a toolkit, you can basically grasp a new language in a week and start writing programs in that new language with the known toolkit easily.

Now, if your primary aim is to learn a new language, I don't think writing GUI apps is particularly a good way. Learning to use a toolkit is a bigger job in my personal opinion.

Instead, write a command-line program which manipulates text files. At that level, every language is mostly cross-platform; you can find on-line free implementations of most languages for most platform.

That said, if you want to write GUI apps, I would suggest Qt toolkit with C++. It works on most platforms. Google Earth is written with it.

Objective-C and Cocoa are a bad choice if you want portability.

Yuji
Yeah, the main reason I picked it up as that my girlfriend and I both have iPhones and the App Store seems like a great way for an independent developer to make a little money, although I don't suspect I'd be able to survive off that.
Robert
Per your recent edit, I'll update my question for clarification.
Robert
OK then I'll re-edit mine.
Yuji
A: 

How about XAML via Silverlight: declarative IU's with events, databinding, styles, etc. (and yes, you can build desktop apps with it thanks to its out-of-browser capabilities) It already runs on Windows, Mac, Windows Phone 7, and a Linux version is on the way (through the Moonlight project). As language you could use C# or F#, both run on Windows, and (via Mono) on Mac and Linux.

Edgar Sánchez
Isn't C# intended primarily for Windows? I know it _works_ on other operating systems, but that feels hackish and seems like a bad idea, like putting an engine on a shopping cart.
Robert
How is putting an engine on a a shopping cart a bad idea, sounds awesome to me!
Sayed Ibrahim Hashimi
Lol, I suppose if you built something like http://tinyurl.com/2cfrle6, but in my head I imagined someone going through Safeway, losing control and taking out little old ladies.
Robert
Check http://www.mono-project.com, C# runs all right in Linux and Mac, there's nothing in C# particular or specific to Windows. And, by the way, stackoverflow.com itself is written in C# :p.
Edgar Sánchez
@Edgar not going against c# as an option, but 'there's nothing in C# particular or specific to Windows', is not exactly truth.
eglasius
+3  A: 

I think Ruby is a good idea. It's very different from Java but not soo much that you will not be able to grasp the concepts. Also it is an easy language to learn. Once you learn Ruby, you'll keep thinking of it.

Sayed Ibrahim Hashimi
Downloading Ruby right now to go through a couple pages of the introduction as I did for Python. I suspect with many of the suggestions I won't really personally see a difference in convenience or portability until becoming much more comfortable. Python seems to be a popular alternative, what distinguishes Ruby from Python?
Robert
A: 

Please don't laugh when I say "JavaScript". I really mean it. Every modern browser supports it, and it is perfectly cross-platform.

OTZ
I'm already fairly comfortable with Javascript, I'm looking for something to be run on a desktop though, without the need of a browser.
Robert
you can install a javascript interpreter by itself without depending on a browser. there are many.
OTZ
So an interpreter would allow it to run as a desktop application, GUI and all?
Robert
@Robert Yes. Take a look at XULRunner and Cappuccino
adib
if there is a javascript binding. or u could build a GUI app on a browser like firefox or chrome using javascript. if you don't wanna go thru that route, stick with python. You can't go wrong with Python, really.
OTZ
+2  A: 

If you want to go from idea to running software at speed of light, I recommend Python. Cross platform, mature, with a powerful and strong community, tons of tutorials, tested across industries, innumerable libraries and, most of all, a beautiful language.

Now, if you want to understand computers and develop slower, but write killer cross platform applications, then the only answer is C.

If you are metrosexual learn Haskell. ( just kidding - it is actually very elegant, sophisticated, and smart though)

Good luck.

Ps. In reality, it all depends what you want to do. C is awesome but it won't help you make a website in a reasonable amount of time. Python is beautiful, but I dont do large scale math in it. Haskell is a nut I'm yet to crack.

Arrieta
+3  A: 

The word desktop also implicitly say that the application should deliver a level of user-experience that exceeds with what a web-based solution can offer. If this is your case, using a cross-platform language to write your application will not be a good idea. Cross-platform tools tend to bring the functionality down to the lowest common denominator that's available in all of the platforms that they support and thus you might as well write a web-based application anyway and get cross-platform capability "for free".

It would be best when writing desktop applications that you make the decision in this order:

  1. Can a web-only solution support most the functionalities of the application?
  2. Which desktop platform to target?
  3. What is the most supported programming language of the platform for GUI programming?

When you have an answer for question #2, the answer for #3 is not too difficult

  • Windows -- C# & WinForms
  • Mac OS X -- Objective-C & Cocoa
  • Linux -- C/C++ & GTK+

If you still insist on cross-platform desktop GUI application, your best bet is still Java & Swing or maybe SWT.

adib
I'm not really looking to build graphically or processor intent applications, but performance is a factor, albeit one of the smaller ones. I would still think that a native desktop application would run better than an equally designed product in Internet Explorer, no?
Robert
@Robert - performance is not the only reason why someone wants to go "native" (in this context, the most supported GUI library by the OS Vendor or community). Desktop integration is another feature. This may be more relevant in Mac OS X since the users tend to expect tight integration with the OS for desktop applications.
adib
+1  A: 

I happen to think that Tcl is a reasonable language to use for cross-platform programming. You can do some pretty neat stuff just with the language itself (e.g., it comes with very strong support for event-based programming and asynchronous I/O, making doing things like writing network code really simple) and there are some good add-on packages for things like GUIs (Tk with the ttk widget set can look really good on both OSX and Windows, and Tcl is its native language) databases (did you know that SQLite started life as a Tcl package?) and interaction with gnarly old programs (the Expect package for Tcl is the original and best). What's more, there's a really truly kick-ass deployment technology available for Tcl too; by building your app into a starkit, you can trivially make it available to many platforms at once, or you can bind it straight to a runtime and deliver a single-file executable solution that it's easy for you to maintain.

I suppose the main thing to watch out for with any language is file handling though. The problem is that this is an area where platform-specific details tend to leak in first; even leaving aside the issue of whether it is / or \, Windows, OSX and traditional Unix all tend to arrange critical parts of their systems in very different ways. While I happen to think that Tcl does a good job here too (balanced between abstracting too little and too much) it's still an area where it is possible to trip up.

Of course, to be fair I must also mention that Tcl's value model is rather different from that used by most other languages. In particular, it focusses on the use of immutable values with all type information made fully manifest; all mutability is concentrated around modifying the contents of variables. (The implementation is more efficient than that, doing reference sharing, type mutation, and in-place updates when it does not affect the official semantics, or copy-on-write otherwise. But that's an implementation detail; the only way it needs to concern you is when you realize that your code goes faster than you expected, and that's Good.)

Donal Fellows
A: 

My answer would pretty much be Haskell, but others are worth to be known, too. I know many languages and their disabilities.

Most important to me are the following abilities..

  • to develop programs fast
  • compile to fast running programs
  • be platform independent
  • read and understand undocumented source easily
  • function-names and -types suffice as documentation
  • no frustration

To me, Python (like most languages) does NOT answer the first ability, because I want bugfree programs! Im most languages, the development automatically implies the effort to test the program many times. In Haskell, I just try to compile... as soon as it compiles, I feel pretty sure, that every single test will definitely show a bug iff there exist a bug. That means: either it crashes immediately, or it shows an obvious mistake in design, or it runs bugfree. I know Haskell at least since 2002, and I did never have to write a testcase. To test it, the interactive interpreter suffices. It takes longer to make my code compile than to test it.

My last bug (the only bug I remember), was in the NFS-Proxy I programmed in my Diploma-Thesis (=Master-Thesis) in Haskell. It took many hours to find it, and it was a thread that killed itself while updating a global variable to the "NoThreadRunning" value, which was –of course– protected by a semaphor. (To have managed to shoot oneself in the foot in such a way, did feel like winning the lottery, yeah.) I did design it correct, changed half of the design, and was proud of the automatic self-killing-and-respawn mechanism until the first test two or three months of programming later. But after the fix, it worked bugfree as NFS-Client and NFS-Server with file-distribution over multicast.

Other languages:

  • C : relative platform independent, but you need to use the std-libs to manage big-/little-endian and 32-/64-bit sizes. It is very very hardware-near, I know only about C-- to be more hardware-near without being assembler. Libraries should be at least made accessible via C to be relative language-agnostic.
  • C++ : definitely better than Java. You don't want a garbage collector if you don't need it. C++ has more type-safety and bug-avoidance-design-patterns than most languages (see books from Scott Meyers, http://www.aristeia.com/books.html).
  • Java : You combine C++ with slow-to-recover diseases and you get Java. Obtruded garbage collector where you don't want it, half-OOP, less type-safety than C with its praeprocessor-makros (or still recovering), instead of references pointers everywhere (called references, can still be a NULL-pointer in contrast to c++-references) and therefore NULL-pointer-exceptions, OOP design even where it should not be, no "proper tail calls" (epic fail in the design of Java Byte Code) and therefore stack-overflow-exceptions. The frustration level is extremely high.
  • CommonLisp/Scheme : Yeah, that's old. It was designed about 50 years ago to proof that it is possible to program in such an abstract way that you do not see the RAM-machine and its assembler below. ProgramCode equals Data, Procedures are Lists of Commands, and you can manipulate Lists because they are data structures itself. This is the foundation of all functional programming languages. The imperative languages did not develop much since then, they are still based upon if+while+for(+goto) and variable-assignments, which is really poor for languages that do not aim for embedded systems like microcontrollers. Anyway, ancient Lisp was not developed to program in and therefore looks pretty ugly. Still, easiest language to learn, not easy to master.
  • Erlang : nice scripting language, easy to learn, easy to program multi-threaded (but single-processor) server-programs. It is interpreted and the program code can be exchanged even while the program is running! It is functional and as easy as Python.
  • Python : a scripting language that replaces BASH in many ways. It can't be really compiled due to its dynamic types. It was influenced by many functional languages and therefore can juggle with functions better than C/C++/Java. Dynamic types have been the solution to fast prototyping, decades ago: You need to write less code, if the type-correctness is performed in runtime instead of compiletime, because you do not need to specify the types in your code.
  • ECMAScript(JavaScript, Adobe ActionScript etc.) : They do have not only OOP but Closures, too, so that they can be used for functional programming. Well, not really because functional programming urges to use tail calls, and ECMAScript (like java) does not have proper tail calls at all. And because no browser supports the programs with infinite stack space, it is one of those Stack-Overflow-Exception languages. The proposal for including proper tail calls in the language definition has poor chances because with that new feature the existing interpreters and jit-compilers need too much redesign.
  • Lua : OOP and Closures and proper-tail-calls! Well, it has a good design and allows to influence the code/language itself somehow like Lisp can redesign itself. The language is designed with the goal to be used as scripting language embedded into other programs (like games or browsers or graphic-/3d-/CAD-editors), and it seems to be perfect for that goal. I did not program enough in this language to know how easy it is to learn, because to me it is just not "pure functional" enough.
  • Pascal(Obsolete)/Delphi(Borland/Windows only) : It was better than C++, before C++ had templates: Pascal did have explicit typing and explicit casting. It was the time when scripting languages with dynamic types were faster written because they did not need explicit written types. C/C++/Java have implicit casting, which makes them more bug-prone. Pascal had/has double-sized function-pointers in contrast to C/C++/Java, because they did not only contain the pointer to the function-code but also a pointer to the stack frame of the "outer" function; which implies that functions can be nested and have something similar to Closures. (A function has access to the local variables of its outer function, and a pointer to an inner function is only valid as long as its outer function is running.)
  • Visual-C++ : It is not C++, but it looks like ("visual"). It has or had many design flaws, like [code]for(a,b,c)d;[/code] === [code]a;while(b){d;c;}[/code] instead of additional putting everything in curly brackets; the difference is the range where the "a" is defined. The solution to that was this line of code: [code]#define for if(0)(void)0;else for[/code] Not everything was implemented in the compiler, like static floats in class-templates (only integral types allowed) as if they were confounded with template-variables. Next problem: Template-variables can be classes which have not only member-variables and -functions but also inner classes/typedefs. In the case of such a type, the compiler needs to know that it is a type, therefore the c++-keyword "typename" is needed. In Visual-C++ this was not properly checked and therefore caused compile-time errors when using apis that did compile before; not used templates weren't checked properly.
  • Haskell : Yeah, well, what should I say... I'm still learning it. 7 Years are not enough to properly know all features and language-extensions and the mathematical Cathegory-Theory behind it. Everything else looks like an assembler frontend, compared to Haskell. The type-casting is explicit (functions are needed to convert) and therefore pretty safe. Like in dynamic typed languages the types do not need to be written explicit, but they are implicit and strong typed instead of dynamic/weak. The type system in Haskell is Touring-mighty and more expressive and easier than the templates in C++ (and D).

If you like to learn some languages, I recommend learning (in this order) any Lisp/Scheme, Python, Prolog, OCaml, then Lisp again in not more than 1-3 days each. Those languages are extremely different and will form your way of thinking. C++ at least 1 week with Bjarne Stroustrup's book (he is the inventor of C++) and Scott Meyers' books, and then Haskell for about 1 month with "The Craft of Functional Programming". From then on only Haskell and C++. After one year of learning Haskell and writing your own tutorial about Monads, you can call yourself a beginner.

Oh, and at first read this: Beating the Averages (paulgraham.com/avg.html) It explains why the most used programming languages are not the best, and how to become rich.

comonad