aspose file tools*
The moose likes Beginning Java and the fly likes Agile Java:  A few comments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Agile Java:  A few comments" Watch "Agile Java:  A few comments" New topic
Author

Agile Java: A few comments

Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Jeff,
My copy of your book came through the post today. I have read and worked through the first two chapters so far and would like to give you my feedback.
I was surprised that by the end of the second chapter that the class CourseSession hadn't been refactored so that instead of
the code should introduce loose coupling and look like this
Also in exercises at the end of chapter 2 there is no mention of writing tests to ensure that no more than 8 white and 8 black Pawn can be created.
I think that maybe a more detailed discussion of the collection interfaces and classes is needed before some of these tasks.
Are there any plans to publish your suggested solutions to these exercises on your website?
I am throughly enjoying learning TDD which for me is a new way of thinking, some of the exercises are impossible to do in eclipse, as the IDE is too smart to allow compilation before all compilation errors are resolved.

Regards
Nigel
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Greetings Nigel,

Many thanks for the comments!

With respect to the solutions, there's an instructor manual for them available through Prentice Hall, but apparently you have to be affiliated with an institution. I'll ask Prentice Hall if I can put the code up there, but the answer may be no.

The assignment to the interface type comes later, I think around chapter 5, after I delve into interfaces and explain them. At the end of lesson 2, it's a bit too early to introduce that.

Some of the exercises you're looking at presume you *don't* yet know a lot of details about collections. It's a little harder to do, but you should be able to solve the exercises given the tools presented to you thus far in the book. Some of the exercises require a bit of creative thinking.

Within Eclipse, you still do get compilation errors upon doing saves. You can use the Problems tab to provide that level of feedback, or you can also use the existence of red squiggly underlines. But ultimately if your IDE eliminates the possibility of compile errors, then you can simply omit that step. One benefit of doing early learning without a tool such as Eclipse is that you learn how to respond to various compile errors.

I do appreciate the honest feedback and will see what I can do to improve the experience within the next edition. How's your experience progressing otherwise?

Regards,
Jeff
[ March 11, 2005: Message edited by: Jeff Langr ]

Books: Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Originally posted by Nigel Browne:
I was surprised that by the end of the second chapter that the class CourseSession hadn't been refactored so that instead of
the code should introduce loose coupling and look like this


It is in chapter 5 and it's on page 189 (with some discussion on earlier pages as to why this is important). Being on chapter 2, you're not supposed to know about interface types yet! ;-)

-Jeff-
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Well looks like I jumped the gun a little with the List comment.
Also if anyone is following this thread, you will need to be using version 3.1 of Eclipse if you want to be able to use the new features of java 1.5.
As I was using version 3.0.1 to begin with I needed to have a command prompt open to compile from, but could run junit from within the IDE.
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Greetings Nigel,

No worries about jumping the gun. But this is a good place to warn people who already know Java that the book presents things in a calculated order. I went through quite a bit of work (and rewrites) to find the least path of resistance for learning.

That means deferring things like arrays, wrappers, and C-style loops until later in the book (Lesson 7, for the most part). You'll note that the first examples don't touch any of these. There are simpler ways of going about things early on; these simpler techniques are also more "OO". A lot of this is based on observations of people struggling in this very forum--note how many people struggle with strange static problems, for example.

Thanks for the note on the appropriate Eclipse version. At the time I was wrapping up writing the book, Eclipse support for J2SE 5.0 was incomplete, so I did not use it. And while I include an appendix on IntelliJ IDEA, I created almost all of the code using TextPad and the command line (or more precisely, TextPad tools support for command-line apps).

And now, unfortunately, I'm writing 1.4 code for my current client. ;-( Ah well.

Regards,
Jeff
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
I also raised an eyebrow in chapter 3 when you named your instance of StringBuilder buffer, is this a habit, from when previously using the StringBuffer class (I wonder).

Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Originally posted by Nigel Browne:
I also raised an eyebrow in chapter 3 when you named your instance of StringBuilder buffer, is this a habit, from when previously using the StringBuffer class (I wonder).


Good call. I could argue that it's still conceptually a buffer, never mind the underlying implementation. ;-) But oh yes, it's a habit. It takes a while to unlearn some things. You'll note a couple of disclaimers in the book that discuss my use of final and override.

You'll also find some code later in the book that still uses StringBuffer. Unfortunately, this is a slip I didn't catch until too late. When I started in on the book in fall 2003, July 2003 pre-release had the StringBuilder class available (or at least I was unaware of it).

In any case, please keep sending these sorts of things in.

thanks,
-Jeff-
[ March 11, 2005: Message edited by: Jeff Langr ]
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Also see http://www.langrsoft.com/agileJava/errata.shtml
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Jeff, can you please explain exercise 1 in lession 3. I have the following test written
but when I run the test i receive the following failure message
What am I doing wrong?
[ March 14, 2005: Message edited by: Nigel Browne ]
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Greetings Nigel,

I'm presuming you omitted a line or two (ending brace, and package statement), but neither of those omitted lines are the problem.

The test case subclass needs to be declared as public (p33, a brief mention of this fact).



A tricky error message, isn't it? I should probably add this to a "common pitfalls" list in the book somewhere.

Regards,
Jeff
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Thanks for your response, I was for quite a while, and yes the error message is a little confusing.
 
Don't get me started about those stupid light bulbs.
 
subject: Agile Java: A few comments