Java Coding Guidelines

Author: Fred Long, Dhruv Mohindra, Robert C. Seacord , Dean F. Sutherland, David Svoboda
Publisher:  Addison-Wesley
Pages:304 
ISBN: 978-0321933157
Print: 032193315X
Kindle:B00EQ8D31A
Audience: Java Programmers
Rating: 5
Reviewer: Alex Armstrong

Not another book of dos and don'ts?!

No it's is much more than a book of dos and don'ts. If you read one book on Java this year make it this one. It is enjoyable, informative and you will be a better programmer for it, or at least you will believe you are.

What makes this book different is that it isn't just a list of rules that you read and commit to memory it is a set of 75 recommendations that tell you the basic idea, show you how not to do it and then show you the correct way. If the book has a flaw then its that there are only 75 recommendations - if you read the book it will almost certainly leave you wanting more. 

Banner

There are five chapters each dealing with a different aspect of coding in Java. It starts off with Chapter 1 Security and this is something of a shame because not every programmer is interested in security and many of the guidelines are very specific - prevent LDAP injection, prevent code injection and so on. It is interesting, and it is important given how we tend to ignore security or regard it as an afterthought, but it isn't quite as interesting as the following chapters.

Chapter 2 Defensive Programming is more general and has a wider application. Advice like minimize the scope of variables is something that you need to keep in mind no matter what you are programming. Some of these are old and reasonably well known but the presentation is still worth reading.

 

 

 

Chapter 3 Reliability comes next and here we have a matter of opinion - what exactly does enhance reliability? Some of the suggestions could be moved into defensive programing or the next chapter on making programs more understandable. In the main they are reasonable and you aren't going to argue with do not shadow or obscure identifiers in sub-scopes but not so sure about do not declare more than on variable per declaration. 

The material in Chapter 4 Program Understandability.really should be drummed into every programmer when first learning any language. After all, you don't write programs for computers you write them for other programmers. Again we have a mix of well known generalities and some very specific guidelines - be careful using visually misleading identifiers and do not place a semicolon immediately following an if, for or while condition. 

The final section Chapter 5 Programmer Misconceptions is perhaps the most interesting of all. Who could resist the possibility that they have been misled, perhaps for years and years. Again some are fairly obvious - understand the differences between bitwise and logical operators - others less so - do not attempt to help the garbage collector by setting local references - I won't do that again. 

 

Conclusions

It doesn't matter if you have encountered the advice that this book offers; it is the fact that it shows you an example or two of how not to follow the advice that makes it better than the average guidelines book.

Overall it is a good read as long as your Java is good, but not too good otherwise you probably know everything the book has to tell you. Recommended as a pleasant and worthwhile read when you have a few moments to spare.

 

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Beginning Rust Programming

Author: Ric Messier
Publisher: Wiley
Date: March 2021
Pages: 416
ISBN: 978-1119712978
Print: 1119712971
Kindle: B08WZ2D7WC
Audience: Developers wanting to learn Rust
Rating: 3
Reviewer: Mike James
Everyone seems to want to know what makes Rust special. Does this book give the answers?



Driving Value With Sprint Goals

Author: Maarten Dalmijn
Publisher: Addison-Wesley
Pages: 256
ISBN: 9780137381920
Print: 0137381921
Kindle:B0C7ZJR7N2
Audience: Scrum developers
Rating: 5
Reviewer: Kay Ewbank

Over the years I've read a lot of books about agile development and Scrum, and most concentrate on the methodology rather tha [ ... ]


More Reviews

 

Last Updated ( Friday, 27 January 2017 )