Michael Inden
Zurich, Switzerland
ISBN 978-1-4842-7394-4 e-ISBN 978-1-4842-7395-1
https://doi.org/10.1007/978-1-4842-7395-1
Michael Inden 2022
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.
Preface
First of all, thank you for choosing this book. Here you will find a wide range of practice exercises on a broad mix of topics that will improve your knowledge in an entertaining way. It can also help prepare you for job interviews and will certainly help improve your problem-solving skills.
Practice Makes Perfect
We all know the saying practice makes perfect. Day-to-day life involves a lot of practice, and serious training and exercising is undertaken for specific disciplines such as sports, music, or art. But the serious case or competition is rare. Oddly enough, this is often significantly different for us software developers. We actually spend almost all of our time implementing and tend to rarely spend time practicing and learning, sometimes not at all. Why is that?
Presumably, this is due to the time pressure that usually dominates and the fact that there is not much suitable exercise material availableeven if there are textbooks on algorithms as well as books on coding. But, often they are either too theoretical or too source code-focused and contain too little explanation of the solutions. This book aims to change that.
Why This Book?
So how did I come to tackle this book project (originally written in German)? There are several reasons. On the one hand, I was asked again and again by mail or personally by participants in my workshops, if there was a tutorial book as a supplement to my book Der Weg zum Java-Profi [Ind20a]. Thats how the first idea came about.
What really triggered the whole thing was that a recruiter from Google approached me quite by surprise with a job request. As preparation for the upcoming job inter- views and to refresh my knowledge, I started to search for suitable reading material and developed some exercises for myself. In the process, I discovered the great, but also partly quite challenging, book Cracking the coding interview by Gayle Laakmann McDowell [McD16], which inspired me further.
A few months after publishing the German version of this book, I translated and finished this English version due to the support of the people at Apress.
Who Is This Book Aimed At?
This book is explicitly not intended for programming novices but is aimed for readers who already have basic or even good knowledge of Java and want to deepen it with exercises. By solving small programming exercises, you will expand your knowledge about Java, algorithms, and sound OO design in an entertaining way.
The following target groups are addresses in particular:
High school and college students: First of all, this book is meant for pupils with an interest in computer science as well as for students of computer science, who already know Java quite well as a language and now want to deepen their knowledge by doing exercises.
Teachers and lecturers: Of course, teachers and lecturers may also benefit from this book and its large number of exercises of varying difficulty, either as a stimulus for their own teaching or as a template for exercises or exams.
Hobby programmers and young professionals: In addition, the book is aimed at dedicated hobby programmers but also young professionals who like to program with Java and want to develop themselves further. Furthermore, solving the tasks helps prepare for potential questions in job interviews.
Experienced software developers and architects: Finally, the book is intended for experienced software developers and architects who want to supplement or refresh their knowledge to be able to assist their junior colleagues more effectively and are looking for some inspiration and fresh ideas to do so. In addition, various exercises can also be used in job interviews, with the convenience of having the sample solutions directly at hand for comparison. But also for the old hands there should be one or two aha experiences in finding solutions and for algorithms and data structures.
In general, I use the masculine form to keep the text easier to read. Of course, I include all female readers, and I am pleased about them.
What Does This Book Teach?
A wide-spread mix of exercises on different topics is provided by this book. Some- times some puzzles may not be of direct practical importance, but indirectly, because they improve your creativity and your ability to find solutions.
In addition to exercises and documented solutions, each topic covered in the book starts with a short introduction. By this, even those readers who may not have built up a lot of know-how in specific areas benefit. You can then use the introductions to get to grips with the exercises up to about the medium level of difficulty. In each subject area, there are always a few easier exercises to get you started. With a little practice, you should also be able to tackle more difficult problems. Occasionally there are some really challenging problems, which experts can try their hand at, or those who want to become experts.
Practical Tips and Advice
This book is packed with various practical tips. They include interesting background information. Besides, pitfalls are pointed out.
Hint: Tip from the Trenches
In boxes formatted like this you will find some tips worth knowing and additional hints to the actual text later in the book.
Difficulty Level at a Glance