• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modern JavaScript for the Impatient: To What Extent Java and JavaScript are Interchangeable?

 
Rancher
Posts: 129
15
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Cay,

At first, I though JavaScript is a web language only works with HTML. However, recently, my project uses Mirth Connect, a software that uses JavaScript to consume and process real time hospital messages, and stores them into databases. It looks like JavaScript can do much more than what I expected before (though I still use Java classes in the JavaScript code which is my bad).

My question is, to what extent do you think Java and JavaScript are interchangeable? Where are they not interchangeable? By the way, share a picture I just found from this site (link).

 
author
Posts: 284
35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frank,

when Java first became prominent, tech journalists bugged a product lead at Sun with the question when XML would replace Java. His answer: "That's a bit like comparing apples to hand grenades."

Of course, both JavaScript and Java are Turing-complete. So they are theoretically interchangeable. But really, it all depends on your ecosystem. If you need to work with JavaScript tools, then yes, there is a whole toolchain that lets you do everything that you know how to do in Java: connect to databases, read and write files, interact with cloud APIs, etc. You then have to weigh the tradeoffs. For example, Java has a standard way of dealing with relational databases; JavaScript, a dozen ad-hoc ones. Does that matter to you? It may or may not, depending on your project. There is no one answer.

Cheers,

Cay
 
Frank Mi
Rancher
Posts: 129
15
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Cay! You answer helped me a lot.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'Ware tangent.
By the way, CH, congratulations on your elevation to Rancher status
 
Cay Horstmann
author
Posts: 284
35
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rancher? Woohoo, my dream has become true.

Cheers,

Cay
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cay Horstmann wrote:when Java first became prominent, tech journalists bugged a product lead at Sun with the question when XML would replace Java. His answer: "That's a bit like comparing apples to hand grenades."





Frank, Your cartoon is on the nose. You can eat ham or hamsters (I suppose - guinea pigs make good pizza toppings they say). But you wouldn't prepare them the same way, the flavour would be very different, and even the quantity required would vary. What type of wine pairs with hamster, I wonder?

In truth, if both languages weren't based on C-style syntax, you'd have a hard time seeing them as interchangeable at all. Functionally, perhaps, but then, functionally, COBOL or LISP could be interchanged. At a price.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cay Horstmann wrote:Rancher . . . Cheers . . .

Think nothing of it.
 
Frank Mi
Rancher
Posts: 129
15
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your explanation, Tim.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:What type of wine pairs with hamster, I wonder?



I was sure the web would have an answer for this question. But surprisingly, nobody has considered it and posted on the web yet.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:. . . I was sure the web would have an answer . . . nobody has . . . posted on the web yet.

Of course they have, but it's spelt wrongly. Look here, and find No 1, the best wine for hamster: Gewürtztraminster.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Paul Clapham wrote:. . . I was sure the web would have an answer . . . nobody has . . . posted on the web yet.

Of course they have, but it's spelt wrongly. Look here, and find No 1, the best wine for hamster: Gewürtztraminster.



That's for ham, not hamster, though.

Incidentally, "hamsterer" is the German word for "hoarder". Both words appear to have come from the same root.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, hamstern means hoard or store, presumably related to the hamster's voluminous cheeks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic