Sunday 7 April 2019

WHAT IS NEW IN JAVA 12 ?

Yes, you read right. JDK 12 was released on March 19, 2019.

This post of what's going to become Java 12, and, obviously, this post can expand and alter over time, till the event of Java twelve is frozen probably at the end of 2018.
I am about to update this post once a brand new feature (JEP) is targeted for JDK twelve, or once there's a very important update on the already targeted JEP.

 Among others, Java 12 includes a number of new features, such as:
  • JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
  • JEP 230: Microbenchmark Suite
  • JEP 325: Switch Expressions 
  • JEP 334: JVM Constants API
  • JEP 340: One AArch64 Port, Not Two
  • JEP 341: Default CDS Archives
  • JEP 344: Abortable Mixed Collections for G1
  • JEP 346: Promptly Return Unused Committed Memory from G1


JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
It is enforced and supported by RedHat for aarch64 and amd64, Shenandoah dustman, represented during this paper, provides foreseeable and short Gc pauses freelance of the heap size.

JEP 230: Microbenchmark Suite:
Away, and a collection of microbenchmarks, to simply take a look at the performance of JDK, supported Java Microbenchmark Harness (JMH) are additional to JDK ASCII text file.

JEP 325: Switch Expressions 

There are two main changes to switch in Java 12:


  1. Introduction of case L -> syntax that removes the need for break statements, because only the statements next to -> is executed.
  2. The switch can be an expression, so it can have a value, or it can return a value.


JEP 334: JVM Constants API

Define a family of value-based symbolic reference (JVMS 5.1) types, in the new package java.lang.invoke.constant, capable of describing each kind of loadable constant. A symbolic reference describes a loadable constant in purely nominal form, separate from class loading or accessibility context. Some classes can act as their own symbolic references (e.g., String); for linkable constants, we define a family of symbolic reference types (ClassDesc, MethodTypeDesc, MethodHandleDesc, and DynamicConstantDesc) that contain the nominal information to describe these constants.



JEP 340: One AArch64 Port, Not Two

There are two different set of sources, thus ports, targeting ARM 64-bit in the JDK. One is contributed by Oracle, arm64 (hotspot/cpu/arm), and the other is aarch64 (hotspot/cpu/aarch64). This JEP removes arm64, thus all source code used with #ifdefs under hotspot/cpu/arm will be removed and 64-bit ARM build will default to aarch64. hotspot/cpu/arm will still provide the 32-bit ARM port

JEP 341: Default CDS Archives
Class Data-Sharing (CDS) is a feature to reduce startup time and benefit from memory sharing. However, if you do not install the JRE with the installer, the CDS archive is not generated by default and java  -Xshare:dump has to be run manually.
This can be observed in JDK 11. If you install the JDK 11 GA Release from http://jdk.java.net/11/ ,  lib/server folder does not contain the CDS archive, classes.jsa file. If you run java -Xshare:dump, it will be generated.
With this JEP, CDS archive will be generated by default.

JEP 344: Abortable Mixed Collections for G1
In order to satisfy user equipped pause time target, this JEP makes the G1 garbage collector abort the garbage collection method, by splitting the set of to-be garbage collected regions (mixed collection set) into obligatory and optional elements, and abort the garbage assortment of optional half if pause time target won't be reached otherwise.

JEP 346: Promptly Return Unused Committed Memory from G1
This JEP makes the G1 Garbage Collector return the garbage collected memory areas to the operating system after a period of low application activity. Currently G1 was returning the memory to operating system only after a full GC (or a concurrent cycle) which it avoids, so in effect it was probably not returning the garbage collected memory to operating system at all.

Friday 26 January 2018

Top 6 trending news of 2017

6.Solar Eclipse on Aug 21,2017

For the first time first time in 99 years on August 21, a solar eclipse crossed the US from coast to coast, making for spectacular views of the celestial event of the century.

5. Bitcoin Price
Bitcoin's popularity has surged this year as its value continues to rise and the promise of cryptocurrency continues to inspire millions around the world to join the exciting, yet risky venture.



The excitement continued as Bitcoin futures went live on Cboe Global Markets, the Chicago-based exchange group. The virtual currency shot up more than $1,000 within the first 10 minutes of the new market to a price over $17,000.

