Java 9 Programming By Example

Get the steps you need to discover the world of Java 9 programming using real-world examples

Java 9 Programming By Example

This ebook is included in a Mapt subscription
Peter Verhas

Get the steps you need to discover the world of Java 9 programming using real-world examples
$10.00
$44.99
RRP $35.99
RRP $44.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781786468284
Paperback504 pages

Book Description

This book gets you started with essential software development easily and quickly, guiding you through Java’s different facets. By adopting this approach, you can bridge the gap between learning and doing immediately. You will learn the new features of Java 9 quickly and experience a simple and powerful approach to software development. You will be able to use the Java runtime tools, understand the Java environment, and create Java programs.

We then cover more simple examples to build your foundation before diving to some complex data structure problems that will solidify your Java 9 skills. With a special focus on modularity and HTTP 2.0, this book will guide you to get employed as a top notch Java developer.

By the end of the book, you will have a firm foundation to continue your journey towards becoming a professional Java developer.

Table of Contents

Chapter 1: Getting Started with Java 9
Getting started with Java
Installing Java
Executing jshell
Packaging classes into a JAR file
Managing the running Java application
Using an IDE
Summary
Chapter 2: The First Real Java Program - Sorting Names
Getting started with sorting
Getting started with project structure and build tools
Setting up the project with Maven
Coding the sort
Understanding the algorithm and language constructs
Compiling and running the program
Summary
Chapter 3: Optimizing the Sort - Making Code Professional
The general sorting program
A brief overview of various sorting algorithms
Project structure and build tools
Code the sort
Creating unit tests
Collections with wrong elements
Handling exceptions
Generics
Test Driven Development
Implementing QuickSort
Creating modules
Summary
Chapter 4: Mastermind - Creating a Game
The Game
The model of the game
Java collections
Dependency injection
Implementing the game
The Game class
Creating an integration test
Summary
Chapter 5: Extending the Game - Run Parallel, Run Faster
How to make Mastermind parallel
Refactoring
Processes
Threads
Fibers
java.lang.Thread
Pitfalls
ExecutorService
Variable access
The CPU heartbeat
Volatile variables
Synchronized block
Wait and notify
Lock
Atomic classes
BlockingQueue
IntervalGuesser
ParallelGamePlayer
Microbenchmarking
Summary
Chapter 6: Making Our Game Professional - Do it as a Webapp
Web and network
The HTTP protocol
HTTP/2.0
Cookies
Client server and web architecture
Writing servlets
Java Server Pages
HTML, CSS, and JavaScript
Mastermind servlet
Running the Jetty web servlet
Logging
Other technologies
Summary
Chapter 7: Building a Commercial Web Application Using REST
The MyBusiness web shop
Sample business architecture
Microservices
Service interface design
JSON
REST
Model View Controller
Spring framework
Service classes
Compiling and running the application
Testing the application
Servlet filters
Audit logging and AOP
Dynamic proxy-based AOP
Summary
Chapter 8: Extending Our E-Commerce Application
The MyBusiness ordering
Setting up the project
Order controller and DTOs
Consistency checker
Annotations
Using reflection
Functional programming in Java
Scripting in Java 9
Summary
Chapter 9: Building an Accounting Application Using Reactive Programming
Reactive... what?
Reactive programming in a nutshell
Reactive systems
Reactive streams
Reactive programming in Java
Summary
Chapter 10: Finalizing Java Knowledge to a Professional Level
Java deep technologies
Programming in the enterprise
Summary

What You Will Learn

  • Compile, package and run a trivial program using a build management tool
  • Get to know the principles of test-driven development and dependency management
  • Separate the wiring of multiple modules from the application logic into an application using dependency injection
  • Benchmark Java execution using Java 9 microbenchmarking
  • See the workings of the Spring framework and use Java annotations for the configuration
  • Master the scripting API built into the Java language and use the built-in JavaScript interpreter
  • Understand static versus dynamic implementation of code and high-order reactive programming in Java

Authors

Table of Contents

Chapter 1: Getting Started with Java 9
Getting started with Java
Installing Java
Executing jshell
Packaging classes into a JAR file
Managing the running Java application
Using an IDE
Summary
Chapter 2: The First Real Java Program - Sorting Names
Getting started with sorting
Getting started with project structure and build tools
Setting up the project with Maven
Coding the sort
Understanding the algorithm and language constructs
Compiling and running the program
Summary
Chapter 3: Optimizing the Sort - Making Code Professional
The general sorting program
A brief overview of various sorting algorithms
Project structure and build tools
Code the sort
Creating unit tests
Collections with wrong elements
Handling exceptions
Generics
Test Driven Development
Implementing QuickSort
Creating modules
Summary
Chapter 4: Mastermind - Creating a Game
The Game
The model of the game
Java collections
Dependency injection
Implementing the game
The Game class
Creating an integration test
Summary
Chapter 5: Extending the Game - Run Parallel, Run Faster
How to make Mastermind parallel
Refactoring
Processes
Threads
Fibers
java.lang.Thread
Pitfalls
ExecutorService
Variable access
The CPU heartbeat
Volatile variables
Synchronized block
Wait and notify
Lock
Atomic classes
BlockingQueue
IntervalGuesser
ParallelGamePlayer
Microbenchmarking
Summary
Chapter 6: Making Our Game Professional - Do it as a Webapp
Web and network
The HTTP protocol
HTTP/2.0
Cookies
Client server and web architecture
Writing servlets
Java Server Pages
HTML, CSS, and JavaScript
Mastermind servlet
Running the Jetty web servlet
Logging
Other technologies
Summary
Chapter 7: Building a Commercial Web Application Using REST
The MyBusiness web shop
Sample business architecture
Microservices
Service interface design
JSON
REST
Model View Controller
Spring framework
Service classes
Compiling and running the application
Testing the application
Servlet filters
Audit logging and AOP
Dynamic proxy-based AOP
Summary
Chapter 8: Extending Our E-Commerce Application
The MyBusiness ordering
Setting up the project
Order controller and DTOs
Consistency checker
Annotations
Using reflection
Functional programming in Java
Scripting in Java 9
Summary
Chapter 9: Building an Accounting Application Using Reactive Programming
Reactive... what?
Reactive programming in a nutshell
Reactive systems
Reactive streams
Reactive programming in Java
Summary
Chapter 10: Finalizing Java Knowledge to a Professional Level
Java deep technologies
Programming in the enterprise
Summary

Book Details

ISBN 139781786468284
Paperback504 pages
Read More

Read More Reviews