9 Big Things about Java 9

According to the latest Tiobe index of programming language popularity, Java tops the list.  No wonder there is so much buzz around the new Java 9 release, set for September 21, 2017.  Take a walk through with our expert.
 
  1. JSHELL

Many compiled languages include tools for statements interpretation. By using these REPL tools you can rapidly test code snippets without creating a project.

Take Scala, as an example. Compilation can be time consuming, but by using REPL, each statement is executed instantly! That’s great when you are getting started with the language. Each expression returns a value and type, which is valuable information to have.

On the other hand, in Java, we would need to create a test or main method that prints results and must be recompiled every time someone makes a change.

2. COLLECTIONS API FACTORY METHODS

The added static factory methods help create collections in variety of small cases.

This come to life due to static interface methods. Thus collections are immutable.

3. COMPACT  STRINGS

Java 9 provides new and improved strings which, in most cases, will reduce String memory consumption by half.

Instead of having a char[] array, String is now represented as a byte[] array. Depending on which characters it contains, it will use either UTF-16 or Latin-1 to produce either one or two bytes per character.

There is a also new field inside the String class–coder that indicates which variant is used. Unlike Compressed Strings, this feature is enabled by default. If necessary, as in a case where mainly UTF-16 Strings are used, it can be disabled by  -XX:-CompactStrings.

4. OPTIONAL

At last, Java9 adds an or() method to Optional API, which allows for the return of different chained optionals without calling isPresent() each time.

In addition, Java9 can create Stream out of Optional with no more than 1 element inside, which is a real advantage when «lazy» mapping is needed.

And, as the cherry on the cake, Java9 will have an ifPresentOrElse() method in Optional API.

5. COMPLETABLE FUTURE

This class was polished and several methods were added, but most notable is copy(). This method returns immutable copy for CompletableFuture.

But the coolest thing is that stopping an ancestor will affect the child!

Timeouts were also added to the API. Now it is possible to define how CF should finish after time runs out.

6. STREAMS

With the excellent additions of dropWhile() and takeWhile() to Stream API, there is now option to skip loop and use the stream iterate() method instead.

7. PROCESS HANDLE API

When starting Java9, there is now a straight and simple access to process handling.8. JAVA LANGUAGE ENHANCEMENT

Just in case if someone still uses it, «_» is no longer a legitimate identifier. In this case you should use « __» instead (but you don’t 😉 )

Private methods inside Interfaces.

Now with Java9 we are able to use final variables inside try-with-resources effectively.

9. STACK WALKER AND G1 AS DEFAULT GC

We can now use stack-trace without creating an Exception instance.  We consider this a big improvement.

Starting Java9 G1 will be our default GC. The “Garbage-first” garbage collector, aka G1, is a concurrent multi-threaded GC. It mostly works alongside the application threads much like the concurrent mark sweep GC, and is designed to offer shorter, more predictable pause times while still achieving high throughput. What makes G1 different is that instead of splitting the heap into 3 big regions, it splits it into a set of lots of equal-size. Certain subsets of regions are still assigned roles just like in the other GCs. The amount of live data in each region is tracked, and when a collection is triggered, the G1GC will clear the ones with the most “garbage” first, hence the name. By doing this, it attempts to free as much space as possible with each  collection.

Andrew Petryk
Software Engineer, CoreValue

What are your customers telling you? Maximize the effectiveness of sentiment analysis by using simple tips

Sentiment analysis is one method to gather and process customer-supplied information, and then convert it to a quality customer experience. Gartner predicts that 85% of all businesses will compete in the area of customer experience by 2020.

As sentiment analysis explodes onto the scene, what can technology actually do to enhance business efforts?

Hints on applying sentiment analysis

Here are some tips on how to implement various sentiment analysis techniques with ease and utmost efficiency.

– Opt for the proper type of analysis
Some platforms apply automated (machine-powered) sentiment. Others believe in human-powered sentiment analysis, while many use a hybrid system. Decide which is best for your business before launching the effort.

For example, advancements in natural language processing make machine-powered processing a perfect choice for enterprises operating at a large scale with the need for timely analysis of huge data volumes. Though with some limits, automated sentiment analysis is statistically accurate compared with human-powered analysis.

