Monday, May 4, 2020

We continue with our discussion on Java vs Kotlin


One of the best advantages of using Kotlin code is its ability to invoke JavaScript consider the equivalence in ASP. NET programming where the server side could invoke JavaScript. Theree were limitations to what the server could execute that the client cannot but overall the facility was widely appreciated because it gave the convenience of not being limited by resources. The server side was always heavy duty and had better hooks than client side. The server side also provided the ability to run custom controls and the ability to allow seamless debugging.

There were a few requirements of invoking JavaScript in languages like Kotlin that doesn’t change. These include:

Specifying keywords to denote external code implementation in JavaScript

Allowing inheritance and static membership.

Ability to proxy and extend the implementation with extension classes by giving it the same level of representation as first class citizens of Kotlin.

Ability to bridge the programming paradigm of Javascript with the functional languages. For example, Kotlin does not support dynamic types when targeting ‘jvm’ plugin type

Ability to perform code access security when running in server mode

Ability to maintain strict level for JavaScript consistency and canonicalization of logic expressed in JavaScript

Support for the numerous frameworks and plug-ins that JavaScript comes with. For example, Json with padding provides a method to request data from a server in a different domain. This was previously prohibhited to ensure same origin policy but has since been addressed with Cross-Origin resource sharing (CORS). This way JsonP helps with script element injection or reuse of an existing one. CORS may improve security but JsonP improves functionality providing different purposes and need to run with the language support.

No comments:

Post a Comment