Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Foreman
Posts: 69
8
  • Mark post as helpful
  • send pies
  • 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
32
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
Ranch Foreman
Posts: 69
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Cay! You answer helped me a lot.
 
Marshal
Posts: 70260
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'Ware tangent.
By the way, CH, congratulations on your elevation to Rancher status
 
Cay Horstmann
author
Posts: 284
32
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rancher? Woohoo, my dream has become true.

Cheers,

Cay
 
Saloon Keeper
Posts: 22492
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 70260
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Think nothing of it.
 
Frank Mi
Ranch Foreman
Posts: 69
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your explanation, Tim.
 
Marshal
Posts: 25815
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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: 70260
282
  • Mark post as helpful
  • send pies
  • 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: 22492
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • 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: 70260
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, hamstern means hoard or store, presumably related to the hamster's voluminous cheeks.
 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic