Book Image

Java 9 with JShell

By : Gaston C. Hillar
Book Image

Java 9 with JShell

By: Gaston C. Hillar

Overview of this book

The release of Java 9 has brought many subtle and not-so-subtle changes to the way in which Java programmers approach their code. The most important ones are definitely the availability of a REPL, known as JShell, which will make experiments and prototyping much more straightforward than the old IDE-based project-led approach. Another, more subtle change can be seen in the module system, which will lead to more modularized, maintainable code. The techniques to take full advantage of object-oriented code, functional programming and the new modularity features in Java 9 form the main subjects of this book. Each chapter will add to the full picture of Java 9 programming starting out with classes and instances and ending with generics and modularity in Java.
Table of Contents (23 chapters)
Java 9 with JShell
Credits
About the Author
Acknowledgement
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Organizing object-oriented code with the new modularity in Java 9


When we have just a few interfaces and classes, hundreds of lines of object-oriented code are easy to organize and maintain. However, as the number of types and lines of code start to increase, it is necessary to follow some rules to organize the code and make it easy to maintain.

A very well-written object-oriented code can generate a maintenance headache if it isn't organized in an effective way. We don't have to forget that a well-written object-oriented code promotes code reuse.

In our example, we will have just a few interfaces, abstract classes, and concrete classes. However, we must imagine that we will have a huge number of additional types to support the additional requirements. Hence, we will end up with dozens of classes related to the mathematical operations required to render the elements that compose a scene, additional types of lights, new types of cameras, classes related to these new lights and cameras, and...