News for hackers. Stuff that matters.
Re:Building OS X Apps with JavaScript by warcher on Sunday September 28, 2014 @07:40AM (#8379484)
You know, I understand the urge, once one has really gotten deep and mastered their first language, to try to apply it everywhere. But I really must strongly encourage the kids on the come-up to continue mastering new tools. It's not that javascript is a bad language (although that helps), so much as the industry doesn't allow any of us to rest on our laurels. This year's rock star is tomorrow's dinosaur.
Re:Building OS X Apps with JavaScript by tomjen3 on Sunday September 28, 2014 @09:19AM (#8379652)
You are looking at a wrong problem. This isn't one language beginners as much as it is a desire not to write code twice for two platforms. Even cheap software developers are expensive, so it make sense to not make them do the same work twice.
Re:Building OS X Apps with JavaScript by marknutter on Sunday September 28, 2014 @07:58AM (#8379511)
Great. Now master Java, C#, and Objective-C to build the same app on multiple platforms. JavaScript is the only language that let's you target every platform.
Re:Building OS X Apps with JavaScript by zoomerang on Sunday September 28, 2014 @08:22AM (#8379555)
> JavaScript is the only language that let's you target every platform

Ironically, the three languages you listed - Java, C#, and Objective-C are all available on all major platforms. I could write code in any of those languages and have it run on

  - Windows
  - MacOS
  - Linux
  - Android
  - iOS
Furthermore, the apps would all be native. That closest Javascript can come is to use the uncanny-valley of HTML5 without native widgets or performance.

Frankly, Given that the burden of learning a new language is tiny, I see no reason why we should try and cram Javascript into every nook and cranny. It's a fairly mediocre language at best.

tl;dr The three languages you listed are all capable of better cross platform support than Javascript.

Re:Building OS X Apps with JavaScript by taf2 on Sunday September 28, 2014 @11:12AM (#8379915)
Really? Seems like HTML/JS is the best choice for cross platform application development. These days with Chrome, Firefox and even Safari you can create really full featured applications. The new HTML5 API's are incredibly full featured. Just the other day I created an App for my daughter to helper her login to her school computers - so I decided to create a login screen and then I realized with HTML5 audio API, I can also read aloud each key press as well as an intro text so even though she can't read yet she can use the App. It's 100% JS and HTML/CSS for UI.

At my job we spend thousands of hours building our native App for Android and IOS for work and it's painful - when I can open the browser and nearly all the capabilities are in browser and the browser already cleanly abstracts the process of editing UI via HTML/CSS. I've yet to find another UI framework as powerful or quick to develop in as HTML/CSS - and the performance is looking really good in the browser. Native app performance is a myth unless maybe you're writing a video game?

Re:Building OS X Apps with JavaScript by vertex-four on Sunday September 28, 2014 @11:39AM (#8379991)
> I've yet to find another UI framework as powerful or quick to develop in as HTML/CSS - and the performance is looking really good in the browser.

Really? Until a couple of months ago with the advent of flexbox, you couldn't reliably do columns that fit dynamically to the browser window (frameworks like Bootstrap simply define three different window sizes and switch between them, rather than allowing for fluid resizing) as well as you can in every other UI framework I've used, never mind vertical layout. (See all the hacks for "sticky footers" over the past decade.)

Re:Building OS X Apps with JavaScript by zoomerang on Sunday September 28, 2014 @06:46PM (#8381106)
"Quick" - sure. HTML5 lets you spin up UIs fairly quickly.

"Powerful" - I'm not so sure. Generally I find native toolkits, while requiring a bit more effort up front, generally yield much nicer user experiences.

Re:Building OS X Apps with JavaScript by woah on Sunday September 28, 2014 @12:07PM (#8380073)
It may not be powerful, but it is quick to develop in.
Re:Building OS X Apps with JavaScript by pjmlp on Sunday September 28, 2014 @01:29PM (#8380318)
If all you know is web related stuff.
Re:Building OS X Apps with JavaScript by zoomerang on Sunday September 28, 2014 @06:45PM (#8381105)
For simple apps, HTML5 works fairly well. But you quickly run into problems.

My company has been working on a cross mobile application in HTML5 using Cordova. It was quick to prototype, but as we scaled up we started hitting the limitations of the platform very quickly.

The main issue is that every single mobile device has a slightly different rendering engine. Even two different Android phones from the same manufacturer will behave slightly differently. If you're making a simple CRUD app, this probably won't affect you - but once you reach a moderate level of complexity you spend more time playing whackamole fixing bugs and testing on every possible combination of devices.

We're currently rewriting as pure native across all platforms, since it works out to be less effort in the long run.

This is on top of the obvious limitations of HTML5 - Performance is never quite there for anything other than trivial tech demos, and the lack of native widgets mean your users will have that "uncanny valley" experience where it doesn't quite feel right.

tl;dr HTML5 is ok for prototyping and simple apps, but doesn't scale well. Ditto for Javascript.

Re:Building OS X Apps with JavaScript by doublerebel on Sunday September 28, 2014 @11:19AM (#8379937)
Actually, JavaScript can create native controls and calls on all of those platforms through an API layer, using a framework such as Titanium. JavaScript has not been limited to webviews for at least 5 years now.

Many Gnome (Linux) apps original language is JavaScript (GJS). iOS 7 came with a JS API. It is such a powerful language for async and UI design that it adapts well to all these platforms.

Re:Building OS X Apps with JavaScript by radmuzom on Sunday September 28, 2014 @08:30AM (#8379567)
Can you write Java applications for Windows Phone 8? (without buying a third party software which allows you to do so)
Re:Building OS X Apps with JavaScript by zoomerang on Sunday September 28, 2014 @08:42AM (#8379584)
Yes. Java can be compiled to native machine code via GCJ, and can expose a normal C++ Api.

Whether you'd want to do this or not is another story. C# and Xamarin would be a far better choice for a one-size-fits-all cross platform codebase.

Re:Building OS X Apps with JavaScript by pjmlp on Sunday September 28, 2014 @08:33AM (#8379574)
No, but you can in C and C++.

Not only that, certain APIs are only available if you use them.

Re:Building OS X Apps with JavaScript by MrScruff on Sunday September 28, 2014 @08:02AM (#8379518)
The overhead of learning a new language is pretty small. The overhead of learning a new framework is much bigger.
Re:Building OS X Apps with JavaScript by pjmlp on Sunday September 28, 2014 @08:32AM (#8379572)
Well, C and C++ come to mind.