万本电子书0元读

万本电子书0元读

顶部广告

Introduction to JVM Languages电子书

售       价:¥

30人正在读 | 0人评论 9.8

作       者:Vincent van der Leun

出  版  社:Packt Publishing

出版时间:2017-07-07

字       数:52.2万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Explore the Java Virtual Machine with modern programming languages About This Book ? This guide provides in-depth coverage of the Java Virtual Machine and its features ? Filled with practical examples, this book will help you understand the core concepts of Java, Scala, Clojure, Kotlin, and Groovy ? Work with various programming paradigms and gain knowledge about imperative, object-oriented and functional programming Who This Book Is For This book is meant for programmers who are interested in the Java Virtual Machine (JVM) and want to learn more about the most popular programming languages that can be used for JVM development. Basic practical knowledge of a modern programming language that supports object-oriented programming (JavaScript, Python, C#, VB.NET, and C++) is assumed. What You Will Learn ? Gain practical information about the Java Virtual Machine ? Understand the popular JVM languages and the Java Class Library ? Get to know about various programming paradigms such as imperative, object-oriented, and functional ? Work with common JVM tools such as Eclipse IDE, Gradle, and Maven ? Explore frameworks such as SparkJava, Vert.x, Akka and JavaFX ? Boost your knowledge about dialects of other well-known programming languages that run on the JVM, including JavaScript, Python, and Ruby In Detail Anyone who knows software development knows about the Java Virtual Machine. The Java Virtual Machine is responsible for interpreting Java byte code and translating it into actions. In the beginning, Java was the only programming language used for the JVM. But increasing complexity of the language and the remarkable performance of the JVM created an opening for a new generation of programming languages. If you want to build a strong foundation with the Java Virtual Machine and get started with popular modern programming languages, then this book is for you. The book will begin with a general introduction of the JVM and its features, which are common to the JVM languages, helping you get abreast with its concepts. It will then dive into explaining languages such as Java, Scala, Clojure, Kotlin, and Groovy and will show how to work with each language, their features, use cases, and pros and cons. By writing example projects in those languages and focusing on each language’s strong points, it will help you find the programming language that is most appropriate for your particular needs. By the end of the book, you will have written multiple programs that run on the Java Virtual Machine and know about the differences between the various languages. Style and approach This practical, example-filled guide will help you get started with the JVM and some of its most popular languages.
目录展开

Title Page

Copyright

Introduction to JVM Languages

Credits

About the Author

About the Reviewer

www.PacktPub.com

Why subscribe?

Customer Feedback

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

Java Virtual Machine

JVM implementations

Why develop on JVM?

JVM adapts to market changes

Java Class Library

Ecosystem

Scenario 1 – Using a JVM application server

Scenario 2 – Using a general high-level web application framework

Scenario 3 – Using a microservice framework

Popular use cases

Web applications

Big data

IoT

JVM concepts

Virtual machine

The JIT compiler

Primitive datatypes

Classes

Reference types

References and null references

Garbage collector

Example

Backward compatibility

Build tools

Java editions

Java SE

Java EE

Example – Java Persistence API as implemented by two application servers

Java ME

Other languages on JVM

Why choose a language other than Java?

Java is a very verbose language

Java is not ideal for everything or everyone

Missing classes in Java Class Library

Mixing JVM languages in a project

Increasing build process complexity

Language runtime libraries

Writing unit tests in a different language

Summary

Developing on the Java Virtual Machine

JDK

Installing JDK

Downloading JDK

Installing JDK on Windows

Installing JDK on macOS

Installing JDK on Linux

Downloading API documentation

Exploring JDK

The directory structure

JDK commands

GUI monitoring tools

Java VisualVM

Oracle Mission Control

JConsole

JRE

Class organization with packages

What are packages?

Choosing a package name

Package name examples

Fully qualified class name

Java Class Library

Java Class Library organization

Package overview

Fundamental classes of the java.lang package

The Object class (java.lang.Object)

Important object methods

The String class (java.lang.String)

Primitive wrapper classes (Integer, Long, Short, Char, Float, Double in java.lang)

Autoboxing examples

Exceptions and errors (java.lang.Exception and java.lang.Error)

The Collections API - java.util.ArrayList and java.util.HashMap

ArrayList (java.util.ArrayList)

Commonly used methods of the ArrayList class

ArrayList usage example

HashMap (java.util.HashMap)

Commonly used methods of the HashMap class

HashMap usage example

Preparing your classes for the Collections API

About hashCode()

About equals ()

The hashing mechanism

Running JVM applications on the command line

At least one class must have a static main() method

Required directory structure for class files

Setting ClassPath for a JVM instance

Placing class files inside a JAR archive

Runnable JAR file

Running a program with the java command

Run a project consisting of separate class files

Running a project that is placed inside a runnable JAR file

Other useful parameters of the java command

-D to pass properties and values

-ea to enable assertions

A hands-on example project to run on JVM

A ClassPath example

Eclipse IDE

Downloading Eclipse IDE

Installing Eclipse IDE

Summary

Java

OOP in Java

Defining classes

Class access modifiers

Final class modifier - locking a class

Defining packages

Importing classes

Adding class members - variables and methods

Instance variables

Methods

Modifiers

Protecting class members with access modifiers

Access modifier example

Static modifier - instance variables and class variables

Final modifier - locking a class member

Overloading methods

Constructors and finalizers

Constructors

Finalizers

Extending a class

Overriding methods

Calling constructors of a parent class

Abstract classes

Interfaces

Upcasting and downcasting

Writing Java code

Operators

Conditional checks

The if...else statement

The switch...case statement

POJO

Arrays

Generics and Collections

Loops

The for loop

The normal for loop

The enhanced for loop

The while loop

The do...while loop

Exceptions

Runtime exceptions

Threads

Lambdas

Style guide

Quiz

Summary

Java Programming

Configuring Eclipse IDE

Creating a web service in Java

Creating a new Gradle project in Eclipse IDE

Exploring the generated project

Modifying the Gradle build file

Building the project

Coding the backend class

Backend class business rules

Creating a dummy implementation of the method

Creating the test case class and writing its first unit test

Implementing an input validation check

Writing the second unit test

Implementing the business logic

Creating an executable application task

Creating a web service

Running the web service

Creating Javadoc documentation

Summary

Scala

Installing Scala

Scala's Read-Eval-Print-Loop shell

Functional versus imperative programming

Scala language syntax and rules

Statically typed language

Mutable and immutable variables

Common Scala types

Any class

AnyRef class - reference classes

AnyVal class - value classes

Strings

OOP in Scala

Defining packages and subpackages

Importing members

Defining classes

Instance variables and methods

Instance variables

Instance methods

Access modifiers for class instance members

Constructors

Extending a class

Overriding methods

Overloading methods

Abstract classes

Traits

Singleton objects

Operator overloading

Case classes

Scala's standard library

Generics

Collections

Immutable list

Mutable list

Immutable map

Mutable map

XML processing

Functional programming in Scala

Iterating through collections using functions

The map, filter, and reduce design pattern

Map - transform data

Filter - filter items from a collection or array

Reduce - for performing calculations

Currying

Quiz

Summary

Scala Programming

Scala IDE for the Eclipse plugin

Installing Scala IDE for Eclipse

Switching to the Scala IDE perspective

SBT

Installing SBT

Creating an SBT-based Eclipse IDE project

Creating a new SBT project

Loading the SBTEclipse plugin

Generating a new Eclipse IDE project with SBTEclipse

Importing the generated project in Eclipse IDE

The Scala compiler (scalac)

Creating a singleton object with the main() method

Creating a singleton object that extends the App trait

Creating an Akka project

Adding an Akka dependency to the SBT build file

Updating the Scala IDE project

Akka concepts

Actors

Actor references (ActorRef)

Messages

Dispatchers

Creating our first Akka actor - QuotesHandlerActor

Creating messages

Writing a ScalaTest-based unit test

Implementing a message handler

Creating QuotePrinterActor

The main application

Summary

Clojure

Installing Clojure

Creating a start script

Creating a start script on Windows

Creating a start script on macOS and Linux

Clojure's interactive shell (REPL)

Clojure language

Syntax

Expressions

Defining variables

Defining functions

Data structures

Numeric types

Strings and characters

Collections

Lists

Vectors

Sets

Hash-maps

Iteration over arrays and loops

Conditions

Working with Java classes

Creating simple Java classes with deftype and defrecord

Managing states with agents

Agent example

Style guide

Quiz

Summary

Clojure Programming

The Counterclockwise plugin for Eclipse IDE

Installing the Counterclockwise plugin

Switching to the Java perspective

Leiningen's build tool

Installing Leiningen

Creating executable programs in Clojure

Compiling to class files without Leiningen

Compiling projects with Leiningen

Creating a new Counterclockwise project

Clojure REPL in Eclipse IDE

Updating the project's Clojure version

Adding a dependency

Exploring monads by applying test-driven development

The Luminus web framework

Creating a Luminus project

Importing the project in Counterclockwise

Exploring the Luminus project

Adding a page to the web application

Summary

Kotlin

Installing Kotlin

Launch scripts

Kotlin's REPL interactive shell

Kotlin language fundamentals

Defining local variables

Defining a function

Kotlin's types

Kotlin basic types

Strings

Null safety handling

Option 1 - Adding a conditional check

Option 2 - Using the safe call operator ?.

Option 3 - Using the Elvis operator ?:

Option 4 - Using the !! operator

Conversions

Collections and generics

Loops

OOP in Kotlin

Defining packages

Importing members

Defining classes and constructors

Adding members to classes

Adding functions

The main entry function

Adding properties

Inheritance

Interfaces

Visibility modifiers

Singleton and companion objects

Data classes

Lambdas and inline functions

Procedural programming in Kotlin

Style guide

Quiz

Summary

Kotlin Programming

Kotlin for the Eclipse IDE plugin

Installing the Kotlin plugin for the Eclipse IDE

Switching to Kotlin perspective

Apache Maven

Installing Apache Maven

Downloading a preconfigured Kotlin starter kit

Importing the project in the Eclipse IDE

Exploring the pom.xml build file

Updating the build file in Eclipse

Creating a JavaFX desktop GUI application

Preparing the project

Creating a runnable application

Writing an extension function

Layout panes

Implementing a BorderPane-based layout

Implementing animation

Debugging the program

Summary

Groovy

Installing Groovy

GroovyConsole and GroovyShell

GroovyConsole

GroovyShell

Groovy Language

Object-oriented programming in Groovy

Groovy is fully object oriented

Access modifiers

Adding properties to a class

Optional types

Automatically creating a fully featured POJO

Creating immutable classes

Groovy Development Kit (GDK)

Groovy Strings (GStrings)

Collections

Lists

Maps

Dynamic and static programming

Meta programming

Static programming in Groovy

Quiz

Summary

Groovy Programming

Installing the Groovy Eclipse plugin

Switching to Java perspective

Apache Ivy and IvyDE

Installing Apache IvyDE plugin for Eclipse IDE

Creating and configuring the project

Creating a new Groovy Eclipse project

Creating an ivy.xml file for Ivy

Java Database Connectivity (JDBC)

H2 database

Creating an in-memory database

Generating XML using MarkupBuilder

Generating XML based on SQL

The Vert.x microservice platform

Adding Vert.x dependency to Ivy

Creating the web service

Summary

Other JVM languages

Oracle Nashorn

Embedding Nashorn in JVM-based projects

Running Nashorn

Jython (Python)

Differences between CPython and Jython

Running Jython

JRuby (Ruby)

Ruby on Rails and JRuby

Running JRuby

Frege (Haskell)

Calling Java code from Frege

Running Frege

Ceylon

Ceylon's module system

Running Ceylon

Summary

Quiz Answers

Chapter 3: Java

Chapter 5: Scala

Chapter 7: Clojure

Chapter 9: Kotlin

Chapter 11: Groovy

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部