We experimented with more than 10 machine learning algorithms for gathering and processing online customer sentiments in order to find the most accurate and promising ones. You can find the experiments overview and results here (http://www.corevalue.net/sentiment_analysis/).

Human-powered platforms perform better for small project-based data sets. Even in the era of artificial intelligence, human potential in research tasks is still irreplaceable. Platforms like Mechanical Turk or Canvs claim to understand language through nuance and intonation, but it is recognized that interpreting the whole complexity of emotions, sarcasm, double meaning and slang is mostly beyond the reach of the machine learning tools.

– Value opinion Leaders first
Field-oriented influencers spread their thoughts and ideas to a wide audience and specifically impact their field. There are many popular bloggers, social personalities, and columnists that are followed by huge audiences across the digital world, including Twitter, LinkedIn, Facebook, Instagram, YouTube, on personal blogs, etc. Their linguistic behavior can guide public opinion and their sentiment is especially valuable for further opinion evaluations for your dimension of interest. Consequently, you can sharpen your marketing efforts and focus on effective work with influencers, either by mitigating critics or intensifying positive feedback.

– Relevant vocabulary is vital
Domain-specific sentiment dictionaries are also helpful for efficient sentiment analysis. There is a large array of customized sentiment lexicon resources that could help increase the accuracy of your analysis. Some domains are better investigated than others, and some lack thorough studies. Before implementing an analysis, search for an appropriate sentiment dictionary or domain-specific lexicon lists to ease the process.

– Negative reviews first
Customers’ negative sentiment can provide an even more complete picture for your analysis. Evaluation of unfavourable opinions is extremely beneficial for enterprise development, as it gives you the opportunity to address controversy and make your business perform better without compromising efficiency.

Application areas for sentiment analysis

70% of the most successful companies consider customer feedback to be of primary importance. Sentiment analysis helps business to deliver better customer experience by extracting the underlying meaning from the message. Where can it be used? The application area is immense:

  • Sentiment analysis enables customer service by fast-tracking positive or negative opinions. This can bring real value by making it possible for the customer to get what he/she really wants.
  • Online and offline brand reputation management can also gauge success through consumer sentiment. It allows the measurement of branding, rating status of the brand, and brand influence in the real world. It facilitates evaluation of customer trends and media reviews, as well as the mining of other metrics that drive strategic thinking.

Is marketing a prevalent application area for sentiment analysis? It is, but certainly not exclusive.

  • Public thought on the relevant financial searches is scrupulously investigated through social media sentiment, and monitored by the biggest finance and media holdings.
  • Big data algorithms informing sentiment are also applied to today’s human resource market. Learning and analysis of employee opinion is crucial in this highly competitive hiring market. Comprehending employee feedback enables HR to deliver a more effective corporate message, address employee satisfaction, and apply effective employee retention plans.
  • Business can track product intelligence by means of sentiment analysis. Product performance is benchmarked through social media or reviews defining real customer’s need.
  • Successful product development is hardly possible nowadays without end-customer feedback. Receiving accurate and timely opinion from users is vital for maintaining product quality. In the agile environment, customer’s input is especially important, and prompt sentiment measurement allows for instant feedback solicitation, which simultaneously leads to a better quality product release.
  • Politics is not devoid of the latest tech achievements. Sentiment analysis is an integral component of a larger strategy. It facilitates the expert mapping and exploitation of voting districts, superior predictive analytics, and better surveys, which provide audience insight at a much deeper level.

Driven by the increase of two-way communication, business is striving to improve the understanding of the potential customer. Analysts and computers aggregate and evaluate human reaction on social media, call-center feedback, and websites. In order to conform to the language evolution, and to re-categorise sentiment, sentiment analytics will continuously evolve.

Lily Smirnova
Marketing & Business Development Manager, CoreValue

Great features developers might have missed in the Summer ’17 release

Apex Metadata API (generally available in Summer’17)

Apex Metadata API is a must-have for every developer.  It empowers developers to update classes/pages/remote site settings/custom metadata and much more straight from Apex. Imagine creating an Apex Class instance from an Apex Class. It will handle dependency Injection in a way that will lower the coherence of the class model in Apex.  Currently, when compared to Java project, class model is not handled that smoothly.

Insights

As an example of the improvement provided by this feature, consider the use of the metadata library from FinancialForce (https://github.com/financialforcedev/apex-mdapi). Previously, it was possible to create metadata types only after remote site settings were added to the organization.  Metadata API remedies this shortcoming by allowing metadata creation without using old workarounds like sending a Visualforce page request to create Remote Site Settings (RSS) – a process which is not secure by any measure.

Metadata API can also be utilized to manage bulk admin work, such as security tweaks which are now possible to do even without metadata deployments.

But

At the moment, only layouts and custom metadata types are accessible without any deletion option added. In other words, it is possible to either create or retrieve layouts or custom metadata types. As the Salesforce team noted, they are still are working on this.  However, if not all functions offered in Apex can be covered with tests, and every operation will be async, this feature does not resolve as many developer issues as it seemed at the first glance.  

Here are other limitations. Operation of create/update metadata is async, and can neither be tested nor covered using unit tests.

Lightning Data Service (beta)

The Lightning Data Service handles records processing (create, edit, update, or delete) in your component without Apex controller. The power of LDS allows for the elimination of many components that are made exclusively for this purpose. Moreover, LDS shows additional superiority by utilizing layouts to display records that show consistency with the system’s overall user interface.

Insights

This seems like a win for the developer. Only bulkification, the ability to perform bulk operations, is missing.

But

Some developers who used force:recordPreview, which is also in beta, might consider changing from recordPreview to recordData, which is also in beta. However, be aware that force:recordData might change in some future release. We hope it will not.

Big Objects – Pilot (for some clients)

The Salesforce platform allows the management of huge data volumes through the brand new feature available known as Big Objects. If this feature is released together with the currently proposed design for the Pilot version, it will be a huge win for developers.

Insights

Salesforce itself is limited in terms of storage. For example, if you have ten million accounts, then there is a good chance that working with them directly in code might become a nightmare, e.g., like displaying reports or producing graphics. However, the challenge comes not from the data capability of Salesforce, but from the tools to operate with them, such as the non-availability of custom indexes, SOQL selectivity and many other functions. Big Objects facilitate working with Big Data.

Additionally, Salesforce released an asynchronous SOQL tool, primarily for admin. This tool enables processing big objects with ease that could not be processed by simple synchronized inquiry. Imagine counting “likes” per day from 1 billion social media users. Now we have a tool to group them by different dimensions and receive accurate analytics.

Wave analytics on Big Objects, or custom Objects which are based on data from Big Objects, allow for the storage of billions of records inside Salesforce. Combine this with the capability to create statistical objects based on the stored data, plus the capability to utilize custom indexes for custom Big Objects, and it becomes a huge upgrade for Salesforce Standard BigObjects.

But  

Big Objects is somewhat limited in working from Apex. There are only a few options to create and store BigObject from Apex, but no way to retrieve them, due to Async SOQL not yet being fully available from Apex.

Async SOQL – Pilot

Asynchronous SOQL adds ability to work with large datasets, from either Big Objects or standard Salesforce Object. This tool empowers us to use big aggregation queries on large datasets which enables a whole new scenario – the collection of Big Objects aggregate data for custom object records.

Insights

This feature definitely holds a great promise for the reason that no other tool yet exists to provide smooth retrieval of data from Big Objects.

But

There is no ability to work with Async SOQL from Apex, which results in another list of limitations.

User Interface API – Developer Preview

User Interface API enables building native mobile apps and custom web apps with branding, the same look and feel as in a Salesforce due to information about layout in a response – one request for it. A single REST request returns enough metadata, layout information, and data to display, edit, or create a record.

Insights

The benefit of the feature is the ability to get metadata layout info and record info with a single API REST request. It is an invaluable tool for those who work with Salesforce and mobile development of their unique app. Now, with user API, the requests are record fields available in one response, as opposed to making two calls – one for the record and the second one for a layout.

Salesforce DX – Public Beta (generally available since Winter 18)

Salesforce DX simplifies the development process for new aps. The feature makes it easier to use custom folder structure, CI integrations, modern developer tools like Selenium, etc.

Insights

It works better and faster than any solution which is now available. In addition, the scratch orgs concept will improve CI processing even for existing solid processes. It does this by allowing for the elimination of CI sandboxes, where some developers validate their code before they actually building it into some other orgs. The coolest thing is the custom structure of the project which is achievable only in some IDE’s and not supported natively.

But

There are no significant advantages from Salesforce DX which were not achievable by a well-configured project, except for scratch orgs and custom folder project structure, which will definitely simplify development for a big projects.

Platform Events – generally available since Summer 17

Platform Events facilitate delivery of secure and scalable custom notifications by Salesforce from external sources. Integration is easier, and architecture can be smoother thanks to the event and event bus structure.

Insights

This is a really good feature. It empowers you to either publish events through apex EventBus class, through visualforce/lightning, or subscribe to their creation both on VF/Lightning (using CometD or other messaging lib) and via trigger on platform event through apex. Event-Driven architecture is simple and now it’s available for an apex too.

But

Consider there’s no rollback on publish operation – event, so publish counts in DML limits

Final Notes

The Winter ’17 and Spring ’17 Releases were really interesting, but the Summer ’17 release proved to be remarkable.  Packed with truly valuable developer features, including Pilot programs, the release holds great promise for development professionals.

George Arshakian

Senior Salesforce Engineer, CoreValue