The Pragmatic Craftsman :: Simplicity from complexity : by Stanley Kubasek ::

Archive for May, 2010

Writing Good Code May 28th, 2010
Pro JPA 2 May 20th, 2010

Writing Good Code

No matter who. No matter what. No matter when. Short term.Long term. Any term. Writing good code is ALWAYS faster than writing bad code.
—Robert Martin (@UncleBob)

Is it because of pressure?

Is it because you want to be faster than others?

Or is it just because that’s the way you’ve been doing things and it has worked for you?

I hope it’s not the case. I hope you take the time to do it right. Because if not, as the saying goes, will you have the time to do it over? Or how will you look at it when you see the project codebase turning into spaghetti. Because it will.

I wish it was so clear cut. It’s usually not.

But I do believe in the theory of broken windows. One little “slack,” one not needed “if” statement starts this process. And then it goes downhill. It’s just a matter of time before somebody else puts another if. And another. Soon enough, you start searching where things have broken. It’s no longer easy to fix stuff. So you put another conditional.

That’s how things degenerate.

I’ve seen it many times in my career.

But I try to do it right. I think about consequences of my actions. Consequences of putting one line of code that will make things worse for others, worse for the codebase.

I take pride and always try to leave things in no worse condition when I found it. If I can, I try to make it better. I don’t always succeed. But I try to adjust. Learn. And always have “do it right” attitude. I think it matters.

If we had more people that cared about the quality, our dev world would be a better place.

Related
Write Your Good Code First – blog post by James Sugrue and Uncle Bob’s quote that I found there that gave me motivation to write this post.

Pro JPA 2


Pro JPA 2: Mastering the Java™ Persistence API
by Mike Keith, Merrick Schincario
ISBN 1430219564
Date Read 4/2010

My Rating


If you’re learning or planning to learn JPA 2, you must own this book. Why? It’s the most complete book on the subject out there. It’s like a JPA bible.

Just a warning: It’s not an easy read. You will most likely have to read some (if not all) chapters at least twice. Some even more. For your first read, it will probably feel dry. Only after you learn by doing, by practicing, you will start “getting it.” This was at least my experience. I really started seeing the power of the book after reading selective chapters again. But of course, your experience might be different.

This is your JPA 2 bible. JPA 2 seems easy on the surface. But if you’re doing a project at work and it requires some advanced mapping, for instance, it’s not so trivial. The nice thing about this book is that it covers the advanced topics as well. And it shows you plenty of examples.

Few missing pieces. Cache coverage is light. Not much to it. Sometimes I felt that a full example, rather than a snippet, would be more appropriate. A few times I had to search the internet to get it to work. And as I mentioned before, this book is not an easy read, be prepared.

Excellent job by the authors. Excellent resource on JPA2, which I think is a great ORM spec.

Favorite Quote

Topics

Tags

Archive

Currently Reading

Info

© 2001-2013 Stanley Kubasek About me :: Contact me

Me on Twitter

»see more

Recent Entries