4. Hurricane Irma
Intense winds of 185 mph made Hurricane Irma the strongest recorded storm to ever exist in the Atlantic, outside the Caribbean and the Gulf of Mexico. Hundreds of thousands of people evacuated their homes in the Caribbean and the southern US. More than 100 died.
The storm's intensity, the threat to the US mainland, and widespread destruction made it the year's top trending news story in search.

3.Deferred Action for Childhood Arrivals (DACA)
On September 5, President Donald Trump and Attorney General Jeff Sessions announced plans to end the Deferred Action for Childhood Arrivals (DACA) program, a controversial Obama-era policy that shields from deportation nearly 800,000 young immigrants living in the country illegally after being brought to the US as minors.


The move drew a backlash from Democrats and immigration activists but lauded by many Republicans and those who believe US immigration laws are too lax.
DACA recipients are still in limbo as Congress has not yet agreed on a permanent legislative solution. Democratic Sen. Dick Durbin and Republican Sen. Lindsey Graham reintroduced the bipartisan Dream Act in September, but it hasn't gained much traction.The young immigrants are likely to lose their protected status by March if nothing is done.

2. North Korea
Trump's war of words with North Korean leader Kim Jong Un has been one of the biggest stories of the year.

The rising tensions between the two foes, their threatening Cold War-esque rhetoric, and North Korea's continued development of its nuclear weapons program has many people on both sides of the Pacific fearing a nuclear war.

1. Las Vegas Shooting
On October 1, a gunman opened fire from the 32nd floor of a hotel in Las Vegas, killing 58 people and injuring more than 500 more at a country music concert. It was the deadliest mass shooting in modern US history.


The attack renewed America's ongoing debate over gun control, with the particular interest in the use of bump stocks, which allowed the Vegas shooter to fire faster rounds.

Monday 23 October 2017

Difference between CSS transition and CSS animation.

What are Transitions?

A transition occurs when an element changes from one state to another, and the browser fills in that state change with a sequence of in-between frames. It has a beginning and an end state.
We most often see transitions used on hover states, or when information on a page is added or removed. The hover states might be a subtle change in font color, and information on the page might fade from invisible to visible.
Since transitions are limited to these two stages, they can lack the nuance of animations but at the same time be easier to use.
When to use them
If you want to change an element from one state to another smoothly, a transition is a good choice. Simple changes can usually be handled with transitions and timing functions can be used to customize the way the transition occurs.


What are Animations?
CSS Animations are a more powerful alternative to transitions. Rather than rely on a change from one beginning state to an end state, animations can be made up of as many in-between states as you like, and offer more control over how the states are animated.
Where a transition only goes from A to B, an animation can go from A, B, C to D. Or any number of stages as needed.
Animations achieve this by using sets of keyframes. Where a transition can be specified with one line in the class, an animation works by referencing a set of keyframes that are described separately in the CSS.
When to use them
If an animation needs to run when the page loads, or is more complex than a simple A to B state change, a CSS animation might be more appropriate.
Examples of this might be if you want to have an animation on the page that plays after a certain amount of time, like this blinking effect on Baymax character.


In summary

Transitions for creating a smooth transition from one state to another, and animations for more complex series of movements.
Transitions are generally easier to create and manage and apply to the majority of situations. If you need more control over animating an element through a series of steps, or if the animation needs to begin on load, then an animation with keyframes might be the better choice.
In summary
Transitions for creating a smooth transition from one state to another, and animations for more complex series of movements.
Transitions are generally easier to create and manage and apply to the majority of situations. If you need more control over animating an element through a series of steps, or if the animation needs to begin on load, then an animation with keyframes might be the better choice.

Sunday 22 October 2017

10 Common Software Architectural Patterns in a nutshell

Ever wondered how large enterprise scale systems are designed? Before major software development starts, we have to choose a suitable architecture that will provide us with the desired functionality and quality attributes. Hence, we should understand different architectures, before applying them to our design.


What is an Architectural Pattern?
According to Wikipedia,

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.

In this article, It briefly explaining the following 10 common architectural patterns with their usage, pros, and cons.
  1. Layered pattern
  2. Client-server pattern
  3. Master-slave pattern
  4. Pipe-filter pattern
  5. Broker pattern
  6. Peer-to-peer pattern
  7. Event-bus pattern
  8. Model-view-controller pattern
  9. Blackboard pattern
  10. Interpreter pattern 


