Reflection and Prototyping in JS

Prototyping in java script is nothing but act as an Java Interface. Meaning it’s used to define the methods of the object.

 

 

Reflection in java script is used to observe the content of the object. As for modification we can use method expansion:

ex.:

<p style=”line-height: 18px; font-size: 18px; font-family: times;”>
Click “<i>Load samples</i>” to view and edit more JS samples.<br>

function display(p) {

if (p.hasOwnProperty(‘name’)) {
p.name.lastname = ‘Terry’;
alert(p.name.firstname);
}
}

var person = { combinedname: { fistname: ‘John’ }};
display(person);

</p>

Interesting things about JavaScript

1. If we assign value to an object’s property that doesn’t exist, then it the object itself will be augmented and property will be added

ex.:  stooge[‘first-name’] = ‘Jerome’;

2.  Functions can be passed as arguments to functions, and functions can be returned from functions. Also, since functions are objects, functions can have methods.

3.  An inner function also enjoys access to the parameters and variables of the functions it is nested within.

4.  In addition to the declared parameters, every function receives two additional parameters: this and arguments

5.  A function always returns a value. If the return value is not specified, then undefined
is returned

 

Function Invocation:

There are four patterns of invocation in JavaScript: the method invocation pattern, the function invocation pattern, the constructor invocation pattern, and the apply invocation pattern. The patterns differ in how the bonus parameter this is initialized.

How to speed up the maven builds

This article has good tips how to increase the build time using maven:

https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/

 

I’ve addapted it for the IntelliJ idea IDE:

In short, for IntelliJ Idea change the following

in parameters add(inside the Run/Debug Configurations):

install -DskipTests=true -offline

it’s better to use install instead of the clean install because most of the time clean is not required, -DskipTests=true will skip the tests and -offline won’t download any snapshots that already exists.

in General, in Threads (-T option) add 1C, this means that each core will dedicate one thread  for building

In Runner, in the VM options add:

-XX:+TieredCompilation -XX:TieredStopAtLevel=1

this is the Java VM options for speeding up the build

Alternatively, you can add the only project that you actually need

Ex: instead of install -DskipTests=true -offline use

install  –pl YOUR_MODULE -am -DskipTests=true -offline

pl makes Maven build only specified modules and not the whole project.

am makes Maven figure out what modules out target depends on and build them too.