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


Assembly x64 Programming

Author: Mike McGrath
Publisher: Easy Steps
Date: November 2021
Pages: 192
ISBN: 978-1840789522
Print: 1840789522
Kindle: ‎B09FTNN4P5
Audience: Developers wanting to learn assembler
Rating: 5
Reviewer: Harry Fairhead
Assembler, why would you want to learn that!



Python All-in-One, 3rd Ed (For Dummies)

Authors: John Shovic and Alan Simpson
Publisher: For Dummies
Date: April 2024
Pages: 720
ISBN: 978-1394236152
Print: 1394236158
Kindle: B0CW1C834N
Audience: People wanting to learn Python
Rating: 2
Reviewer: Mike James
All-in-one refers to the fact that this is seven books put together - why?


More Reviews

 

Last Updated ( Friday, 27 January 2017 )