1. Layered pattern
This pattern is also known as n-tier architecture pattern. It can be used to structure programs that can be decomposed into groups of subtasks, each of which is at a particular level of abstraction. Each layer provides services to the next higher layer.
The most commonly found 4 layers of a general information system are as follows.
  • Presentation layer (also known as UI layer)
  • Application layer (also known as service layer)
  • Business logic layer (also known as domain layer)
  • Data access layer (also known as persistence layer)
Usage
  • General desktop applications.
  • E-commerce web applications.
   


2. Client-server pattern
This pattern consists of two parties; a server and multiple clients. The server component will provide services to multiple client components. Clients request services from the server and the server provides relevant services to those clients. Furthermore, the server continues to listen to client requests.
Usage
  • Online applications such as email, document sharing, and banking.

3. Master-slave pattern
This pattern consists of two parties; master and slaves. The master component distributes the work among identical slave components and computes a final result from the results which the slaves return.
Usage
  • In database replication, the master database is regarded as the authoritative source, and the slave databases are synchronized to it.
  • Peripherals connected to a bus in a computer system (master and slave drives).


4. Pipe-filter pattern
This pattern can be used to structure systems which produce and process a stream of data. Each processing step is enclosed within a filter component. Data to be processed is passed through pipes. These pipes can be used for buffering or for synchronization purposes.
Usage
  • Compilers. The consecutive filters perform lexical analysis, parsing, semantic analysis, and code generation.
  • Workflows in bioinformatics.


5. Broker pattern
This pattern is used to structure distributed systems with decoupled components. These components can interact with each other by remote service invocations. A broker component is responsible for the coordination of communication among components.
Servers publish their capabilities (services and characteristics) to a broker. Clients request a service from the broker, and the broker then redirects the client to a suitable service from its registry.
Usage
  • Message broker software such as Apache ActiveMQ, Apache Kafka, RabbitMQ and JBoss Messaging.


6. Peer-to-peer pattern
In this pattern, individual components are known as peers. Peers may function both as a client, requesting services from other peers, and as a server, providing services to other peers. A peer may act as a client or as a server or as both, and it can change its role dynamically with time.
Usage
  • File-sharing networks such as Gnutella and G2)
  • Multimedia protocols such as P2PTV and PDTP.
  • Proprietary multimedia applications such as Spotify.
7. Event-bus pattern
This pattern primarily deals with events and has 4 major components; event source, event listener, channel and event bus. Sources publish messages to particular channels on an event bus. Listeners subscribe to particular channels. Listeners are notified of messages that are published to a channel to which they have subscribed before.
Usage
  • Android development
  • Notification services

8. Model-view-controller pattern

This pattern, also known as MVC pattern, divides an interactive application into 3 parts as,
model — contains the core functionality and data
view — displays the information to the user (more than one view may be defined)
controller — handles the input from the user
This is done to separate internal representations of information from the ways information is presented to, and accepted from, the user. It decouples components and allows efficient code reuse.
Usage
  • Architecture for World Wide Web applications in major programming languages.
  • Web frameworks such as Django and Rails.



9. Blackboard pattern
This pattern is useful for problems for which no deterministic solution strategies are known. The blackboard pattern consists of 3 main components.
blackboard — a structured global memory containing objects from the solution space
knowledge source — specialized modules with their own representation
control component — selects, configures and executes modules.
All the components have access to the blackboard. Components may produce new data objects that are added to the blackboard. Components look for particular kinds of data on the blackboard and may find these by pattern matching with the existing knowledge source.
Usage
  • Speech recognition
  • Vehicle identification and tracking
  • Protein structure identification
  • Sonar signals interpretation.

10. Interpreter pattern
This pattern is used for designing a component that interprets programs written in a dedicated language. It mainly specifies how to evaluate lines of programs, known as sentences or expressions written in a particular language. The basic idea is to have a class for each symbol of the language.
Usage
  • Database query languages such as SQL.
  • Languages used to describe communication protocols.


Comparison of Architectural Patterns
The table given below summarizes the pros and cons of each architectural pattern.

(click on image to enlarge)