Chapter Twenty Three - Next Steps
I hope that if you made it this far into the book, that you attempted the exercises. If you did, and you followed the suggestions peppered throughout the book, then you now have a grasp of the fundamentals of writing Java code. This chapter suggests books and websites to visit to help you continue to learn.
Certainly you’ve seen a lot of code snippets. Most of the code you have seen has been written in the form of @Test annotated methods with assertions. Pretty much what you will be expected to write in the real world.
Recommended Reading
I don’t recommend a lot of Java books because they are a very personal thing. There are books that people rave about that I couldn’t get my head around. And there are those that I love that other people hate.
But since I haven’t provided massive coverage of the Java language. I’ve pretty much given you “just enough” to get going and understand the code you read. I’m going to list the Java books that I gained most from, and still refer to:
- “Effective Java”
- by Joshua Bloch
- “Implementation Patterns”
- by Kent Beck
- “Growing Object-Oriented Software, Guided by Tests”
- by Steve Freeman and Nat Pryce
- “Core Java: Volume 1 - Fundamentals”
- by Cay S. Horstmann and Garry Cornell
- “Covert Java : Techniques for Decompiling, Patching and Reverse Engineering”
- by Alex Kalinovsky
- “Java Concurrency in Practice”
- by Brian Goetz
- “Mastering Regular Expressions”
- by Jeffrey Friedl
Now, to justify my selections…
Effective Java
“Effective Java” by Joshua Bloch, at the time of writing in its 2nd Edition. This book works for beginners and advanced programmers.
Java developers build up a lot of knowledge about their language from other developers. “Effective Java” helps short cut that process.
It has 78 chapters. Each, fairly short, but dense in their coverage and presentation.
When I first read it, I found it heavy going, because I didn’t have enough experience or knowledge to understand it all. But I re-read it, and have continued to re-read it over the time I have developed my Java experience. And each time I read it, I find a new nuance, or a deeper understanding of the concepts.
Because each chapter is short, I return to this book to refresh my memory of certain topics.
This was also the book that helped me understand enum well enough to use them and helped me understand concurrency well enough to then read, and understand, “Java Concurrency in Practice”.
I recommend that you buy and read this book early in your learning. Even if you don’t understand it all, read it all. Then come back to it again and again. It concentrates on very practical aspects of the Java language and can boost your real-world effectiveness tremendously.
You can find a very good overview of the book, in the form of a recording of a Joshua Bloch talk at “Google I/O 2008 - Effective Java Reloaded” on YouTube:
Implementation Patterns
Another book that benefits from repeated reading. You will take different information from it with each reading, depending on your experience level at the time.
“Implementation Patterns” by Kent Beck explains some of the thought processes involved in writing professional code.
This book was one of the books that helped me:
- concentrate on keeping my code simple,
- decide to learn the basics of Java (and know how to find information when I needed it),
- try to use in built features of the language, before bringing in a new library to my code.
The book is thin and, again dense. Most complaints I see on-line seem to stem from the length of the book and the terseness of the coverage. I found that beneficial, it meant very little padding and waste. I have learned, or re-learned, something from this book every time I read it.
Other books that cover similar topics include “Clean Code” by Robert C. Martin, and “The Pragmatic Programmer” by Andrew Hunt and David Thomas. But I found “Implementation Patterns” far more useful and applicable to my work.
For more information on Kent Beck’s writing and work, visit his web site:
Growing Object-Oriented Software
Another book I benefited from reading when I wasn’t ready for it. I was able to re-read it and learn more. I still gain value from re-reading it.
- “Growing Object-Oriented Software, Guided by Tests”, by Steve Freeman and Nat Pryce
Heavily focused on using @Test method code to write and understand your code. It also covers mock objects very well.
This book helped change my coding style, and how I approach the building of abstraction layers.
The official homepage for the book is growing-object-oriented-software.com
Covert Java
“Covert Java : Techniques for Decompiling, Patching and Reverse Engineering”, by Alex Kalinovsky starts to show its age now as it was written in 2004. But highlights some of the ways of working with Java libraries that you really wouldn’t use if you were a programmer.
But sometimes as a tester we have to work with pre-compiled libraries, without source code, and use parts of the code base out of context.
I found this a very useful book for learning about reflection and other practices related to taking apart Java applications.
You can usually pick this up quite cheaply second hand. There are other books that cover decompiling, reverse engineering and reflection. But this one got me started, and I still find it clear and simple.
Java Concurrency in Practice
Concurrency is not something I recommend trying to work with when you are starting out with Java.
But at some point you will probably want to run your code in parallel, or create some threads to make your code perform faster. And you will probably fail, and not really understand why.
I used “Effective Java” to help me get started. But “Java Concurrency in Practice” by Brian Goetz, was the book I read when I really had to make my automation abstraction layer work with concurrent code.
Core Java: Volume 1
The Core Java books are massive, over 1000 pages. And if you really want to understand Java in depth then these are the books to read.
I find them to be hard work and don’t read them often. I tend to use the JavaDoc for the Java libraries and methods themselves.
But, periodically, I want to have an overview of the language and understand the scope of the built in libraries, because there are lots of in-built features that I don’t use, that I would otherwise turn to an external library for.
Every time I’ve flicked through “Core Java”, I have discovered a nuance and a new set of features, but I don’t do it often.
Mastering Regular Expressions
We didn’t cover the full power of Regular Expressions in this book.
I tend to try and keep my code simple and readable so I’ll use simple string manipulation to start with.
But over time, I often find that I can replace a series of if blocks and string transformations with a regular expression.
Since I don’t use regular expressions often I find that each time, I have to re-learn them and I still turn to “Mastering Regular Expressions” by Jeffrey E.F. Friedl.
As an alternative to consider: “Regular Expressions Cookbook” by Jan Goyvaerts, which is also very good.
I sometimes use the tool RegexMagic regexmagic.com, written by Jan Goyvaerts when writing regular expressions, it lets me test out the regular expression across a range of example data, and generate sample code for a lot of different languages.
Jan also maintains the web site regular-expressions.info with a lot of tutorial information on it.
Recommended Videos
The videos produced by John Purcell at caveofprogramming.com have been recommended to me by many testers.
I’ve looked through some of them, and John provides example coding for many of the items covered in this book, and in the “Advancing Concepts” section.
John’s approach is geared around writing programs, and I think that if you have now finished this book, you will benefit from the traditional programmer based coverage that John provides.
Recommended Web Sites
For general Java news, and up to date conference videos, I recommend the following web sites.
Make sure you subscribe to the RSS feeds for the above sites.
I will remind you that I have a web site javaForTesters.com and I plan to add more information there, and links to other resources over time. I will also add additional exercises and examples to that site rather than continue to expand this book.
Remember, all the code used in this book, and the answers to the exercises is available to download from github.com/eviltester.
Next Steps
This has been a beginner’s book.
You can see from the “Advancing Concepts” chapter that there are a lot of features in Java that I didn’t cover. Many of them I don’t use a lot and I didn’t want to pad out the book with extensive coverage that you can find in other books or videos.
I wanted this book to walk you through the Java language in an order that I think makes sense to people who are writing code, but not necessarily writing systems.
Your next step? Keep learning.
I recommend you start with the books and videos recommended here, but also ask your team mates.
You will be working on projects, and the type of libraries you are using, and the technical domain that you are working on, may require different approaches than those mentioned in this book.
I hope you have learned that you can get a lot done quite easily, and you should now understand the fundamental classes and language constructs that you need to get started.
Now:
- start writing
@Testmethods which exercise your production code - investigate how much of your repeated manual effort can be automated
Thank you for your time spent with this book.
I wish you well for the future. This is just the start of your work with Java. I hope you’ll continue to learn more and put it to use on your projects.
My ability to use automation to support my testing and add value on projects continues to increase, the more I learn how to improve my coding skills. I hope yours does too.
References
- Java For Testers
- Joshua Bloch
- Kent Beck
- twitter.com/kentbeck
- “Three Rivers Institute” threeriversinstitute.org
- Growing Object Oriented Software, Guided by Tests
- growing-object-oriented-software.com
- Steve Freeman’s Blog higherorderlogic.com
- natpryce.com
- Core Java Book
- Java Concurrency In Practice
- Regular Expressions
- Mastering Regular Expressions home page regex.info
- regular-expressions.info/
- regexmagic.com
- regexpal.com
- www.regexr.com