Автор: Nik Lumi
Издательство: Independently published
Год: 2022
Страниц: 248
Язык: английский
Формат: pdf, epub
Размер: 10.1 MB
The concept of a software exception was introduced into programming in the early 60s. Since then, it has been adopted by many languages and has evolved significantly.
It is generally accepted that exceptions help separate different concerns in programming and therefore improve manageability of code. While very few people will deny the usefulness of exceptions, there is ongoing debate on how they should be used. This book covers the basics of Java exceptions, advanced concept, and best practices, and gives a historical overview of how exception handling in Java was and is approached. In addition, this book provides examples of real APIs with analysis on how these APIs approach and handle exceptions. This book assumes that the reader is familiar with the basics of the Java programming language, and is able to write, compile and execute a simple program. It also assumes that the reader is able to read and understand code excerpts.
Objects have very convenient semantics. In OOP languages (including Java) the information about exceptional behavior can be extracted, encapsulated, and separated from the normal flow. In addition to information about where, when, and how the exceptional conditions took place, information can be transparently added to the object that describes the exceptional condition. In summary, in OOP languages exceptions combine the power of non-local transition of control with object-oriented semantics. Java is an object-oriented language, which means classes play an important role in it and its multiple concepts are represented in the form of classes. Exceptions are — no pun intended — not an exception to this rule. Therefore, every exception is an object of a class with some specific behavior.
We hope you both enjoy and learn from this book.
Скачать Exceptions in Java: Basics, advanced concepts, and real API examples